Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Apr 1, 2025

Summary by CodeRabbit

  • Refactor
    • Streamlined the internal task management system across various generators, replacing older patterns with a unified, concise approach that improves consistency and maintainability.
  • Chore
    • Added guidance for patch-level dependency updates to keep several packages current.

These changes enhance internal workflows and code quality while maintaining the same end-user functionality.

@linear
Copy link

linear bot commented Apr 1, 2025

ENG-598 Replace taskBuilder with returning a list of tasks

Make it simpler to return tasks

@changeset-bot
Copy link

changeset-bot bot commented Apr 1, 2025

🦋 Changeset detected

Latest commit: ed36658

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@halfdomelabs/baseplate-plugin-storage Patch
@halfdomelabs/fastify-generators Patch
@halfdomelabs/react-generators Patch
@halfdomelabs/core-generators Patch
@halfdomelabs/code-morph Patch
@halfdomelabs/sync Patch
@halfdomelabs/project-builder-common Patch
@halfdomelabs/project-builder-server Patch
@halfdomelabs/project-builder-lib Patch
@halfdomelabs/project-builder-test Patch
@halfdomelabs/project-builder-cli Patch
@halfdomelabs/project-builder-web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Apr 1, 2025

Walkthrough

The changes introduce a new utility function—createGeneratorTask—imported from the @halfdomelabs/sync package and apply a consistent refactor across multiple generators. In each affected file, the traditional use of a task builder (i.e. taskBuilder.addTask) in the buildTasks method has been replaced with an arrow function that returns an array of tasks created via createGeneratorTask. Additionally, a new changeset file documents dependency patch updates and the build task refactor. These modifications update method signatures and simplify the task creation process without altering the underlying task logic.

Changes

File(s) Change Summary
.changeset/tiny-lamps-know.md New file documenting a list of dependency patch updates and noting the refactor of buildTasks to return an array of tasks.
packages/code-morph/src/morphers/build-task-refactor.* & related tests Introduced a new TypeScript morpher and corresponding unit tests that transform methods named buildTasks by replacing the use of a task builder with an array return of tasks defined using createGeneratorTask.
packages/core-generators/src/generators/.../index.ts Multiple generators (e.g. Docker, ESLint, node, prettier, ts-utils, typescript, vitest) have updated their buildTasks method. The signature is changed to use an arrow function that takes a descriptor (or no parameters) and returns an array via createGeneratorTask.
packages/fastify-generators/src/generators/.../index.ts Generators under the Fastify suite (e.g. auth, bull, core modules, cookie context, health check, server, etc.) now use an arrow function for buildTasks that returns an array of tasks created via createGeneratorTask with updated parameter handling.
packages/react-generators/src/generators/.../index.ts React generators (including those for admin components, CRUD features, Apollo, Auth, and others) have refactored their buildTasks methods. They now use a simplified signature and return an array of tasks via createGeneratorTask, replacing the previous builder pattern.

Sequence Diagram(s)

Below is a high-level sequence diagram showing the updated control flow for task creation in the generators:

sequenceDiagram
    participant G as Generator
    participant CT as createGeneratorTask
    participant R as Task Runner

    Note over G: Generator invokes buildTasks()
    G->>G: Call buildTasks({ … })
    G->>CT: For each task, invoke createGeneratorTask({config})
    CT-->>G: Return task object
    G->>G: Aggregate tasks into an array
    G->>R: Pass tasks array for execution
    R-->>G: Execute each task (using dependencies, run method, etc.)
Loading

This diagram illustrates how the generator now directly creates tasks using createGeneratorTask and returns a consolidated array for further processing.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/code-morph/src/morphers/build-task-refactor.morpher.ts (3)

14-32: Validate import existence prior to adding named import.

The logic effectively checks for an import statement containing createGenerator, then adds createGeneratorTask if missing. This ensures a minimal footprint on other imports. However, consider handling the edge case where createGenerator might be imported under a different alias. Logging a warning if the morphological assumptions don't match might help maintain clarity.


33-38: Ensure consistent logging when buildTasks is not found.

Currently, the transform simply returns if no buildTasks method is found. You might consider adding a debug or warning log for files that omit buildTasks, so users know why the automated refactor didn't apply.


63-79: Consider validating each task’s config.

Extracting the first argument to addTask is sensible. If the argument is invalid, the null fallback might silently produce an incomplete refactor. You could log or handle unknown argument structures to ensure transformations remain robust.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 39e180a and ed36658.

