-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Refactor buildTasks to return an array of tasks instead of using a task builder #476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Refactor buildTasks to return an array of tasks instead of using a task builder #476
Conversation
…using a task builder
🦋 Changeset detectedLatest commit: ed36658 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
WalkthroughThe changes introduce a new utility function— Changes
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.)
This diagram illustrates how the generator now directly creates tasks using 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 addscreateGeneratorTaskif missing. This ensures a minimal footprint on other imports. However, consider handling the edge case wherecreateGeneratormight 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 whenbuildTasksis not found.Currently, the transform simply returns if no
buildTasksmethod is found. You might consider adding a debug or warning log for files that omitbuildTasks, so users know why the automated refactor didn't apply.
63-79: Consider validating each task’s config.Extracting the first argument to
addTaskis sensible. If the argument is invalid, thenullfallback 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
📒 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 updatesThe 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 goodThe 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 packageThe imports have been updated to include
createGeneratorTaskfrom the@halfdomelabs/syncpackage, which is necessary for the refactored implementation.
31-76: LGTM: Successfully refactored buildTasks to return an array of tasksThe
buildTasksmethod has been properly refactored from using a task builder to returning an array of tasks created withcreateGeneratorTask. 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 updatedThe import statement has been properly updated to include
createGeneratorTaskfrom the@halfdomelabs/syncpackage.
34-95: LGTM: buildTasks refactored to return an array of tasksThe
buildTasksmethod has been successfully refactored to use an arrow function that returns an array containing tasks created withcreateGeneratorTask. The implementation maintains the original functionality while simplifying the code structure.packages/fastify-generators/src/generators/core/readme/index.ts (2)
2-2: Import ofcreateGeneratorTaskaligns with the task builder refactoring.The addition of the
createGeneratorTaskimport is appropriate for the new implementation pattern.
13-63: Refactor: Successfully migrated from taskBuilder to array return pattern.The refactoring changes
buildTasksfrom 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
createGeneratorTaskfunction while maintaining the existing imports.
29-125: Consistent implementation of the task builder refactoring pattern.The refactoring successfully changes
buildTasksfrom 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
createGeneratorTaskfunction 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
createGeneratorTaskhas been correctly added alongside the existingcreateGeneratorimport.
17-56: Successfully refactored to the new task creation pattern.The implementation has been properly refactored from using
taskBuilderto returning an array of tasks directly. The function signature has been updated to destructure thelabelparameter 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
createGeneratorTaskis correctly added alongside the existingcreateGeneratorimport 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
createGeneratorTaskmaintains 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
createGeneratorTaskis 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
createGeneratorTaskimport. 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 forrolesis 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
createGeneratorTaskimport. 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 thedescriptorparameter 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 createGeneratorTaskThe addition of
createGeneratorTaskimport 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 arrayThe 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 syntaxProper closing of the
createGeneratorTaskcall 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 createGeneratorTaskThe addition of
createGeneratorTaskto the imports is consistent with the refactoring pattern seen across other files.
33-34: LGTM: Refactored buildTasks to return an arraySuccessfully 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 syntaxProperly closed the
createGeneratorTaskcall and the returned array with consistent syntax.packages/core-generators/src/generators/docker/docker-compose/index.ts (3)
1-1: LGTM: Added import for createGeneratorTaskThe 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 arraySuccessfully converted from using a task builder to returning an array of tasks directly, which simplifies the code.
109-110: LGTM: Task creation closing syntaxProperly closed the
createGeneratorTaskcall 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 createGeneratorTaskThe import statement has been correctly modified to include
createGeneratorTaskalongside the existingcreateGeneratorimport.
21-22: LGTM: Refactored buildTasks to return an arraySuccessfully converted from using a task builder to returning an array of tasks directly, consistent with the refactoring pattern.
54-55: LGTM: Task creation closing syntaxProperly closed the
createGeneratorTaskcall 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
createGeneratorTaskimport 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
createGeneratorTaskto 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
createGeneratorTaskwhile 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
createGeneratorTaskwith 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 ofcreateGeneratorTaskThe import of
createGeneratorTaskis properly integrated with the existing imports from the@halfdomelabs/syncpackage, maintaining a clean and organized import structure.
33-120: Good refactoring to functional styleThe refactoring from a method that accepts a
taskBuilderparameter 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 importsThe restructuring of imports to include
createGeneratorTaskalong with other imports from@halfdomelabs/syncis clean and organized.
26-74: Consistent refactoring patternThe change to
buildTasksfollows the same pattern as seen in other files, replacing the task builder pattern with a direct array return containing a task created viacreateGeneratorTask. 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 createGeneratorTaskThe import statement is clean and correctly includes both
createGeneratorandcreateGeneratorTaskfrom the same package.
14-28: Effective parameter handling in refactored buildTasksThe refactoring of
buildTaskssuccessfully preserves the parameter handling while transitioning to the new array-returning pattern. Thefieldsparameter 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 createGeneratorTaskThe import statement properly includes the
createGeneratorTaskfunction alongside the existingcreateGeneratorimport.
14-28: Consistently implemented refactoringThis file follows the same refactoring pattern as the others, showing a methodical and consistent approach across the entire PR. The
buildTasksmethod now directly returns an array of tasks while properly handling thefieldsparameter, resulting in cleaner and more functional code.packages/react-generators/src/generators/admin/admin-layout/index.ts (2)
8-12: Appropriate import additionThe addition of
createGeneratorTaskimport aligns with the PR's objective to refactor the task creation pattern.
53-135: Clean implementation of the buildTasks refactoring patternThe 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 additionThe addition of
createGeneratorTaskimport is consistent with the PR's objective to refactor the task creation pattern.
33-102: Well-implemented multi-task refactoringThis file demonstrates the refactoring pattern applied to a generator with multiple tasks. Both tasks have been properly converted to use
createGeneratorTaskand 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 additionThe import of
createGeneratorTaskfrom '@halfdomelabs/sync' is consistent with the PR's objective.
58-120: Clean implementation of the buildTasks refactoring patternThe 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 additionThe addition of
createGeneratorTaskimport is consistent with the PR's objective to refactor task creation.
70-243: Well-implemented refactoring with preserved descriptor parameterThis implementation correctly preserves the
descriptorparameter while removing thetaskBuilderparameter, maintaining the necessary inputs for the tasks. The refactoring to usecreateGeneratorTaskfor 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 newcreateGeneratorTaskfunction.The new import for
createGeneratorTaskis 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
createGeneratorTaskimport is correctly added alongside the existing import from the same package.
152-213: Successfully refactored to functional task creation pattern.The
buildTasksmethod 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: AddedcreateGeneratorTaskto existing import group.The new import for
createGeneratorTaskfits naturally with the existing imports from the same package.
38-80: Clean implementation of the new task creation pattern.The refactoring of
buildTasksto 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
createGeneratorTaskimport, improving readability.
32-96: Successfully standardized task creation pattern.The refactoring of
buildTasksto 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 arrayThe 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 refactoringThe change from using a task builder to returning an array of tasks created with
createGeneratorTaskis 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 objectiveThe code now uses the same task creation pattern as the other refactored files, making the codebase more consistent. The
createGeneratorTaskfunction 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 refactoringThe 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 processThis change effectively transforms the
buildTasksmethod from using a task builder pattern to a more functional approach. The refactoring:
- Imports the new
createGeneratorTaskutility- 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 tasksGood implementation of the new pattern with multiple tasks. The change:
- Updates imports to include
createGeneratorTask- Refactors
buildTasksto 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 patternThe refactoring here successfully adapts the complex admin-crud-list generator to the new pattern:
- Adds the
createGeneratorTaskimport- Transforms
buildTasksto 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 generatorThis refactoring is clean and straightforward:
- Adds the appropriate import for
createGeneratorTask- Converts
buildTasksto the new arrow function syntax returning an array- Wraps the existing task in
createGeneratorTaskwhile maintaining all functionalityThe 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/syncThe 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 tasksThe method has been converted from a function receiving a
taskBuilderparameter to an arrow function that returns an array containing a task created viacreateGeneratorTask. 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/syncThe 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 tasksThe method has been converted from a function receiving a
taskBuilderparameter to an arrow function that returns an array containing a task created viacreateGeneratorTask. The function now directly destructuresfileNameandcategoryOrderfrom its parameter instead of having them passed separately from thetaskBuilder.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 importsThe import statement has been updated to include
createGeneratorTaskalongside the existing import ofcreateGenerator.
18-54: Successfully refactored buildTasks to return an array of tasksThe method has been converted from a function receiving a
taskBuilderparameter to an arrow function that returns an array containing a task created viacreateGeneratorTask. The function now directly destructuresenumNamefrom its parameter instead of having it passed separately from thetaskBuilder.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/syncThe 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 tasksThe method has been converted from a function receiving a
taskBuilderparameter to an arrow function that returns an array containing a task created viacreateGeneratorTask.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
createGeneratorTaskimport is necessary for the refactored implementation ofbuildTasks.
26-43: LGTM: Clean refactor of buildTasks method.The transformation of
buildTasksfrom a method accepting a task builder to an arrow function returning an array of tasks created withcreateGeneratorTaskis 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
createGeneratorTaskfunction while maintaining the other necessary imports.
35-132: Well-executed refactor of the buildTasks method.The
buildTasksmethod has been correctly refactored to receive parameters directly (without taskBuilder) and return an array containing a task created withcreateGeneratorTask. 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
createGeneratorTaskfunction alongside the other necessary imports.
22-37: Consistent refactoring of buildTasks method.The
buildTasksmethod has been cleanly converted to an arrow function that returns an array containing a task created withcreateGeneratorTask. 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
createGeneratorandcreateGeneratorTaskfrom the same package.
29-60: Successfully refactored buildTasks to follow the new pattern.The
buildTasksmethod has been properly refactored to directly accept the required parameters and return an array containing a task created withcreateGeneratorTask. 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 createGeneratorTaskThe import is correctly updated to include
createGeneratorTaskfor the new task creation pattern.
23-24: Well-structured refactor of buildTasks methodThe method signature has been appropriately changed from taking a
taskBuilderparameter to returning an array of tasks directly, which aligns with the PR objective of refactoring task creation.
85-86: Correctly closing task definitionThe closing brackets and array syntax are properly structured.
packages/react-generators/src/generators/admin/admin-home/index.ts (3)
7-11: Import statements properly organizedThe imports now include
createGeneratorTaskwhich is correctly grouped with other related functions from@halfdomelabs/sync.
31-32: Consistent refactoring of buildTasks methodThe 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 closedThe 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 updatedThe import statement has been properly modified to include
createGeneratorTaskfrom@halfdomelabs/sync.
44-45: Method signature appropriately simplifiedThe
buildTasksmethod has been refactored to only accept the destructuredrequireOnRootFieldsparameter without the taskBuilder, which aligns with the new pattern while preserving functionality.
97-98: First task appropriately closedThe closing syntax for the first task is correct with proper formatting.
98-117: Second task correctly convertedThe second task 'auth-formatter' has been properly converted to use
createGeneratorTaskwhile maintaining its functionality.packages/fastify-generators/src/generators/auth/user-session-types/index.ts (3)
8-12: Import statement properly updatedThe imports now correctly include
createGeneratorTaskfrom@halfdomelabs/sync, grouped with related functions.
30-31: buildTasks method consistently refactoredThe 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 closedThe 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
createGeneratorTaskimport 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
createGeneratorTaskimport 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
createGeneratorTaskwhich 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
createGeneratorTaskimport 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: AddedcreateGeneratorTaskimport from sync package.The import of
createGeneratorTaskfunction supports the refactoring of task creation in the generator.
38-39: RefactoredbuildTasksto 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 usecreateGeneratorTask.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: AddedcreateGeneratorTaskimport from sync package.The import statement has been updated to include the
createGeneratorTaskfunction needed for the refactored buildTasks method.
24-25: RefactoredbuildTasksto 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 withcreateGeneratorTask.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 includecreateGeneratorTask.The import statements have been reorganized to include
createGeneratorTaskwhile maintaining a clean multi-line import structure.
33-34: RefactoredbuildTasksto 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: AddedcreateGeneratorTaskimport from sync package.The import was added to support the refactored task creation approach.
42-44: RefactoredbuildTasksto 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
createGeneratorTaskaligns with the PR's objective to refactor the task creation pattern.
19-58: Clean refactoring of buildTasks method.The change from using a mutable
taskBuilderparameter to returning an array of tasks directly is a good improvement that:
- Makes the code more declarative and functional
- Reduces the need to track the state of a mutable object
- 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
createGeneratorTaskfrom@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
createGeneratorTaskwhich 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
descriptorparameter 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
createGeneratorTaskfrom@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
createGeneratorTaskalongside the existingcreateGenerator, 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
createGeneratorTaskfrom 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:
- Uses parameter destructuring directly in the function signature
- Returns an array of tasks created with
createGeneratorTask- 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
createGeneratorTaskfrom 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:
- Switching from a function with a
taskBuilderparameter to an arrow function returning an array- Using destructuring in the
runmethod's parameters- Using
{ taskId }as the second parameter instead of accessingtaskBuilder.generatorNameThe 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
createGeneratorTaskfrom 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
createGeneratorTaskinstead of using a task builder pattern. This change:
- Makes the code more declarative
- Maintains the same task functionality
- 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
createGeneratorTaskfrom '@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
createGeneratorTaskfrom '@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:
- Changed the method signature to remove the taskBuilder parameter
- Converted to an arrow function that returns an array of tasks
- Used createGeneratorTask consistently for both tasks
- 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
createGeneratorTaskin 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
createGeneratorTaskfrom '@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: AddedcreateGeneratorTaskimport to support the refactoring.Good addition of the
createGeneratorTaskimport to support the new task creation pattern.
58-136: Clean refactoring to functional style.The refactoring from a method with
taskBuilderparameter 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 includecreateGeneratorTask.Good restructuring of imports to add
createGeneratorTaskwhile 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
createGeneratorTaskmaintains the same functionality while improving code structure.packages/react-generators/src/generators/auth/auth-login-page/index.ts (2)
11-12: AddedcreateGeneratorTaskimport 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
allowedRolesparameter while transitioning to the array return pattern.packages/fastify-generators/src/generators/prisma/prisma/index.ts (2)
16-17: AddedcreateGeneratorTaskimport 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 patternThe import statement has been updated to include
createGeneratorTaskfrom@halfdomelabs/sync, which is needed for the new task creation pattern.
54-55: Refactored buildTasks to return an array of tasksThe
buildTasksmethod has been refactored from accepting a taskBuilder and usingtaskBuilder.addTask()to directly returning an array of tasks created withcreateGeneratorTask(). 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 createGeneratorTaskThe import statement has been properly updated to include
createGeneratorTaskfrom@halfdomelabs/sync.
31-32: Refactored buildTasks to return an arrayThe
buildTasksmethod has been refactored to return an array of tasks directly using thecreateGeneratorTask()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 createGeneratorTaskImport statement has been properly updated to include
createGeneratorTaskalong withcreateGeneratorfrom@halfdomelabs/sync.
15-16: Refactored buildTasks to directly return tasks arrayThe
buildTasksmethod has been successfully refactored to return an array of tasks created withcreateGeneratorTask(), 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 importThe import statement has been properly updated to include
createGeneratorTaskfrom@halfdomelabs/sync.
40-41: Refactored buildTasks to return an arrayThe
buildTasksmethod has been successfully refactored to return an array containing a task created withcreateGeneratorTask(). 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 functionThe addition of the
createGeneratorTaskimport aligns with the refactoring goal to return an array of tasks directly.
29-70: Good refactoring to array-based task patternThe 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 createGeneratorTaskThe import statement has been properly modified to include the createGeneratorTask function.
20-103: Well-structured refactoring with multiple tasksGood 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 createGeneratorTaskThe import has been properly updated to include the createGeneratorTask function.
17-95: Task refactoring looks goodThe 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 createGeneratorTaskThe imports have been properly reorganized to include the createGeneratorTask function.
43-228: Good implementation of parameter handling with new patternExcellent 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
createGeneratorTaskfrom@halfdomelabs/sync, which is necessary for the new implementation ofbuildTasks.
33-100: Clean refactor of buildTasks method.The method has been refactored from accepting a
taskBuilderparameter to returning an array of tasks created withcreateGeneratorTask. 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
createGeneratorTaskwhich is needed for the new implementation ofbuildTasks.
112-147: Clean refactor of buildTasks method.The method has been refactored from accepting a
taskBuilderparameter to returning an array of tasks. The implementation now directly creates a task usingcreateGeneratorTaskand properly preserves thedescriptorparameter 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
createGeneratorTaskwhich is required for the new implementation ofbuildTasks.
40-177: Clean refactor of buildTasks method.The method has been refactored from accepting a
taskBuilderparameter to an arrow function that returns an array of tasks. The implementation now directly destructuresuserQueryNamefrom its parameters and usescreateGeneratorTaskto 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
createGeneratorTaskwhich is required for the new implementation ofbuildTasks.
78-378: Clean comprehensive refactor of buildTasks method.The method has been refactored from accepting a
taskBuilderparameter 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 withcreateGeneratorTaskand 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
createGeneratorTaskimport 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
createGeneratorTaskimport 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
createGeneratorTaskfollows 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
taskIdfrom the second parameter object instead of usinggeneratorName.
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
createGeneratorTaskis properly added to support the refactored implementation.
18-19: Parameter handling improved in the refactored buildTasks.The buildTasks method now directly destructures
labelandmodelFieldin 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 importThis 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 creationThe change from using a taskBuilder parameter to directly returning an array of tasks created with
createGeneratorTaskis 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 importThis 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 tasksThe 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
createGeneratorTaskin 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 createGeneratorTaskThe imports have been well-organized and the required
createGeneratorTaskfunction is now imported, keeping with the standardized approach for this PR.
33-81: Excellent refactoring with improved parameter handlingThis refactoring shows a particularly good improvement by:
- Changing from a function with a taskBuilder parameter to an arrow function returning an array of tasks
- 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 importThis 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 tasksThis refactoring successfully applies the new pattern to a generator with multiple complex tasks. The 'setup' and 'main' tasks are now created with
createGeneratorTaskin 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
createGeneratorTaskimport to support the new task creation pattern used in the refactoredbuildTasksmethod.
23-123: Clean refactoring from task builder to array return pattern.The refactoring changes
buildTasksfrom 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
createGeneratorTaskutility.packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (2)
17-17: Added import for task creation utility.Adding the
createGeneratorTaskimport to support the refactored task creation pattern.
84-348: Clean refactoring with elegant conditional task inclusion.The refactoring transforms
buildTasksto return an array of tasks created withcreateGeneratorTaskinstead 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
enableSubscriptionsflag:...(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
createGeneratorTaskimport 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
createGeneratorTaskutility.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
createGeneratorTaskimport to support the refactored task creation pattern.
80-549: Comprehensive refactoring with parameter destructuring.The refactoring of
buildTasksin 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
createGeneratorTaskobjects 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-styletaskBuilderusage 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
createGeneratorTaskfrom@halfdomelabs/sync, signifying a post-refactor output. The references are correct for the new approach.
18-19:createGeneratorTaskimport clarifies usage.Importing
createGeneratorTasksupports the refactor fromtaskBuilder.addTaskto 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
orderPriorityis 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.
Summary by CodeRabbit
These changes enhance internal workflows and code quality while maintaining the same end-user functionality.