📒 Files selected for processing (107)
  • .changeset/tiny-lamps-know.md (1 hunks)
  • packages/code-morph/src/morphers/build-task-refactor.morpher.ts (1 hunks)
  • packages/code-morph/src/morphers/build-task-refactor.morpher.unit.test.ts (1 hunks)
  • packages/code-morph/src/morphers/tests/build-task-refactor/simple/input.ts (1 hunks)
  • packages/code-morph/src/morphers/tests/build-task-refactor/simple/output.ts (1 hunks)
  • packages/core-generators/src/generators/docker/docker-compose/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/eslint/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/node-git-ignore/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/node/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/prettier/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/ts-utils/index.ts (3 hunks)
  • packages/core-generators/src/generators/node/typescript/index.ts (4 hunks)
  • packages/core-generators/src/generators/node/vitest/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/auth-context/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/auth-plugin/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/auth-roles/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/auth/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/password-hasher-service/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/prisma-password-transformer/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/user-session-types/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth0/auth0-module/index.ts (5 hunks)
  • packages/fastify-generators/src/generators/bull/bull-mq/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/bull/fastify-bull-board/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/app-module/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/axios/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/config-service/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/error-handler-service/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/fastify-cookie-context/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-graceful-shutdown/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-health-check/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-redis/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-scripts/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-sentry/index.ts (7 hunks)
  • packages/fastify-generators/src/generators/core/fastify-server/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/logger-service/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/readme/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/request-context/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/request-service-context/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/root-module/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/service-context/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/service-file/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/email/fastify-postmark/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/email/fastify-sendgrid/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-auth/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-authorize-field/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-enums-file/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-crud-mutation/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-enum/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-find-query/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-list-query/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-object/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma-primary-key/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-scalar/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-sentry/index.ts (5 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-types-file/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos/index.ts (6 hunks)
  • packages/fastify-generators/src/generators/prisma/embedded-relation-transformer/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-crud-create/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-crud-delete/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-crud-service/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-crud-update/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-enum/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-field/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-model-id/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-model-index/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-model-unique/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-model/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-relation-field/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-timestamp-fields/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma-utils/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/stripe/fastify-stripe/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/vitest/fastify-vitest/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (5 hunks)
  • packages/react-generators/src/generators/admin/admin-bull-board/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-components/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-column/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-edit/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-embedded-form/index.ts (4 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-embedded-input/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-enum-input/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-foreign-display/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-foreign-input/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-list/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-password-input/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-queries/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-section/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-text-display/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-crud-text-input/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-home/index.ts (3 hunks)
  • packages/react-generators/src/generators/admin/admin-layout/index.ts (3 hunks)
  • packages/react-generators/src/generators/apollo/apollo-error-link/index.ts (3 hunks)
  • packages/react-generators/src/generators/apollo/apollo-error/index.ts (3 hunks)
  • packages/react-generators/src/generators/apollo/apollo-sentry/index.ts (4 hunks)
  • packages/react-generators/src/generators/apollo/react-apollo/index.ts (4 hunks)
  • packages/react-generators/src/generators/auth/auth-apollo/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-components/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-hooks/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-identify/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-layout/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-login-page/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-pages/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-service/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth0/auth0-apollo/index.ts (3 hunks)
⛔ Files not processed due to max files limit (31)
  • packages/react-generators/src/generators/auth0/auth0-callback/index.ts
  • packages/react-generators/src/generators/auth0/auth0-components/index.ts
  • packages/react-generators/src/generators/auth0/auth0-hooks/index.ts
  • packages/react-generators/src/generators/auth0/react-auth0/index.ts
  • packages/react-generators/src/generators/core/react-app/index.ts
  • packages/react-generators/src/generators/core/react-components/index.ts
  • packages/react-generators/src/generators/core/react-config/index.ts
  • packages/react-generators/src/generators/core/react-datadog/index.ts
  • packages/react-generators/src/generators/core/react-error-boundary/index.ts
  • packages/react-generators/src/generators/core/react-error/index.ts
  • packages/react-generators/src/generators/core/react-logger/index.ts
  • packages/react-generators/src/generators/core/react-not-found-handler/index.ts
  • packages/react-generators/src/generators/core/react-proxy/index.ts
  • packages/react-generators/src/generators/core/react-router/index.ts
  • packages/react-generators/src/generators/core/react-routes/index.ts
  • packages/react-generators/src/generators/core/react-sentry/index.ts
  • packages/react-generators/src/generators/core/react-tailwind/index.ts
  • packages/react-generators/src/generators/core/react-typescript/index.ts
  • packages/react-generators/src/generators/core/react-utils/index.ts
  • packages/react-generators/src/generators/core/react/index.ts
  • packages/sync/src/generators/generators.ts
  • packages/sync/src/generators/generators.unit.test.ts
  • packages/sync/src/runner/generator-runner.ts
  • packages/sync/src/utils/create-generator-types.ts
  • packages/sync/src/utils/create-generator.ts
  • packages/sync/src/utils/create-generator.unit.test.ts
  • packages/sync/src/utils/create-setup-task.ts
  • plugins/baseplate-plugin-storage/src/generators/fastify/prisma-file-transformer/index.ts
  • plugins/baseplate-plugin-storage/src/generators/fastify/storage-module/index.ts
  • plugins/baseplate-plugin-storage/src/generators/react/admin-crud-file-input/index.ts
  • plugins/baseplate-plugin-storage/src/generators/react/upload-components/index.ts
🧰 Additional context used
🧬 Code Definitions (51)
packages/fastify-generators/src/generators/prisma/prisma-crud-update/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/app-module/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/core-generators/src/generators/node/prettier/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth/auth-context/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/email/fastify-postmark/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/bull/bull-mq/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth/auth/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth/auth-roles/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/core-generators/src/generators/docker/docker-compose/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/admin/admin-crud-column/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth/user-session-types/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/service-context/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/apollo/apollo-sentry/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-auth/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-prisma-object/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/email/fastify-sendgrid/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/bull/fastify-bull-board/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-authorize-field/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/readme/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/fastify-server/index.ts (2)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/root-module/index.ts (1)
  • rootModuleConfigProvider (44-44)
packages/fastify-generators/src/generators/pothos/pothos-prisma-list-query/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/prisma/prisma-crud-service/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/prisma/prisma/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-sentry/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/axios/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/request-service-context/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-scalar/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/admin/admin-crud-embedded-input/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-types-file/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/core-generators/src/generators/node/typescript/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/fastify/index.ts (2)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/core-generators/src/generators/node/node/index.ts (1)
  • nodeSetupProvider (63-63)
packages/fastify-generators/src/generators/core/fastify-redis/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/admin/admin-bull-board/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/prisma/prisma-crud-create/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/auth/auth-identify/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/core/service-file/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-prisma-crud-mutation/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-prisma-primary-key/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/admin/admin-crud-embedded-form/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/prisma/prisma-crud-delete/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth0/auth0-module/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/auth/auth-plugin/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/pothos/pothos-enums-file/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/prisma/prisma-enum/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (11)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/core-generators/src/generators/node/node/index.ts (1)
  • nodeProvider (45-45)
packages/fastify-generators/src/generators/core/fastify-server/index.ts (1)
  • fastifyServerProvider (52-53)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-92)
packages/core-generators/src/generators/node/typescript/index.ts (1)
  • typescriptProvider (108-109)
packages/fastify-generators/src/generators/core/fastify-redis/index.ts (1)
  • fastifyRedisProvider (29-32)
packages/fastify-generators/src/generators/auth/auth/index.ts (1)
  • authProvider (34-36)
packages/fastify-generators/src/generators/core/error-handler-service/index.ts (1)
  • errorHandlerServiceProvider (55-58)
packages/fastify-generators/src/generators/core/logger-service/index.ts (1)
  • loggerServiceProvider (50-53)
packages/fastify-generators/src/generators/core/request-service-context/index.ts (1)
  • requestServiceContextProvider (57-60)
packages/core-generators/src/utils/path.ts (1)
  • makeImportAndFilePath (7-14)
packages/code-morph/src/morphers/tests/build-task-refactor/simple/input.ts (1)
packages/code-morph/src/morphers/tests/build-task-refactor/simple/output.ts (3)
  • FastifyServerProvider (47-52)
  • fastifyServerProvider (54-55)
  • fastifyServerGenerator (57-243)
packages/fastify-generators/src/generators/pothos/pothos/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/code-morph/src/morphers/tests/build-task-refactor/simple/output.ts (1)
packages/code-morph/src/morphers/tests/build-task-refactor/simple/input.ts (3)
  • FastifyServerProvider (46-51)
  • fastifyServerProvider (53-54)
  • fastifyServerGenerator (56-242)
packages/fastify-generators/src/generators/core/fastify-scripts/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
packages/react-generators/src/generators/admin/admin-crud-foreign-display/index.ts (1)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (182-190)
🔇 Additional comments (241)
.changeset/tiny-lamps-know.md (1)

1-11: LGTM: Changeset file correctly documents the refactoring and dependency updates

The changeset file properly documents both the patch updates for all affected packages and clearly describes the nature of the refactoring. It accurately reflects the changes being made across the codebase.

packages/code-morph/src/morphers/build-task-refactor.morpher.unit.test.ts (1)

1-4: LGTM: Unit test implementation looks good

The unit test file is concise and properly imports the necessary components to test the build task refactoring morpher.

packages/react-generators/src/generators/auth/auth-layout/index.ts (2)

7-11: LGTM: Properly importing required components from sync package

The imports have been updated to include createGeneratorTask from the @halfdomelabs/sync package, which is necessary for the refactored implementation.


31-76: LGTM: Successfully refactored buildTasks to return an array of tasks

The buildTasks method has been properly refactored from using a task builder to returning an array of tasks created with createGeneratorTask. The implementation preserves all the original functionality while making the code more declarative.

packages/fastify-generators/src/generators/prisma/prisma-relation-field/index.ts (2)

1-1: LGTM: Import statement correctly updated

The import statement has been properly updated to include createGeneratorTask from the @halfdomelabs/sync package.


34-95: LGTM: buildTasks refactored to return an array of tasks

The buildTasks method has been successfully refactored to use an arrow function that returns an array containing tasks created with createGeneratorTask. The implementation maintains the original functionality while simplifying the code structure.

packages/fastify-generators/src/generators/core/readme/index.ts (2)

2-2: Import of createGeneratorTask aligns with the task builder refactoring.

The addition of the createGeneratorTask import is appropriate for the new implementation pattern.


13-63: Refactor: Successfully migrated from taskBuilder to array return pattern.

The refactoring changes buildTasks from accepting a taskBuilder parameter to returning an array of tasks directly. This simplifies the API by making the task creation more explicit and functional.

The task logic itself remains unchanged, maintaining the same functionality while improving code clarity.

packages/fastify-generators/src/generators/bull/bull-mq/index.ts (2)

7-11: Import restructuring looks good.

The imports have been nicely organized to include the new createGeneratorTask function while maintaining the existing imports.


29-125: Consistent implementation of the task builder refactoring pattern.

The refactoring successfully changes buildTasks from accepting a taskBuilder parameter to returning an array of tasks directly. The implementation maintains all the existing task logic while adopting the new pattern.

packages/fastify-generators/src/generators/auth/auth-context/index.ts (2)

9-13: Import restructuring is correctly implemented.

The imports have been properly organized to include the new createGeneratorTask function along with the existing imports.


37-163: Task builder refactoring successfully applied.

The implementation has been properly refactored to use the new pattern, changing from using a taskBuilder parameter to returning an array of tasks directly. All the task logic remains functionally equivalent.

packages/react-generators/src/generators/admin/admin-crud-column/index.ts (2)

1-1: New import properly added for the refactoring.

The import of createGeneratorTask has been correctly added alongside the existing createGenerator import.


17-56: Successfully refactored to the new task creation pattern.

The implementation has been properly refactored from using taskBuilder to returning an array of tasks directly. The function signature has been updated to destructure the label parameter directly from the descriptor object, which is a clean approach.

packages/fastify-generators/src/generators/pothos/pothos-scalar/index.ts (2)

6-6: Clean import addition for createGeneratorTask.

The new import for createGeneratorTask is correctly added alongside the existing createGenerator import from the same package.


82-128: Well-structured refactor of buildTasks method.

The refactoring from a task builder pattern to directly returning an array of tasks created with createGeneratorTask maintains the same functionality while making the code more declarative. The task configuration remains unchanged, preserving the original behavior.

This refactor aligns with the PR objective to return an array of tasks instead of using a task builder. The implementation is clean and consistent with the pattern applied across other generators.

packages/react-generators/src/generators/auth/auth-service/index.ts (2)

12-12: Clean import addition for createGeneratorTask.

The new import for createGeneratorTask is correctly added alongside the existing imports from the same package.


34-110: Well-structured refactor of buildTasks method.

The refactoring replaces the task builder pattern with a functional approach that returns an array of tasks. The task's configuration, including name, dependencies, exports, and run logic, remains unchanged, ensuring the same functionality is preserved.

This implementation follows the same pattern as other generators in this PR, maintaining consistency across the codebase.

packages/fastify-generators/src/generators/auth/auth-roles/index.ts (2)

9-13: Improved import organization.

The imports have been reorganized into a cleaner, grouped format while adding the new createGeneratorTask import. This makes the code more maintainable and easier to read.


45-116: Well-structured refactor of buildTasks method.

The method has been successfully refactored from using a task builder to returning an array of tasks created with createGeneratorTask. The parameter destructuring for roles is preserved, maintaining the original functionality while simplifying the implementation.

This implementation correctly maintains all task properties and the run logic, ensuring the generator behavior remains unchanged.

packages/fastify-generators/src/generators/core/app-module/index.ts (2)

8-12: Improved import organization.

The imports have been reorganized into a cleaner, grouped format while adding the new createGeneratorTask import. This improves code readability and maintainability.


30-103: Well-structured refactor of buildTasks method.

The refactoring successfully transitions from a task builder pattern to returning an array of tasks created with createGeneratorTask. The method still accepts the descriptor parameter and passes it correctly to the task's run function, maintaining the original functionality.

This implementation aligns with the PR objective and follows the same pattern applied consistently across other generators, making the codebase more uniform.

packages/fastify-generators/src/generators/core/fastify-redis/index.ts (3)

11-15: LGTM: Added import for createGeneratorTask

The addition of createGeneratorTask import is consistent with the refactoring objective to use direct task creation instead of a task builder pattern.


38-39: LGTM: Refactored buildTasks to return an array

The method has been successfully converted from using a task builder to returning an array of tasks directly, which aligns with the PR objective.


118-119: LGTM: Task creation closing syntax

Proper closing of the createGeneratorTask call and the returned array, maintaining consistent syntax with the refactoring pattern.

packages/fastify-generators/src/generators/stripe/fastify-stripe/index.ts (3)

7-11: LGTM: Added import for createGeneratorTask

The addition of createGeneratorTask to the imports is consistent with the refactoring pattern seen across other files.


33-34: LGTM: Refactored buildTasks to return an array

Successfully converted the method from using a task builder to returning an array of tasks directly, matching the PR objective.


108-109: LGTM: Task creation closing syntax

Properly closed the createGeneratorTask call and the returned array with consistent syntax.

packages/core-generators/src/generators/docker/docker-compose/index.ts (3)

1-1: LGTM: Added import for createGeneratorTask

The import statement has been updated to include createGeneratorTask, which is required for the new task creation pattern.


32-33: LGTM: Refactored buildTasks to return an array

Successfully converted from using a task builder to returning an array of tasks directly, which simplifies the code.


109-110: LGTM: Task creation closing syntax

Properly closed the createGeneratorTask call and the returned array with consistent syntax.

packages/fastify-generators/src/generators/core/fastify-graceful-shutdown/index.ts (3)

6-6: LGTM: Updated import to include createGeneratorTask

The import statement has been correctly modified to include createGeneratorTask alongside the existing createGenerator import.


21-22: LGTM: Refactored buildTasks to return an array

Successfully converted from using a task builder to returning an array of tasks directly, consistent with the refactoring pattern.


54-55: LGTM: Task creation closing syntax

Properly closed the createGeneratorTask call and the returned array with consistent syntax.

packages/core-generators/src/generators/node/prettier/index.ts (3)

6-6: Import changes align with the refactoring approach.

The addition of createGeneratorTask import supports the new pattern of directly returning an array of tasks rather than using a task builder.


121-122: Well-structured refactoring of buildTasks method.

The conversion from a method taking a taskBuilder parameter to an arrow function returning an array of tasks improves code clarity. This approach is more declarative and makes the task creation more explicit.


285-286: Clean implementation of the task array structure.

The closing syntax of the task creation is well-formatted and maintains consistency with the new pattern established throughout the codebase.

packages/fastify-generators/src/generators/core/config-service/index.ts (4)

17-21: Import changes align with refactoring pattern.

Adding createGeneratorTask to the import list supports the new task creation pattern and maintains consistency with other refactored files.


53-54: Effective refactoring of buildTasks method.

The transition from a method that accepts a taskBuilder parameter to an arrow function returning an array of tasks enhances code readability and aligns with the new pattern.


70-71: Clean task separation in the array.

The closing of the first task and sequential definition of the second task in the array is well-structured and maintains good readability.


203-204: Consistent closing syntax for tasks array.

The closing syntax of the tasks array follows the established pattern and maintains good code formatting.

packages/fastify-generators/src/generators/prisma/prisma-utils/index.ts (3)

8-12: Restructured imports with consistent formatting.

The import block has been reorganized to include createGeneratorTask while maintaining a clean multi-line structure, which improves readability.


66-67: Effective implementation of the new task pattern.

The buildTasks method has been successfully converted to an arrow function that returns an array of tasks, improving code clarity and maintaining consistency with other refactored files.


116-117: Clean closing syntax for the task array.

The closing syntax of the task array is well-formatted and follows the established pattern throughout the codebase.

packages/fastify-generators/src/generators/email/fastify-sendgrid/index.ts (3)

6-10: Restructured imports with clean formatting.

The import block has been reorganized to include createGeneratorTask with a clean multi-line structure, enhancing readability.


28-29: Effective refactoring to the new task pattern.

The buildTasks method has been successfully converted to an arrow function that returns an array of tasks, improving code clarity and maintaining consistency with other refactored files.


66-67: Clean closing syntax for the task array.

The closing syntax of the task array is well-formatted and follows the established pattern throughout the codebase.

packages/core-generators/src/generators/node/eslint/index.ts (2)

3-9: Clean import of createGeneratorTask

The import of createGeneratorTask is properly integrated with the existing imports from the @halfdomelabs/sync package, maintaining a clean and organized import structure.


33-120: Good refactoring to functional style

The refactoring from a method that accepts a taskBuilder parameter to an arrow function that returns an array of tasks is a positive change. This functional approach is cleaner, more declarative, and eliminates the mutation pattern used in the previous implementation.

The task definition itself maintains the same functionality while benefiting from a more structured creation pattern through createGeneratorTask.

packages/react-generators/src/generators/auth0/auth0-apollo/index.ts (2)

5-9: Well-structured imports

The restructuring of imports to include createGeneratorTask along with other imports from @halfdomelabs/sync is clean and organized.


26-74: Consistent refactoring pattern

The change to buildTasks follows the same pattern as seen in other files, replacing the task builder pattern with a direct array return containing a task created via createGeneratorTask. This maintains functionality while providing a more consistent and functional approach across the codebase.

packages/fastify-generators/src/generators/prisma/prisma-model-index/index.ts (2)

1-1: Simplified import for createGeneratorTask

The import statement is clean and correctly includes both createGenerator and createGeneratorTask from the same package.


14-28: Effective parameter handling in refactored buildTasks

The refactoring of buildTasks successfully preserves the parameter handling while transitioning to the new array-returning pattern. The fields parameter is correctly passed to the arrow function, demonstrating how the new approach can still accommodate parametrized task building without using a builder pattern.

packages/fastify-generators/src/generators/prisma/prisma-model-id/index.ts (2)

1-1: Correctly imported createGeneratorTask

The import statement properly includes the createGeneratorTask function alongside the existing createGenerator import.


14-28: Consistently implemented refactoring

This file follows the same refactoring pattern as the others, showing a methodical and consistent approach across the entire PR. The buildTasks method now directly returns an array of tasks while properly handling the fields parameter, resulting in cleaner and more functional code.

packages/react-generators/src/generators/admin/admin-layout/index.ts (2)

8-12: Appropriate import addition

The addition of createGeneratorTask import aligns with the PR's objective to refactor the task creation pattern.


53-135: Clean implementation of the buildTasks refactoring pattern

The refactoring from using a task builder to returning an array of tasks is well-implemented. The function signature has been appropriately updated to remove the taskBuilder parameter, and the function body now directly returns an array containing the task created with createGeneratorTask. This change simplifies the API while maintaining the same functionality.

packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (2)

6-10: Appropriate import addition

The addition of createGeneratorTask import is consistent with the PR's objective to refactor the task creation pattern.


33-102: Well-implemented multi-task refactoring

This file demonstrates the refactoring pattern applied to a generator with multiple tasks. Both tasks have been properly converted to use createGeneratorTask and are returned in an array. The removal of the taskBuilder parameter simplifies the API while maintaining the same functionality for both the 'main' and 'prisma-generator' tasks.

packages/core-generators/src/generators/node/ts-utils/index.ts (2)

1-5: Appropriate import addition

The import of createGeneratorTask from '@halfdomelabs/sync' is consistent with the PR's objective.


58-120: Clean implementation of the buildTasks refactoring pattern

The refactoring from using a task builder to returning an array of tasks is consistent with the pattern applied across the codebase. The code remains functionally equivalent while simplifying the API surface.

packages/core-generators/src/generators/node/node/index.ts (2)

2-4: Appropriate import addition

The addition of createGeneratorTask import is consistent with the PR's objective to refactor task creation.


70-243: Well-implemented refactoring with preserved descriptor parameter

This implementation correctly preserves the descriptor parameter while removing the taskBuilder parameter, maintaining the necessary inputs for the tasks. The refactoring to use createGeneratorTask for both the setup task and main task is consistent with the pattern applied across the codebase.

packages/fastify-generators/src/generators/pothos/pothos-prisma-list-query/index.ts (2)

4-8: Improved import organization with new createGeneratorTask function.

The new import for createGeneratorTask is properly grouped with related imports from the same package, maintaining good code organization.


28-95: Well-executed refactoring of task builder pattern.

The method has been nicely refactored from using a task builder to returning an array of tasks created with createGeneratorTask. This change aligns with functional programming principles by making the function more pure (returning a value rather than having side effects).

The task configuration itself remains unchanged, ensuring that the functionality is preserved while improving code structure.

packages/fastify-generators/src/generators/prisma/prisma-crud-update/index.ts (2)

7-7: Clean import of the new utility function.

The createGeneratorTask import is correctly added alongside the existing import from the same package.


152-213: Successfully refactored to functional task creation pattern.

The buildTasks method has been properly converted from using a task builder to returning an array of tasks. The code is more declarative now, aligning with modern JavaScript/TypeScript practices.

The task configuration details (name, dependencies, run function) remain unchanged, preserving the existing functionality.

packages/fastify-generators/src/generators/prisma/prisma-crud-service/index.ts (2)

2-8: Added createGeneratorTask to existing import group.

The new import for createGeneratorTask fits naturally with the existing imports from the same package.


38-80: Clean implementation of the new task creation pattern.

The refactoring of buildTasks to return an array of tasks rather than using a task builder is well executed. This follows the same pattern as other generators in the codebase, improving consistency and maintainability.

The core functionality of the task is preserved while the code is made more functional and declarative.

packages/react-generators/src/generators/admin/admin-bull-board/index.ts (2)

6-10: Improved import structure with multi-line formatting.

The imports have been nicely reformatted to a multi-line structure to accommodate the new createGeneratorTask import, improving readability.


32-96: Successfully standardized task creation pattern.

The refactoring of buildTasks to use the functional approach (returning tasks instead of using a builder) is consistent with the changes across other generators. This improves code consistency throughout the codebase.

The task configuration itself remains unchanged, ensuring that the functionality is preserved.

packages/react-generators/src/generators/admin/admin-crud-enum-input/index.ts (1)

2-2: Clean refactor to return task array

The refactoring simplifies the API by moving from the builder pattern to a more declarative approach. This makes the code more maintainable and easier to understand.

Also applies to: 25-26, 75-76

packages/fastify-generators/src/generators/prisma/prisma-model/index.ts (1)

1-6: Good consistent refactoring

The change from using a task builder to returning an array of tasks created with createGeneratorTask is clean and follows a consistent pattern across the codebase. The functionality remains unchanged while improving the code structure.

Also applies to: 41-42, 72-73

packages/fastify-generators/src/generators/prisma/prisma-enum/index.ts (1)

1-1: Refactor aligns with the PR objective

The code now uses the same task creation pattern as the other refactored files, making the codebase more consistent. The createGeneratorTask function provides a cleaner, more declarative API for defining tasks.

Also applies to: 15-16, 29-30

packages/core-generators/src/generators/node/node-git-ignore/index.ts (1)

3-3: Consistent implementation of the refactoring

The code now returns an array of tasks directly instead of using a task builder. This makes the API more functional and reduces the need for mutable state. The implementation is consistent with the changes in other files.

Also applies to: 26-27, 85-86

packages/fastify-generators/src/generators/pothos/pothos-prisma-object/index.ts (1)

10-10: Well-executed refactoring of the task building process

This change effectively transforms the buildTasks method from using a task builder pattern to a more functional approach. The refactoring:

  • Imports the new createGeneratorTask utility
  • Changes the method signature to return an array directly
  • Preserves all the existing task functionality and structure

The new approach is cleaner and follows a more consistent pattern across the codebase.

Also applies to: 43-146

packages/fastify-generators/src/generators/bull/fastify-bull-board/index.ts (1)

8-12: Clean refactoring with proper handling of multiple tasks

Good implementation of the new pattern with multiple tasks. The change:

  • Updates imports to include createGeneratorTask
  • Refactors buildTasks to return an array of tasks directly
  • Maintains all existing functionality for both the main and formBody tasks

This approach is more functional and eliminates the need for the task builder parameter, making the code easier to understand.

Also applies to: 35-147

packages/react-generators/src/generators/admin/admin-crud-list/index.ts (1)

8-8: Consistent implementation of the new task building pattern

The refactoring here successfully adapts the complex admin-crud-list generator to the new pattern:

  • Adds the createGeneratorTask import
  • Transforms buildTasks to return a task array directly
  • Preserves all the existing functionality and parameter handling

This change maintains all the complex logic while making the code structure more consistent with the rest of the codebase.

Also applies to: 37-231

packages/fastify-generators/src/generators/auth/prisma-password-transformer/index.ts (1)

2-2: Concise implementation of the task pattern for a simple generator

This refactoring is clean and straightforward:

  • Adds the appropriate import for createGeneratorTask
  • Converts buildTasks to the new arrow function syntax returning an array
  • Wraps the existing task in createGeneratorTask while maintaining all functionality

The change is consistent with the overall refactoring pattern and improves code readability.

Also applies to: 17-55

packages/fastify-generators/src/generators/auth/password-hasher-service/index.ts (2)

9-13: Import adds createGeneratorTask from @halfdomelabs/sync

The import statement has been updated to include createGeneratorTask, which is needed for the new task creation pattern.


33-78: Successfully refactored buildTasks to return an array of tasks

The method has been converted from a function receiving a taskBuilder parameter to an arrow function that returns an array containing a task created via createGeneratorTask. This change simplifies the task creation process while maintaining the same functionality.

The task configuration itself (name, dependencies, exports, run function) remains unchanged, ensuring that the generator's behavior is preserved.

packages/fastify-generators/src/generators/pothos/pothos-types-file/index.ts (2)

8-12: Import adds createGeneratorTask from @halfdomelabs/sync

The import statement has been updated to include createGeneratorTask, which is needed for the new task creation pattern.


44-113: Successfully refactored buildTasks to return an array of tasks

The method has been converted from a function receiving a taskBuilder parameter to an arrow function that returns an array containing a task created via createGeneratorTask. The function now directly destructures fileName and categoryOrder from its parameter instead of having them passed separately from the taskBuilder.

The task configuration itself (name, dependencies, exports, run function) remains unchanged, ensuring that the generator's behavior is preserved.

packages/fastify-generators/src/generators/pothos/pothos-prisma-enum/index.ts (2)

2-2: Import adds createGeneratorTask with existing imports

The import statement has been updated to include createGeneratorTask alongside the existing import of createGenerator.


18-54: Successfully refactored buildTasks to return an array of tasks

The method has been converted from a function receiving a taskBuilder parameter to an arrow function that returns an array containing a task created via createGeneratorTask. The function now directly destructures enumName from its parameter instead of having it passed separately from the taskBuilder.

The task configuration itself (name, dependencies, run function) remains unchanged, ensuring that the generator's behavior is preserved.

packages/fastify-generators/src/generators/email/fastify-postmark/index.ts (2)

6-10: Import adds createGeneratorTask from @halfdomelabs/sync

The import statement has been updated to include createGeneratorTask, which is needed for the new task creation pattern.


27-65: Successfully refactored buildTasks to return an array of tasks

The method has been converted from a function receiving a taskBuilder parameter to an arrow function that returns an array containing a task created via createGeneratorTask.

The task configuration itself (name, dependencies, exports, run function) remains unchanged, ensuring that the generator's behavior is preserved.

packages/react-generators/src/generators/admin/admin-crud-section/index.ts (2)

3-3: Import of createGeneratorTask aligns with the refactoring goal.

The addition of the createGeneratorTask import is necessary for the refactored implementation of buildTasks.


26-43: LGTM: Clean refactor of buildTasks method.

The transformation of buildTasks from a method accepting a task builder to an arrow function returning an array of tasks created with createGeneratorTask is well-implemented. The task maintains the same functionality with identical name, dependencies, exports, and run function.

packages/fastify-generators/src/generators/pothos/pothos-prisma-find-query/index.ts (2)

4-8: Imports restructured to include createGeneratorTask.

The import structure has been properly updated to include the createGeneratorTask function while maintaining the other necessary imports.


35-132: Well-executed refactor of the buildTasks method.

The buildTasks method has been correctly refactored to receive parameters directly (without taskBuilder) and return an array containing a task created with createGeneratorTask. The task maintains the same functionality, including name, dependencies, exports, and the complex run function for handling Pothos Prisma find queries.

packages/react-generators/src/generators/auth/auth-pages/index.ts (2)

2-6: Imports restructured to include createGeneratorTask.

The import structure has been properly updated to include the createGeneratorTask function alongside the other necessary imports.


22-37: Consistent refactoring of buildTasks method.

The buildTasks method has been cleanly converted to an arrow function that returns an array containing a task created with createGeneratorTask. The task maintains identical functionality with the same name, dependencies, exports, and run function.

packages/react-generators/src/generators/admin/admin-crud-text-input/index.ts (2)

2-2: Import statement updated to include createGeneratorTask.

The import statement has been properly updated to include both createGenerator and createGeneratorTask from the same package.


29-60: Successfully refactored buildTasks to follow the new pattern.

The buildTasks method has been properly refactored to directly accept the required parameters and return an array containing a task created with createGeneratorTask. The task maintains the same functionality with identical name, dependencies, and the complex run function that handles different input types.

packages/fastify-generators/src/generators/core/fastify-cookie-context/index.ts (3)

7-7: Consistent update to include createGeneratorTask

The import is correctly updated to include createGeneratorTask for the new task creation pattern.


23-24: Well-structured refactor of buildTasks method

The method signature has been appropriately changed from taking a taskBuilder parameter to returning an array of tasks directly, which aligns with the PR objective of refactoring task creation.


85-86: Correctly closing task definition

The closing brackets and array syntax are properly structured.

packages/react-generators/src/generators/admin/admin-home/index.ts (3)

7-11: Import statements properly organized

The imports now include createGeneratorTask which is correctly grouped with other related functions from @halfdomelabs/sync.


31-32: Consistent refactoring of buildTasks method

The method has been successfully converted from taking a taskBuilder parameter to returning an array of tasks created with createGeneratorTask, matching the PR objectives.


71-72: Task definition properly closed

The closing syntax for the task definition and array is correct.

packages/fastify-generators/src/generators/pothos/pothos-auth/index.ts (4)

7-11: Imports correctly updated

The import statement has been properly modified to include createGeneratorTask from @halfdomelabs/sync.


44-45: Method signature appropriately simplified

The buildTasks method has been refactored to only accept the destructured requireOnRootFields parameter without the taskBuilder, which aligns with the new pattern while preserving functionality.


97-98: First task appropriately closed

The closing syntax for the first task is correct with proper formatting.


98-117: Second task correctly converted

The second task 'auth-formatter' has been properly converted to use createGeneratorTask while maintaining its functionality.

packages/fastify-generators/src/generators/auth/user-session-types/index.ts (3)

8-12: Import statement properly updated

The imports now correctly include createGeneratorTask from @halfdomelabs/sync, grouped with related functions.


30-31: buildTasks method consistently refactored

The method has been successfully converted from taking a taskBuilder parameter to returning an array of tasks, aligning with the PR objective.


72-73: Task definition correctly closed

The closing syntax for the task definition and array is proper.

packages/fastify-generators/src/generators/vitest/fastify-vitest/index.ts (2)

7-11: LGTM: Clean import addition.

Added the createGeneratorTask import which is needed for the buildTasks refactoring.


27-28: Well-structured refactoring of buildTasks method.

The buildTasks method has been refactored from taking a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. This matches the PR's goal of having buildTasks return an array instead of using a task builder.

Also applies to: 61-62

packages/react-generators/src/generators/admin/admin-crud-queries/index.ts (2)

6-6: LGTM: Import added for refactoring.

Added the createGeneratorTask import which is needed for the buildTasks refactoring.


71-72: Clean implementation of buildTasks refactoring.

The buildTasks method has been successfully refactored from taking a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. The parameter structure has been preserved while simplifying the task creation process.

Also applies to: 328-329

packages/react-generators/src/generators/admin/admin-crud-text-display/index.ts (2)

2-2: LGTM: Import updated for refactoring.

Updated imports to include createGeneratorTask which is required for the buildTasks refactoring.


15-16: Well-executed refactoring of buildTasks method.

The buildTasks method has been cleanly refactored from using a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. This simpler implementation maintains the same functionality while aligning with the PR's objective.

Also applies to: 29-30

packages/fastify-generators/src/generators/prisma/prisma-field/index.ts (2)

1-1: LGTM: Import updated correctly.

Added the createGeneratorTask import which is needed for the buildTasks refactoring.


54-55: Consistent implementation of buildTasks refactoring pattern.

The buildTasks method has been properly refactored from using a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. This maintains the descriptor parameter while simplifying how tasks are created.

Also applies to: 84-85

packages/core-generators/src/generators/node/vitest/index.ts (3)

5-5: Added createGeneratorTask import from sync package.

The import of createGeneratorTask function supports the refactoring of task creation in the generator.


38-39: Refactored buildTasks to return an array of tasks.

The method has been updated from accepting a task builder to directly returning an array of task objects. This simplifies the API by removing the need for a task builder parameter.


147-148: Task creation changed to use createGeneratorTask.

The refactoring completes with proper brackets and parentheses for returning the task array. This approach is more functional and easier to understand compared to using a task builder.

packages/fastify-generators/src/generators/pothos/pothos-prisma-primary-key/index.ts (3)

2-2: Added createGeneratorTask import from sync package.

The import statement has been updated to include the createGeneratorTask function needed for the refactored buildTasks method.


24-25: Refactored buildTasks to use function return pattern.

The method signature now accepts model parameters directly and returns an array of tasks instead of using a task builder object. This aligns with the more functional approach being implemented across generators.


88-89: Simplified task creation with createGeneratorTask.

The closing brackets and array syntax complete the refactoring pattern, resulting in a cleaner approach to task creation.

packages/react-generators/src/generators/admin/admin-crud-embedded-input/index.ts (3)

2-6: Restructured imports to include createGeneratorTask.

The import statements have been reorganized to include createGeneratorTask while maintaining a clean multi-line import structure.


33-34: Refactored buildTasks to return task array.

The method signature has been updated to remove the taskBuilder parameter while preserving the destructured options parameters. The arrow function now returns an array containing tasks created with createGeneratorTask.


126-127: Completed task array creation pattern.

The closing brackets and array syntax finalize the refactoring to the new task creation pattern.

packages/fastify-generators/src/generators/auth/auth/index.ts (3)

8-8: Added createGeneratorTask import from sync package.

The import was added to support the refactored task creation approach.


42-44: Refactored buildTasks to handle multiple tasks.

The method now returns an array with multiple tasks created via createGeneratorTask. This includes both the setup task and the main task, demonstrating the flexibility of the new approach.


86-87: Completed multi-task array creation.

The refactoring is completed with proper closure of the task definition and array, resulting in a more consistent and functional approach to task creation across all generators.

packages/fastify-generators/src/generators/core/axios/index.ts (2)

8-8: Good addition of the createGeneratorTask import.

The import of createGeneratorTask aligns with the PR's objective to refactor the task creation pattern.


19-58: Clean refactoring of buildTasks method.

The change from using a mutable taskBuilder parameter to returning an array of tasks directly is a good improvement that:

  1. Makes the code more declarative and functional
  2. Reduces the need to track the state of a mutable object
  3. Simplifies the API by making the task creation more explicit

The implementation preserves all the original functionality while making the code structure cleaner.

packages/react-generators/src/generators/auth/auth-apollo/index.ts (2)

5-9: Good organization of imports.

The imports have been reorganized to include createGeneratorTask from @halfdomelabs/sync, which is required for the task creation refactoring.


28-118: Consistent implementation of the buildTasks refactoring.

The refactoring follows the same pattern as other files, replacing the taskBuilder parameter with a function that returns an array of tasks created with createGeneratorTask. This maintains a consistent approach across the codebase while making the code more declarative and easier to follow.

packages/fastify-generators/src/generators/pothos/pothos-authorize-field/index.ts (2)

1-1: Good addition of the createGeneratorTask import.

The import statement now includes createGeneratorTask which is required for the task creation refactoring.


16-31: Well-implemented buildTasks refactoring while preserving descriptor parameter.

The refactoring follows the same pattern as other files but correctly maintains the descriptor parameter which is necessary for this specific generator. This demonstrates a thoughtful approach to the refactoring, ensuring that functional requirements are preserved while improving the code structure.

packages/fastify-generators/src/generators/vitest/prisma-vitest/index.ts (2)

12-16: Well-organized imports to include createGeneratorTask.

The imports have been restructured to include createGeneratorTask from @halfdomelabs/sync, which is necessary for the task creation refactoring.


37-138: Consistent implementation of buildTasks refactoring.

The change follows the same pattern as other files in this PR, replacing the taskBuilder parameter with a function that returns an array of tasks created with createGeneratorTask. This maintains consistency across the codebase while making the code more declarative and functional.

This complex generator with multiple dependencies and exports has been refactored cleanly without changing any of the core functionality.

packages/fastify-generators/src/generators/prisma/prisma-model-unique/index.ts (2)

1-1: Added a new utility function for task creation.

Import statement now includes createGeneratorTask alongside the existing createGenerator, enabling the new task creation pattern.


18-32: Refactored buildTasks to use functional approach.

The implementation has been successfully refactored from using a task builder pattern to a more functional approach that directly returns an array of tasks. This change maintains the same functionality while making the code more declarative and easier to understand.

packages/fastify-generators/src/generators/prisma/embedded-relation-transformer/index.ts (2)

7-7: Added createGeneratorTask import for task creation.

The import statement now includes createGeneratorTask from the sync package, which is a key part of the refactoring strategy.


188-631: Refactored buildTasks to return an array of tasks.

This complex generator has been successfully refactored to use the new task creation pattern. The implementation now:

  1. Uses parameter destructuring directly in the function signature
  2. Returns an array of tasks created with createGeneratorTask
  3. Maintains the same task functionality while making the structure more consistent

The change improves code readability by making the task definition pattern consistent across the codebase.

packages/fastify-generators/src/generators/core/fastify-server/index.ts (3)

14-14: Added createGeneratorTask import for task creation.

The import statement now includes createGeneratorTask from the sync package, enabling the new task creation pattern.


59-76: Refactored first task to use the new task creation pattern.

The first task 'root-module-config' has been refactored to use createGeneratorTask. The change includes:

  1. Switching from a function with a taskBuilder parameter to an arrow function returning an array
  2. Using destructuring in the run method's parameters
  3. Using { taskId } as the second parameter instead of accessing taskBuilder.generatorName

The task functionality remains the same while the structure is more consistent.


76-240: Refactored second task to use the new task creation pattern.

The second task 'main' has been successfully refactored to use createGeneratorTask, maintaining the same functionality while improving consistency with the project's new task creation pattern.

packages/fastify-generators/src/generators/core/request-service-context/index.ts (2)

15-15: Added createGeneratorTask import for task creation.

The import statement now includes createGeneratorTask from the sync package, which is used in the refactored task creation pattern.


66-181: Refactored buildTasks to use the functional approach.

The implementation has been successfully refactored to return an array of tasks created with createGeneratorTask instead of using a task builder pattern. This change:

  1. Makes the code more declarative
  2. Maintains the same task functionality
  3. Creates consistency with the new task creation pattern used throughout the codebase

The refactoring is clean and maintains all the original behavior while improving the code structure.

packages/fastify-generators/src/generators/core/logger-service/index.ts (2)

15-16: Clean import of the new utility function.

Good job adding the import for createGeneratorTask from '@halfdomelabs/sync'.


59-151: Well-executed refactoring of the buildTasks method.

This change elegantly transforms the task building approach from an imperative style using a taskBuilder parameter to a more functional style that directly returns an array of tasks. The refactoring simplifies the code without changing the task's functionality, making it more maintainable and declarative.

packages/react-generators/src/generators/admin/admin-crud-embedded-form/index.ts (2)

10-12: Cleanly imported the createGeneratorTask utility.

The import of createGeneratorTask from '@halfdomelabs/sync' is properly included.


141-421: Excellent refactoring of the more complex buildTasks method.

This is a good transformation of the multi-task generator. You've successfully:

  1. Changed the method signature to remove the taskBuilder parameter
  2. Converted to an arrow function that returns an array of tasks
  3. Used createGeneratorTask consistently for both tasks
  4. Maintained all the task functionality while improving the code structure

The resulting code is more functional and declarative, which enhances readability and maintainability.

packages/fastify-generators/src/generators/prisma/prisma-crud-create/index.ts (2)

7-7: Correctly updated the import statement.

Good job including createGeneratorTask in the import from '@halfdomelabs/sync'.


132-192: Consistent refactoring of the buildTasks method.

The change from a traditional function with a taskBuilder parameter to an arrow function returning an array with createGeneratorTask is well-implemented and aligns with the project-wide refactoring pattern.

packages/fastify-generators/src/generators/pothos/pothos-enums-file/index.ts (2)

8-12: Nicely organized imports with the new utility.

The imports have been cleanly reorganized to include createGeneratorTask from '@halfdomelabs/sync'.


43-100: Consistent with the project-wide refactoring pattern.

This implementation follows the same pattern as the other files, converting from a taskBuilder approach to directly returning an array of tasks created with createGeneratorTask. The transition is clean and well-executed.

packages/fastify-generators/src/generators/core/service-file/index.ts (2)

10-11: Added createGeneratorTask import to support the refactoring.

Good addition of the createGeneratorTask import to support the new task creation pattern.


58-136: Clean refactoring to functional style.

The refactoring from a method with taskBuilder parameter to an arrow function returning an array of tasks is well-implemented. This approach is more declarative and aligns with functional programming principles.

packages/react-generators/src/generators/apollo/apollo-error/index.ts (2)

8-12: Imports reorganized to include createGeneratorTask.

Good restructuring of imports to add createGeneratorTask while maintaining proper formatting.


28-64: Task builder pattern successfully replaced with array return.

The refactoring from using a task builder to returning an array of tasks created via createGeneratorTask maintains the same functionality while improving code structure.

packages/react-generators/src/generators/auth/auth-login-page/index.ts (2)

11-12: Added createGeneratorTask import to support the refactoring.

Good addition of the necessary import for the refactoring implementation.


37-116: Successfully refactored to use destructured parameter.

This implementation correctly preserves the destructured allowedRoles parameter while transitioning to the array return pattern.

packages/fastify-generators/src/generators/prisma/prisma/index.ts (2)

16-17: Added createGeneratorTask import for the refactoring.

Good addition of the necessary import to support the new task creation pattern.


81-274: Successfully refactored complex task to use array return pattern.

This large task has been successfully refactored to the new pattern while maintaining all its complex functionality. The change is consistent with the overall refactoring strategy across all files.

packages/react-generators/src/generators/admin/admin-crud-edit/index.ts (2)

8-11: Import change for new task creation pattern

The import statement has been updated to include createGeneratorTask from @halfdomelabs/sync, which is needed for the new task creation pattern.


54-55: Refactored buildTasks to return an array of tasks

The buildTasks method has been refactored from accepting a taskBuilder and using taskBuilder.addTask() to directly returning an array of tasks created with createGeneratorTask(). This approach simplifies the API and makes the task creation more explicit.

Also applies to: 329-330

packages/react-generators/src/generators/auth/auth-identify/index.ts (2)

7-11: Added import for createGeneratorTask

The import statement has been properly updated to include createGeneratorTask from @halfdomelabs/sync.


31-32: Refactored buildTasks to return an array

The buildTasks method has been refactored to return an array of tasks directly using the createGeneratorTask() function, which aligns with the overall PR objective.

Also applies to: 76-77

packages/fastify-generators/src/generators/prisma/prisma-timestamp-fields/index.ts (2)

1-1: Updated import to include createGeneratorTask

Import statement has been properly updated to include createGeneratorTask along with createGenerator from @halfdomelabs/sync.


15-16: Refactored buildTasks to directly return tasks array

The buildTasks method has been successfully refactored to return an array of tasks created with createGeneratorTask(), which simplifies the task creation process.

Also applies to: 51-52

packages/fastify-generators/src/generators/pothos/pothos-prisma-crud-mutation/index.ts (2)

8-12: Added createGeneratorTask import

The import statement has been properly updated to include createGeneratorTask from @halfdomelabs/sync.


40-41: Refactored buildTasks to return an array

The buildTasks method has been successfully refactored to return an array containing a task created with createGeneratorTask(). This change maintains the existing functionality while using the new, more consistent pattern.

Also applies to: 210-211

packages/fastify-generators/src/generators/core/fastify-scripts/index.ts (2)

9-9: LGTM: Import of createGeneratorTask function

The addition of the createGeneratorTask import aligns with the refactoring goal to return an array of tasks directly.


29-70: Good refactoring to array-based task pattern

The buildTasks function has been successfully refactored from accepting a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. This maintains the same functionality while making the task creation process more explicit and direct.

packages/react-generators/src/generators/apollo/apollo-sentry/index.ts (2)

7-7: LGTM: Import updated to include createGeneratorTask

The import statement has been properly modified to include the createGeneratorTask function.


20-103: Well-structured refactoring with multiple tasks

Good implementation of the refactoring pattern with multiple tasks. The buildTasks method now returns an array of tasks created with createGeneratorTask, maintaining the same functionality while improving code clarity. This demonstrates the pattern works well for generators with multiple tasks.

packages/react-generators/src/generators/apollo/apollo-error-link/index.ts (2)

2-2: LGTM: Import updated to include createGeneratorTask

The import has been properly updated to include the createGeneratorTask function.


17-95: Task refactoring looks good

The buildTasks method has been successfully refactored to return an array with a task created using createGeneratorTask. This maintains the original functionality while making the task creation more explicit.

packages/fastify-generators/src/generators/auth0/auth0-module/index.ts (2)

10-14: LGTM: Imports updated to include createGeneratorTask

The imports have been properly reorganized to include the createGeneratorTask function.


43-228: Good implementation of parameter handling with new pattern

Excellent implementation of the refactoring pattern that preserves the ability to accept options parameters. The buildTasks arrow function still accepts the options but now returns an array of tasks created with createGeneratorTask. This demonstrates how the new pattern can accommodate buildTasks functions that take additional parameters while maintaining the same functionality.

packages/fastify-generators/src/generators/core/service-context/index.ts (3)

13-14: LGTM: Added import for createGeneratorTask.

The new import is correctly added for the new function being used in the refactored code.


56-57: Refactored buildTasks to return an array instead of using a taskBuilder.

The buildTasks method has been correctly refactored to return an array of tasks directly rather than receiving and modifying a taskBuilder object. This change aligns with a more functional programming approach and makes the component's task structure more declarative.

Also applies to: 194-195


57-58: LGTM: Using createGeneratorTask to wrap task definition.

The task is properly wrapped with createGeneratorTask, maintaining all its original functionality while adapting to the new task creation pattern.

Also applies to: 193-194

packages/fastify-generators/src/generators/core/root-module/index.ts (4)

12-13: LGTM: Added import for createGeneratorTask.

The new import is correctly added for the new function being used in the refactored code.


72-74: Refactored buildTasks to return an array with createGeneratorTask.

The first task (setupTask) is correctly wrapped with createGeneratorTask. This simplified approach removes the need for a mutable taskBuilder object.


74-99: LGTM: rootModuleImport task correctly wrapped with createGeneratorTask.

The rootModuleImport task maintains its original functionality while adapting to the new task creation pattern.


100-197: LGTM: appModule task correctly wrapped with createGeneratorTask.

The appModule task maintains its original functionality while adapting to the new task creation pattern.

packages/core-generators/src/generators/node/typescript/index.ts (5)

9-10: LGTM: Added import for createGeneratorTask.

The new import is correctly added for the new function being used in the refactored code.


180-181: Refactored buildTasks to return an array while preserving descriptor parameter.

The function signature has been updated to maintain the descriptor parameter while changing to the array return approach. This ensures backward compatibility with the existing descriptor usage.


181-182: LGTM: setupTask correctly wrapped with createGeneratorTask.

The setupTask is properly wrapped with createGeneratorTask while maintaining its original functionality.


182-289: LGTM: Main task correctly wrapped with createGeneratorTask.

The main task with typescript provider functionality maintains its original logic while adapting to the new task creation pattern.


290-352: LGTM: File task correctly wrapped with createGeneratorTask.

The file task with typescriptFile provider functionality maintains its original logic while adapting to the new task creation pattern.

packages/react-generators/src/generators/admin/admin-crud-foreign-input/index.ts (3)

1-2: LGTM: Added import for createGeneratorTask.

The import statement has been correctly updated to include the createGeneratorTask function.


27-37: Refactored buildTasks to directly destructure parameters.

The buildTasks function signature has been elegantly updated to directly destructure the parameters from an object instead of having a separate taskBuilder parameter. This approach is cleaner and more maintainable.


38-39: LGTM: Task correctly wrapped with createGeneratorTask.

The main task is properly wrapped with createGeneratorTask while maintaining its original functionality.

Also applies to: 106-107

packages/fastify-generators/src/generators/core/fastify-health-check/index.ts (2)

9-13: Clean import update.

The import statement has been updated to include createGeneratorTask from @halfdomelabs/sync, which is necessary for the new implementation of buildTasks.


33-100: Clean refactor of buildTasks method.

The method has been refactored from accepting a taskBuilder parameter to returning an array of tasks created with createGeneratorTask. This approach is more declarative and aligns with functional programming principles by directly creating and returning task objects instead of using the builder pattern.

The task configuration remains unchanged, preserving the existing functionality while simplifying the code structure.

packages/fastify-generators/src/generators/prisma/prisma-crud-delete/index.ts (2)

7-7: Clean import update.

Added import for createGeneratorTask which is needed for the new implementation of buildTasks.


112-147: Clean refactor of buildTasks method.

The method has been refactored from accepting a taskBuilder parameter to returning an array of tasks. The implementation now directly creates a task using createGeneratorTask and properly preserves the descriptor parameter which is correctly passed to the task configuration.

This refactoring maintains the same functionality while making the code more direct and eliminating the intermediary builder pattern.

packages/react-generators/src/generators/auth/auth-hooks/index.ts (2)

12-12: Clean import update.

Added import for createGeneratorTask which is required for the new implementation of buildTasks.


40-177: Clean refactor of buildTasks method.

The method has been refactored from accepting a taskBuilder parameter to an arrow function that returns an array of tasks. The implementation now directly destructures userQueryName from its parameters and uses createGeneratorTask to create the task directly.

This approach is more declarative and aligns with functional programming principles by directly creating and returning task objects instead of using the builder pattern.

packages/fastify-generators/src/generators/pothos/pothos/index.ts (2)

20-20: Clean import update.

Added import for createGeneratorTask which is required for the new implementation of buildTasks.


78-378: Clean comprehensive refactor of buildTasks method.

The method has been refactored from accepting a taskBuilder parameter to an arrow function that returns an array of tasks. This file demonstrates a more extensive change as it contains multiple tasks (setup, schema, main, generate-schema) which are now all created directly with createGeneratorTask and returned in an array.

This refactoring maintains the same functionality while making the code more direct and eliminating the intermediary builder pattern. The approach is more declarative and consistent with the changes made across other files in this PR.

packages/react-generators/src/generators/admin/admin-components/index.ts (3)

9-13: Import changes look good.

The addition of the createGeneratorTask import is consistent with the PR objective of refactoring the buildTasks method.


30-32: Refactored buildTasks implementation looks clean.

The change from accepting a taskBuilder parameter to returning an array of tasks creates a more functional approach and aligns with the PR objective.


106-107: Properly closed the task array.

The closing brackets are correctly placed to complete the array returned by buildTasks.

packages/fastify-generators/src/generators/auth/auth-plugin/index.ts (3)

7-7: Import statement updated correctly.

The addition of createGeneratorTask import follows the refactoring pattern consistently.


23-24: Refactored buildTasks method looks good.

The implementation follows the consistent pattern of returning an array of tasks created with createGeneratorTask.


75-76: Correctly closed the task array.

The closing brackets are properly placed to complete the array structure.

packages/fastify-generators/src/generators/core/fastify/index.ts (5)

12-13: Import statement updated correctly.

The addition of createGeneratorTask follows the refactoring pattern consistently.


67-68: Refactored buildTasks implementation with multiple tasks.

The change to return an array of tasks is implemented correctly for a more complex case with multiple tasks.


73-74: Updated parameter destructuring to use taskId.

The run method now correctly uses the taskId from the second parameter object instead of using generatorName.


77-89: Tasks properly closed and structured.

The closing structure for each task and the continuation of the array is correctly implemented.


176-177: Array properly closed.

The final closing brackets for the task and array are correctly placed.

packages/react-generators/src/generators/admin/admin-crud-password-input/index.ts (3)

2-2: Import statement updated correctly.

The import of createGeneratorTask is properly added to support the refactored implementation.


18-19: Parameter handling improved in the refactored buildTasks.

The buildTasks method now directly destructures label and modelField in its parameters instead of receiving them in a separate object, which simplifies the code.


54-55: Properly closed the task array.

The closing brackets are correctly placed to complete the array returned by buildTasks.

packages/react-generators/src/generators/auth/auth-components/index.ts (2)

8-12: Good refactoring: Adding createGeneratorTask import

This import change is necessary for the new approach of building tasks. The change is consistent with the PR's objective of refactoring the buildTasks method.


32-75: Great refactoring pattern to simplify task creation

The change from using a taskBuilder parameter to directly returning an array of tasks created with createGeneratorTask is a good improvement. This approach is:

  • More declarative
  • Eliminates mutable state (the taskBuilder)
  • Makes the code easier to reason about

The task logic itself remains unchanged, maintaining compatibility while improving the codebase structure.

packages/fastify-generators/src/generators/core/request-context/index.ts (2)

14-14: Good refactoring: Adding createGeneratorTask import

This import change is necessary for the new approach to building tasks. The change is consistent with the PR's objective.


45-111: Great refactoring pattern for multiple tasks

The refactoring from using a taskBuilder parameter to directly returning an array of tasks demonstrates how this pattern scales well to generators with multiple tasks. Both the 'logger-request-context' and 'main' tasks are now created with createGeneratorTask in a more declarative way.

This approach:

  • Makes the task structure more visible
  • Eliminates mutable state
  • Creates a consistent pattern across the codebase

The task logic itself remains unchanged, maintaining compatibility while improving code quality.

packages/react-generators/src/generators/admin/admin-crud-foreign-display/index.ts (2)

2-6: Good refactoring: Reorganized imports and added createGeneratorTask

The imports have been well-organized and the required createGeneratorTask function is now imported, keeping with the standardized approach for this PR.


33-81: Excellent refactoring with improved parameter handling

This refactoring shows a particularly good improvement by:

  1. Changing from a function with a taskBuilder parameter to an arrow function returning an array of tasks
  2. Moving the destructured parameters to the function signature directly (buildTasks({ localField, isOptional, ... }) => [...])

This approach:

  • Makes the function signature more explicit about the parameters it accepts
  • Creates a more declarative pattern for task creation
  • Eliminates the need for a mutable taskBuilder
  • Standardizes the pattern across the codebase

The task logic remains unchanged, maintaining compatibility while improving code quality.

packages/fastify-generators/src/generators/core/error-handler-service/index.ts (2)

16-16: Good refactoring: Adding createGeneratorTask import

This import change is necessary for the new approach to building tasks and maintains consistency with the PR's objective.


65-187: Great refactoring pattern applied consistently to complex tasks

This refactoring successfully applies the new pattern to a generator with multiple complex tasks. The 'setup' and 'main' tasks are now created with createGeneratorTask in a more declarative way.

This approach:

  • Makes the task structure more visible and consistent
  • Eliminates mutable state from the task creation process
  • Standardizes the pattern across different types of generators (fastify, react)
  • Makes the code easier to reason about

The task logic itself remains unchanged, maintaining compatibility while improving code quality. The consistent application across different generator types shows good engineering practice.

packages/fastify-generators/src/generators/pothos/pothos-sentry/index.ts (2)

8-8: New import for task creation utility.

Adding the createGeneratorTask import to support the new task creation pattern used in the refactored buildTasks method.


23-123: Clean refactoring from task builder to array return pattern.

The refactoring changes buildTasks from an imperative approach using a task builder to a declarative approach that returns an array of tasks. This makes the code more straightforward and aligns with functional programming principles.

Each task (main, sentry, and pothos-plugin) retains its original functionality while being created with the new createGeneratorTask utility.

packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (2)

17-17: Added import for task creation utility.

Adding the createGeneratorTask import to support the refactored task creation pattern.


84-348: Clean refactoring with elegant conditional task inclusion.

The refactoring transforms buildTasks to return an array of tasks created with createGeneratorTask instead of using a task builder. The function signature has been simplified by destructuring parameters directly.

I particularly like the elegant use of the spread operator with a conditional to include or exclude subscription-related tasks based on the enableSubscriptions flag:

...(enableSubscriptions
  ? [
      createGeneratorTask({...}),
      createGeneratorTask({...}),
    ]
  : []),

This approach is clean, idiomatic, and maintains the logical structure of the original code while improving readability.

packages/fastify-generators/src/generators/core/fastify-sentry/index.ts (2)

15-19: Added import for task creation utility.

Adding the createGeneratorTask import alongside existing imports from the same package to support the new task creation pattern.


52-296: Consistent refactoring of the buildTasks method.

This refactoring follows the same pattern as in other files, shifting from a builder approach to returning an array of tasks directly. All five tasks (fastify-instrument, server, main, prisma, and auth) retain their original functionality while being created with the new createGeneratorTask utility.

The consistent application of this pattern across multiple files improves maintainability and readability of the codebase.

packages/react-generators/src/generators/apollo/react-apollo/index.ts (2)

16-16: Added import for task creation utility.

Adding the createGeneratorTask import to support the refactored task creation pattern.


80-549: Comprehensive refactoring with parameter destructuring.

The refactoring of buildTasks in this file follows the same pattern as the others, shifting from a builder approach to returning an array of tasks directly. The function signature has been simplified by destructuring the parameters ({ devApiEndpoint, schemaLocation, enableSubscriptions }) directly rather than receiving them as a separate object.

Both tasks ('main' and 'graphql-error-context') maintain their original functionality while using the new task creation pattern. The consistency of this approach across different generators enhances the maintainability of the codebase.

packages/code-morph/src/morphers/build-task-refactor.morpher.ts (2)

7-13: Refactor definition appears well-structured.

The morpher name, description, and path patterns are clearly defined and match the PR objective of refactoring build tasks. No issues found with the configuration.


85-90: Conversion to arrow function is correct.

Replacing the method body with an arrow function that returns an array of createGeneratorTask objects fulfills the PR objective. This is a solid, concise approach.

packages/code-morph/src/morphers/tests/build-task-refactor/simple/input.ts (4)

1-5: Imports are appropriate.

The definitions for type imports (TypescriptCodeExpression, NonOverwriteableMap) are correct. No concerns regarding correctness or performance here.


31-34: Schema definition is consistent.

Providing a default port via z.number().default(7001) aligns with typical usage. No issues observed.


60-77: Old-style taskBuilder usage is expected for test input.

This file demonstrates the original approach with taskBuilder.addTask(...), serving as input for the refactor test. No changes are needed unless the test scenario expands to non-standard usage. Looks good.


139-240: Comprehensive generator logic.

The main generator tasks for configuring Fastify, registering plugins, and building final files are coherent. The usage of node.addPackages(...), configService.getConfigEntries().merge(...), and returning the providers object is consistent. No functional or security issues identified.

packages/code-morph/src/morphers/tests/build-task-refactor/simple/output.ts (5)

1-5: References updated appropriately.

The import statements add createGeneratorTask from @halfdomelabs/sync, signifying a post-refactor output. The references are correct for the new approach.


18-19: createGeneratorTask import clarifies usage.

Importing createGeneratorTask supports the refactor from taskBuilder.addTask to returning tasks as array elements. Great addition.


61-77: Build tasks now return an array of tasks.

Replacing the old pattern with an arrow function that returns [createGeneratorTask({...}), createGeneratorTask({...})] is aligned with the PR’s refactoring objective. Implementation looks solid.


199-213: Consistent plugin ordering logic.

Sorting plugins by orderPriority is maintained. No issues with performance or correctness seen here. Continues to match the original logic, ensuring no functional regressions.


215-228: Merging plugin blocks is accurate.

The approach merges plugin code blocks neatly, preserving existing code expressions. This ensures minimal overhead and a clean final output.

@kingston kingston merged commit 635fb23 into main Apr 1, 2025
8 checks passed
@kingston kingston deleted the kingston/eng-598-replace-taskbuilder-with-returning-a-list-of-tasks branch April 1, 2025 19:30
@github-actions github-actions bot mentioned this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants