Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Apr 6, 2025

  • Also refatored Node generator and adding testing to make it more ergonomic

Summary by CodeRabbit

  • New Features

    • Enhanced configuration tasks now automatically extract and manage dependency versions for project generators.
    • Introduced new tasks for managing Node.js package dependencies across various generators.
  • Refactor

    • Streamlined package management and script merging across backend and frontend generator workflows.
    • Reorganized export structures and configuration providers to boost maintainability and type safety.
    • Transitioned from direct package manipulation to a task-based approach for managing dependencies.
  • Tests

    • Expanded unit test coverage to ensure robust functionality of generator tasks and configuration workflows.

- Also refatored Node generator and adding testing to make it more ergonomic
@linear
Copy link

linear bot commented Apr 6, 2025

ENG-604 Create a testing framework for Baseplate generators

Right now we don't have a good system for unit/integration testing Baseplate generators meaning we have to run it before we can test it. We should help create a testing harness to allow easier testing of Baseplate generators.

@changeset-bot
Copy link

changeset-bot bot commented Apr 6, 2025

🦋 Changeset detected

Latest commit: 570a282

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

This PR includes changesets to release 13 packages
Name Type
@halfdomelabs/baseplate-plugin-storage Patch
@halfdomelabs/fastify-generators Patch
@halfdomelabs/react-generators Patch
@halfdomelabs/core-generators Patch
@halfdomelabs/utils Patch
@halfdomelabs/sync Patch
@halfdomelabs/project-builder-common Patch
@halfdomelabs/project-builder-server Patch
@halfdomelabs/create-project Patch
@halfdomelabs/project-builder-cli Patch
@halfdomelabs/project-builder-lib Patch
@halfdomelabs/project-builder-test 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 6, 2025

Walkthrough

The changes span multiple packages and generators. They introduce new documentation files and refactor a variety of generator methods to remove direct manipulation of a node provider. In their place, new task-based functions (e.g., createNodePackagesTask, extractPackageVersions, createNodeTask) are used for dependency and script management. Several configuration tasks now use the updated provider functions (e.g., createConfigProviderTask) and update their method signatures by removing the node parameter. In addition, obsolete modules and exports have been removed, and new utility and test files have been added.

Changes

File(s) Change Summary
.changeset/* New markdown files documenting patch updates and generator refactors for packages such as @halfdomelabs/baseplate-plugin-storage, fastify, react, and core generators.
packages/core-generators/* Removed the "sort-keys" dependency; added new constants in node.ts; updated import/export paths (e.g., using node.generator.js); removed deprecated generator files; introduced new generator file (node.generator.ts), dependency container classes, and corresponding unit tests; updated builder methods (e.g., in prettier, typescript, eslint, and vitest generators).
packages/fastify-generators/* Replaced direct use of nodeProvider in favor of task-based dependency management with createNodePackagesTask and extractPackageVersions; updated method signatures to remove the node parameter; reworked tasks for auth, bull, config, fastify core services, auth0, logger, and others; refactored setup tasks (e.g., setup-fastify-typescriptfastifyTypescriptTask).
packages/react-generators/* Reduced direct node manipulation by adding tasks (using createNodePackagesTask and extractPackageVersions); updated generator run methods for admin components, apollo, auth, auth0, core components (react-config, react-datadog, error-boundary, logger, router, sentry, tailwind, typescript) to simplify signatures and delegate package management; added new React package constants.
packages/sync/* Removed legacy exports and files (e.g., write-json-action); introduced new types (e.g., AnyGeneratorTask) and updated the GeneratorBundle interface; adjusted task structure from arrays to objects; added support for an optional env property in command execution; re-exported test-runner modules and added new utility files for configuration provider tasks and generator creation.
packages/utils/src/field-map/field-map.ts Refactored the FieldContainer hierarchy by replacing an abstract class with a simple interface; updated getter method names from value to getValue() and adjusted constructor parameters for consistency.
plugins/baseplate-plugin-storage/* Updated generators for fastify storage modules and React upload components to use the new task-based dependency management functions, removing obsolete nodeProvider logic.

Sequence Diagram(s)

sequenceDiagram
  participant GT as Generator Task
  participant NPTask as createNodePackagesTask
  participant EPS as extractPackageVersions
  participant NC as Node Config/Script Manager

  GT->>NPTask: Invoke dependency management task
  NPTask->>EPS: Request package versions for dependencies
  EPS-->>NPTask: Return extracted version info
  NPTask->>NC: Pass dependency info for merging scripts/packages
  NC-->>GT: Updated configuration for generator task
Loading

This diagram illustrates the new task flow where a generator task delegates package version extraction and merging to dedicated functions, streamlining the dependency management process.


🪧 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: 1

🧹 Nitpick comments (12)
packages/sync/src/utils/exec.ts (1)

17-25: Well-implemented environment variables handling

The implementation properly merges filtered process environment variables with user-provided ones, ensuring user variables take precedence.

Minor suggestion regarding type safety: Consider handling potential undefined values from process.env[key] in the mapping function.

-          .map((key) => [key, process.env[key]]),
+          .map((key) => [key, process.env[key] ?? '']),
packages/sync/src/generators/build-generator-entry.ts (1)

113-113: Type safety consideration with explicit casting

The explicit cast to GeneratorTask might indicate a potential type inference issue. While the casting works, consider whether a stronger type definition for the tasks object structure could eliminate the need for this explicit cast.

packages/core-generators/src/utils/extract-packages.ts (1)

7-14: Consider adding validation for non-existent keys

The current implementation silently ignores keys that don't exist in the packages record. While this might be the intended behavior, consider either:

  1. Adding a comment to document this behavior explicitly
  2. Adding validation that throws an error when non-existent keys are requested
  3. Adding a parameter to control this behavior

This would make the function more robust and self-documenting.

 export function extractPackageVersions<T extends Record<string, string>>(
   packages: T,
   keys: (keyof T)[],
+  // Note: Keys that don't exist in packages will be silently ignored
 ): Record<keyof T, string> {
   return Object.fromEntries(
     Object.entries(packages).filter(([key]) => keys.includes(key)),
   ) as Record<keyof T, string>;
 }
packages/sync/src/utils/create-config-provider-task-with-info.ts (3)

18-47: Provide additional clarity on naming conventions.
The prefix and taskName fields are useful for preventing naming collisions. However, consider clearly documenting or enforcing constraints (e.g., character restrictions, uniqueness checks) so that generated provider names don’t accidentally conflict with other similarly prefixed providers.


108-114: Validate provider naming strategy.
When creating provider names like ${prefix}-${taskName}-config and ${prefix}-${taskName}-config-values, ensure that there are no conflicts within the broader codebase. This is especially relevant in large generators that might re-use the same prefix or taskName.


115-137: Potential overhead of combining config and info objects.
In line 127–129, the config containers and the “info” object are spread together. For large descriptors, this may result in performance overhead or overshadowing logic if repeated multiple times. Consider returning them as distinct properties (e.g., { config, info }) to keep them logically separated, unless merging is explicitly desired.

packages/sync/src/utils/create-generator.ts (2)

58-58: Clarify return type for buildTasks.
buildTasks returning either an array of tasks or a record can lead to dynamic branching logic. For maintainability, ensure that consumers are aware of this dual interface. Adding JSDoc examples of both usage patterns could help.


108-113: Encourage thorough testing around descriptor usage.
Since createGenerator validates the descriptor using zod, ensure that any downstream references to typed descriptor properties are also thoroughly tested, especially if the descriptor schema is large or complex.

packages/utils/src/field-map/field-map.ts (1)

43-70: Consider exposing a “set by source” get method.
ArrayContainer tracks duplicates and their sources internally. If debugging or auditing is needed, exposing a read-only method or property for _stripDuplicates or origin sources could add transparency at runtime.

packages/core-generators/src/generators/node/node/package-dependencies-container.ts (3)

36-57: Error message could be more informative for version conflicts.

When incompatible versions are detected, the error message only includes the existing version, not the new version that caused the conflict. This makes debugging more difficult.

throw new Error(
-  `Could not merge incompatible versions for dependency "${name}": existing "${oldVersion}"`,
+  `Could not merge incompatible versions for dependency "${name}": existing "${oldVersion}" vs new "${version}"`,
);

98-102: Documentation includes parameter that doesn't exist in method signature.

The JSDoc for addPackages mentions a type parameter, but this parameter is not part of the method signature. The method instead takes dependencies of both types through the packages parameter.

/**
 * Add multiple dependencies to the container
 * @param packages - The dependencies to add
- * @param type - The type of the dependencies (dev or prod)
 */

1-134: Consider adding version string validation.

There's currently no validation to ensure that the version strings passed to the add method are valid semver strings before attempting to use them with the semver library. This could lead to runtime errors if invalid version strings are provided.

You could add validation by checking if the version strings are valid before performing comparisons:

add(name: string, version: string, type: NodePackageDependencyType): void {
+  if (!semver.valid(semver.coerce(version)) && !semver.validRange(version)) {
+    throw new Error(`Invalid version format for dependency "${name}": "${version}"`);
+  }
  const existingEntry = this._value.get(name);

  if (existingEntry) {
    const oldVersion = existingEntry.version;
+    if (!semver.valid(semver.coerce(oldVersion)) && !semver.validRange(oldVersion)) {
+      throw new Error(`Invalid existing version format for dependency "${name}": "${oldVersion}"`);
+    }
    // ...rest of the method
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 014b140 and 14a7e39.

📒 Files selected for processing (89)
  • .changeset/hot-trees-take.md (1 hunks)
  • .changeset/shaky-spoons-add.md (1 hunks)
  • packages/core-generators/package.json (0 hunks)
  • packages/core-generators/src/constants/node.ts (1 hunks)
  • packages/core-generators/src/generators/node/_composers/node.ts (1 hunks)
  • packages/core-generators/src/generators/node/eslint/index.ts (4 hunks)
  • packages/core-generators/src/generators/node/index.ts (1 hunks)
  • packages/core-generators/src/generators/node/node/index.ts (0 hunks)
  • packages/core-generators/src/generators/node/node/node.generator.ts (1 hunks)
  • packages/core-generators/src/generators/node/node/node.generator.unit.test.ts (1 hunks)
  • packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1 hunks)
  • packages/core-generators/src/generators/node/node/package-dependencies-container.unit.test.ts (1 hunks)
  • packages/core-generators/src/generators/node/prettier/index.ts (4 hunks)
  • packages/core-generators/src/generators/node/typescript/index.ts (6 hunks)
  • packages/core-generators/src/generators/node/vitest/index.ts (3 hunks)
  • packages/core-generators/src/index.ts (1 hunks)
  • packages/core-generators/src/providers/project.ts (1 hunks)
  • packages/core-generators/src/utils/extract-packages.ts (1 hunks)
  • packages/core-generators/src/utils/index.ts (1 hunks)
  • packages/core-generators/src/writers/index.ts (1 hunks)
  • packages/core-generators/src/writers/json.ts (1 hunks)
  • packages/fastify-generators/src/constants/fastify-packages.ts (3 hunks)
  • packages/fastify-generators/src/generators/auth/auth-plugin/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/auth/auth/index.ts (1 hunks)
  • packages/fastify-generators/src/generators/auth/password-hasher-service/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/auth0/auth0-module/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/bull/bull-mq/index.ts (5 hunks)
  • packages/fastify-generators/src/generators/bull/fastify-bull-board/index.ts (4 hunks)
  • packages/fastify-generators/src/generators/core/axios/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/core/config-service/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/core/fastify-cookie-context/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/core/fastify-redis/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify-scripts/index.ts (1 hunks)
  • packages/fastify-generators/src/generators/core/fastify-sentry/index.ts (5 hunks)
  • packages/fastify-generators/src/generators/core/fastify-server/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/core/fastify/index.ts (5 hunks)
  • packages/fastify-generators/src/generators/core/fastify/setup-fastify-typescript.ts (1 hunks)
  • packages/fastify-generators/src/generators/core/logger-service/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/core/request-context/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/core/root-module/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/email/fastify-postmark/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/email/fastify-sendgrid/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-scalar/index.ts (1 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos-sentry/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/pothos/pothos/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/prisma/prisma/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/stripe/fastify-stripe/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/vitest/fastify-vitest/index.ts (2 hunks)
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/index.ts (3 hunks)
  • packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (4 hunks)
  • packages/react-generators/src/constants/react-packages.ts (1 hunks)
  • packages/react-generators/src/generators/admin/admin-components/index.ts (2 hunks)
  • packages/react-generators/src/generators/apollo/react-apollo/index.ts (3 hunks)
  • packages/react-generators/src/generators/auth/auth-hooks/index.ts (2 hunks)
  • packages/react-generators/src/generators/auth0/react-auth0/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-components/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-config/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-datadog/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-error-boundary/index.ts (3 hunks)
  • packages/react-generators/src/generators/core/react-logger/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-router/index.ts (3 hunks)
  • packages/react-generators/src/generators/core/react-sentry/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-tailwind/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react-typescript/index.ts (2 hunks)
  • packages/react-generators/src/generators/core/react/index.ts (3 hunks)
  • packages/react-generators/src/generators/core/react/node.ts (1 hunks)
  • packages/sync/src/actions/index.ts (0 hunks)
  • packages/sync/src/actions/write-json-action.ts (0 hunks)
  • packages/sync/src/generators/build-generator-entry.ts (1 hunks)
  • packages/sync/src/generators/build-generator-entry.unit.test.ts (6 hunks)
  • packages/sync/src/generators/generators.ts (3 hunks)
  • packages/sync/src/index.ts (1 hunks)
  • packages/sync/src/output/post-write-commands/run-commands.ts (1 hunks)
  • packages/sync/src/output/post-write-commands/types.ts (1 hunks)
  • packages/sync/src/runner/tests/factories.test-helper.ts (1 hunks)
  • packages/sync/src/test-runners/index.ts (1 hunks)
  • packages/sync/src/test-runners/test-runner.ts (1 hunks)
  • packages/sync/src/utils/create-config-provider-task-with-info.ts (1 hunks)
  • packages/sync/src/utils/create-config-provider-task.ts (1 hunks)
  • packages/sync/src/utils/create-generator.ts (5 hunks)
  • packages/sync/src/utils/create-generator.unit.test.ts (2 hunks)
  • packages/sync/src/utils/create-setup-task-with-info.ts (0 hunks)
  • packages/sync/src/utils/create-setup-task.ts (0 hunks)
  • packages/sync/src/utils/exec.ts (2 hunks)
  • packages/sync/src/utils/index.ts (1 hunks)
  • packages/utils/src/field-map/field-map.ts (8 hunks)
  • plugins/baseplate-plugin-storage/src/generators/fastify/storage-module/index.ts (2 hunks)
  • plugins/baseplate-plugin-storage/src/generators/react/upload-components/index.ts (3 hunks)
💤 Files with no reviewable changes (6)
  • packages/sync/src/actions/index.ts
  • packages/core-generators/package.json
  • packages/sync/src/actions/write-json-action.ts
  • packages/sync/src/utils/create-setup-task.ts
  • packages/core-generators/src/generators/node/node/index.ts
  • packages/sync/src/utils/create-setup-task-with-info.ts
🧰 Additional context used
🧬 Code Definitions (53)
packages/core-generators/src/generators/node/node/package-dependencies-container.unit.test.ts (1)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1)
  • NodePackageDependenciesContainer (21-128)
packages/react-generators/src/generators/core/react-typescript/index.ts (1)
packages/core-generators/src/writers/json.ts (1)
  • writeJsonToBuilder (25-42)
packages/sync/src/generators/build-generator-entry.ts (1)
packages/sync/src/generators/generators.ts (1)
  • GeneratorTask (132-185)
packages/fastify-generators/src/generators/email/fastify-postmark/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/core/react-tailwind/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/react-generators/src/generators/core/react-logger/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/vitest/fastify-vitest/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodeTask (76-86)
packages/sync/src/generators/generators.ts (1)
  • createGeneratorTask (193-201)
packages/core-generators/src/generators/node/vitest/index.ts (1)
  • vitestProvider (36-36)
packages/react-generators/src/generators/core/react-config/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
plugins/baseplate-plugin-storage/src/generators/react/upload-components/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/constants/core-packages.ts (1)
  • CORE_PACKAGES (1-27)
plugins/baseplate-plugin-storage/src/constants/storage-packages.ts (1)
  • STORAGE_PACKAGES (1-10)
packages/react-generators/src/generators/core/react-sentry/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/vitest/prisma-vitest/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/prisma/prisma/index.ts (6)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • nodeProvider (69-69)
packages/fastify-generators/src/generators/core/fastify/index.ts (1)
  • fastifyOutputProvider (63-64)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/generators/core/config-service/index.ts (1)
  • configServiceProvider (47-48)
packages/fastify-generators/src/generators/core/fastify-health-check/index.ts (1)
  • fastifyHealthCheckProvider (24-25)
packages/core-generators/src/generators/node/typescript/index.ts (1)
  • typescriptProvider (113-114)
packages/react-generators/src/generators/core/react-datadog/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/core/fastify-server/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/auth/password-hasher-service/index.ts (4)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/core/root-module/index.ts (1)
  • appModuleProvider (65-66)
packages/fastify-generators/src/generators/bull/bull-mq/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/core/logger-service/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/auth/auth-hooks/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/sync/src/generators/build-generator-entry.unit.test.ts (1)
packages/sync/src/generators/generators.ts (1)
  • GeneratorBundle (213-248)
packages/react-generators/src/generators/core/react-error-boundary/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
plugins/baseplate-plugin-storage/src/generators/fastify/storage-module/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
plugins/baseplate-plugin-storage/src/constants/storage-packages.ts (1)
  • STORAGE_PACKAGES (1-10)
packages/fastify-generators/src/generators/core/config-service/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/core-generators/src/generators/node/node/node.generator.unit.test.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • nodeGenerator (114-188)
packages/sync/src/test-runners/test-runner.ts (1)
  • createTaskTestRunner (47-107)
packages/core-generators/src/constants/node.ts (2)
  • NODE_VERSION (1-1)
  • PNPM_VERSION (2-2)
packages/core-generators/src/generators/node/vitest/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/core-generators/src/constants/core-packages.ts (1)
  • CORE_PACKAGES (1-27)
packages/fastify-generators/src/generators/core/fastify-redis/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/pothos/pothos-prisma/index.ts (5)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/pothos/pothos/index.ts (1)
  • pothosSetupProvider (51-52)
packages/fastify-generators/src/generators/prisma/prisma/index.ts (1)
  • prismaOutputProvider (66-67)
packages/fastify-generators/src/generators/core/fastify-cookie-context/index.ts (4)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/core/fastify-server/index.ts (1)
  • fastifyServerProvider (53-54)
packages/fastify-generators/src/generators/yoga/yoga-plugin/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/bull/fastify-bull-board/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/core/fastify-sentry/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/core/react-components/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/email/fastify-sendgrid/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/sync/src/test-runners/test-runner.ts (3)
packages/sync/src/generators/generators.ts (6)
  • ProviderExportMap (33-35)
  • InferExportProviderMap (47-51)
  • ProviderDependencyMap (40-42)
  • InferDependencyProviderMap (56-60)
  • GeneratorTask (132-185)
  • GeneratorTaskResult (102-116)
packages/sync/src/output/post-write-commands/types.ts (1)
  • PostWriteCommand (52-61)
packages/sync/src/generators/build-generator-entry.ts (1)
  • GeneratorInfo (9-22)
packages/fastify-generators/src/generators/core/root-module/index.ts (1)
packages/sync/src/utils/create-config-provider-task.ts (1)
  • createConfigProviderTask (88-122)
packages/core-generators/src/generators/node/prettier/index.ts (2)
packages/core-generators/src/constants/core-packages.ts (1)
  • CORE_PACKAGES (1-27)
packages/core-generators/src/writers/json.ts (1)
  • writeJsonToBuilder (25-42)
packages/sync/src/utils/create-config-provider-task.ts (2)
packages/utils/src/field-map/field-map.ts (5)
  • FieldMapSchema (163-163)
  • FieldMap (171-173)
  • FieldMapValues (166-168)
  • FieldMapSchemaBuilder (176-223)
  • createFieldMap (238-257)
packages/sync/src/generators/generators.ts (2)
  • GeneratorTask (132-185)
  • createGeneratorTask (193-201)
packages/fastify-generators/src/generators/auth/auth/index.ts (1)
packages/sync/src/utils/create-config-provider-task.ts (1)
  • createConfigProviderTask (88-122)
packages/sync/src/utils/create-config-provider-task-with-info.ts (2)
packages/utils/src/field-map/field-map.ts (4)
  • FieldMapSchema (163-163)
  • FieldMapValues (166-168)
  • FieldMapSchemaBuilder (176-223)
  • createFieldMap (238-257)
packages/sync/src/generators/generators.ts (2)
  • GeneratorTask (132-185)
  • createGeneratorTask (193-201)
packages/react-generators/src/generators/core/react-router/index.ts (2)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/core-generators/src/generators/node/node/node.generator.ts (7)
packages/core-generators/src/constants/node.ts (2)
  • NODE_VERSION (1-1)
  • PNPM_VERSION (2-2)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1)
  • NodePackageDependencies (13-16)
packages/sync/src/generators/generators.ts (3)
  • TaskRunContext (121-126)
  • AnyGeneratorTask (191-191)
  • createGeneratorTask (193-201)
packages/sync/src/utils/create-config-provider-task.ts (1)
  • createConfigProviderTask (88-122)
packages/sync/src/utils/create-generator.ts (1)
  • createGenerator (108-152)
packages/core-generators/src/providers/project.ts (1)
  • projectProvider (7-8)
packages/sync/src/output/post-write-commands/types.ts (1)
  • POST_WRITE_COMMAND_PRIORITY (6-19)
packages/fastify-generators/src/generators/core/fastify/setup-fastify-typescript.ts (2)
packages/sync/src/generators/generators.ts (2)
  • createGeneratorTask (193-201)
  • AnyGeneratorTask (191-191)
packages/core-generators/src/generators/node/typescript/index.ts (1)
  • typescriptSetupProvider (174-174)
packages/fastify-generators/src/generators/pothos/pothos/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (2)
  • createNodePackagesTask (93-104)
  • nodeProvider (69-69)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/admin/admin-components/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/stripe/fastify-stripe/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/apollo/react-apollo/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (2)
  • createNodePackagesTask (93-104)
  • createNodeTask (76-86)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/fastify-generators/src/generators/auth/auth-plugin/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/pothos/pothos-sentry/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/fastify-generators/src/generators/core/axios/index.ts (5)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/core-generators/src/constants/core-packages.ts (1)
  • CORE_PACKAGES (1-27)
packages/fastify-generators/src/generators/core/error-handler-service/index.ts (1)
  • errorHandlerServiceSetupProvider (45-48)
packages/core-generators/src/generators/node/typescript/index.ts (1)
  • typescriptProvider (113-114)
packages/fastify-generators/src/generators/auth0/auth0-module/index.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodePackagesTask (93-104)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
packages/react-generators/src/generators/core/react/node.ts (3)
packages/core-generators/src/generators/node/node/node.generator.ts (1)
  • createNodeTask (76-86)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/react-generators/src/constants/react-packages.ts (1)
  • REACT_PACKAGES (1-64)
packages/sync/src/utils/create-generator.ts (1)
packages/sync/src/generators/generators.ts (2)
  • AnyGeneratorTask (191-191)
  • GeneratorBundle (213-248)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1)
packages/utils/src/field-map/field-map.ts (1)
  • FieldContainer (4-6)
packages/fastify-generators/src/generators/core/fastify/index.ts (4)
packages/core-generators/src/generators/node/node/node.generator.ts (2)
  • nodeConfigProvider (112-112)
  • createNodeTask (76-86)
packages/fastify-generators/src/generators/core/fastify/setup-fastify-typescript.ts (1)
  • fastifyTypescriptTask (6-36)
packages/core-generators/src/utils/extract-packages.ts (1)
  • extractPackageVersions (7-14)
packages/fastify-generators/src/constants/fastify-packages.ts (1)
  • FASTIFY_PACKAGES (1-95)
🔇 Additional comments (252)
packages/core-generators/src/utils/index.ts (1)

1-3: LGTM - Good barrel file pattern

This is a clean implementation of a barrel file pattern that consolidates exports from multiple utility modules. This approach makes imports cleaner in consumer code and centralizes utility exports in a single location.

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

6-6: Approval: Good consolidation of utility exports

The change simplifies the export structure by importing from the new consolidated utils index file, making the codebase more maintainable. This approach is consistent with the module organization pattern used throughout the codebase.

packages/fastify-generators/src/constants/fastify-packages.ts (3)

69-71: LGTM - Added Pothos tracing plugins for Sentry integration

These additions align well with the Sentry packages already in the codebase, providing tracing capabilities for Pothos GraphQL.


82-82: LGTM - Added Auth0 verification package

This addition complements the existing Auth0 package and enhances authentication capabilities.


92-94: LGTM - Added BullMQ for job queue management

Good addition of BullMQ which works with the existing Bull Board packages and enables better job queue management.

packages/sync/src/utils/create-generator.unit.test.ts (2)

93-93: Consistent with earlier task structure change

This change aligns with the other task structure modifications in this file, ensuring consistency across the test.


41-45:

Details

❓ Verification inconclusive

Approval: Data structure refactoring from array to object

Changing the tasks structure from an array to an object with task names as keys improves lookup performance and better supports the unit testing improvements mentioned in the PR objectives.


🏁 Script executed:

#!/bin/bash
# Check for any other instances of the old tasks array structure that might have been missed in the refactoring
rg -A 2 -B 2 "tasks: \[" --type ts

Length of output: 8438


Action Required: Verify Consistency of Tasks Data Structure

The refactoring in packages/sync/src/utils/create-generator.unit.test.ts—changing the tasks structure from an array to an object—is solid and indeed improves lookup performance as intended. However, our search has surfaced several instances in other test files where the tasks are still defined as arrays. Please verify whether these discrepancies are intentional (e.g., serving different testing contexts) or if they should be updated for consistency across the codebase.

  • Affected Files:
    • packages/sync/src/generators/build-generator-entry.unit.test.ts
    • packages/sync/src/runner/generator-runner.unit.test.ts
    • packages/sync/src/runner/dependency-map.unit.test.ts
packages/fastify-generators/src/generators/auth/auth/index.ts (1)

6-29: Good refactoring to the task-based approach!

The change from createSetupTask to createConfigProviderTask aligns well with the PR objectives of improving testability. This approach allows for more isolated testing of generator functionality by encapsulating configuration in a dedicated provider. The schema definition remains the same, ensuring backward compatibility while providing a clearer separation of concerns.

packages/fastify-generators/src/generators/core/fastify/setup-fastify-typescript.ts (1)

1-36: Excellent refactoring to task-based approach!

This change significantly improves testability by:

  1. Explicitly declaring dependencies on typescriptSetup
  2. Focusing the task on TypeScript configuration only, removing package installation logic
  3. Using a consistent task pattern that can be tested in isolation

The task pattern makes it much easier to unit test this functionality by allowing dependencies to be mocked and assertions to be made on the specific changes to the TypeScript configuration.

packages/sync/src/index.ts (1)

7-7: Great addition of test runner exports!

Adding the test runners export directly supports the PR's goal of enabling better unit testing of generators. This makes testing utilities accessible from the main package, improving the developer experience when writing tests for generators.

packages/core-generators/src/writers/index.ts (1)

1-1: Helpful addition of JSON writer exports!

Adding JSON writer exports enhances the toolkit available for generators and testing. This addition likely supports the overall goal of improving testability by providing utilities to serialize/deserialize test fixtures, configurations, or comparison outputs when testing generators.

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

1-2:

Details

✅ Verification successful

Node and PNPM version constants added.

These constants define specific versions for Node.js and PNPM, which helps standardize versions across generators and improves testability by centralizing version references.


🏁 Script executed:

#!/bin/bash
# Verify if these constants are referenced elsewhere in the codebase
echo "Checking usage of NODE_VERSION and PNPM_VERSION constants..."
rg -A 2 "NODE_VERSION|PNPM_VERSION" --type ts

Length of output: 2214


Constants are correctly defined and consistently referenced across the codebase.

  • The constants in packages/core-generators/src/constants/node.ts are properly defined.
  • They are imported and used in both the generator (packages/core-generators/src/generators/node/node/node.generator.ts) and its corresponding unit tests (packages/core-generators/src/generators/node/node/node.generator.unit.test.ts).

No changes are needed based on the current verification.


1-1:

Details

✅ Verification successful

Verify if this is a valid Node.js version.

The Node.js version specified (22.14.0) appears quite high, as Node.js versioning typically doesn't reach minor versions this high.


🌐 Web query:

What is the latest version of Node.js as of April 2025?

💡 Result:

The latest version of Node.js as of April 2025 is Node.js 23.11.0, released on April 1, 2025. This version is part of the Current release line, which receives regular updates until its end-of-life in June 2025[8].

Key details about recent Node.js versions:

  • Node.js 22 (LTS): Latest version 22.14.0 (released February 11, 2025), supported until April 2027[4]
  • Node.js 20 (LTS): Latest version 20.19.0 (released March 13, 2025), supported until April 2026[4]
  • Node.js 18: Final version 18.20.8 (March 27, 2025)[3][10], scheduled for end-of-life on April 30, 2025[4][7]

For production environments, Node.js 22.x (LTS) remains the recommended choice due to its long-term support until 2027[4][8]. However, developers should plan upgrades from Node.js 18 before its April 2025 end-of-life date to maintain security updates[3][7].

Citations:


Verified: Node.js Version is Correct

After checking the latest releases as of April 2025, it's confirmed that Node.js 22.14.0 is the current LTS version (released February 11, 2025) and remains the recommended version for long-term support. No changes are needed for the constant defined in packages/core-generators/src/constants/node.ts.


2-2:

Details

❓ Verification inconclusive

Verify PNPM version compatibility.

Ensure this PNPM version is compatible with the specified Node.js version.


🌐 Web query:

What is the latest version of PNPM as of April 2025 and which Node.js versions does it support?

💡 Result:

As of April 2025, the latest version of pnpm is 10.7.1, released on April 1, 2025[7]. This version maintains compatibility with Node.js 18, 20, and 22, as shown in pnpm's support table[1][4].

Key details about compatibility:

  • pnpm 10.x officially supports:
    • Node.js 18 (minimum v18.12)[1][3]
    • Node.js 20[1][6]
    • Node.js 22[1][4]
  • Older Node.js versions like 14 and 16 are unsupported[1][4]

For optimal performance and security, the pnpm team recommends using Node.js 20 (Maintenance LTS) or Node.js 22 (Active LTS)[6][9]. Projects encountering "Unsupported Node.js version" errors typically need to upgrade Node.js to v18.12 or newer[3].

Citations:


Action: Confirm PNPM Version Compatibility and Consider an Update

The constant PNPM_VERSION in packages/core-generators/src/constants/node.ts is set to '10.6.5'. Our research indicates that pnpm 10.x officially supports Node.js 18 (minimum v18.12), Node.js 20, and Node.js 22. As of April 2025, the latest release is 10.7.1. Please verify that the Node.js version used in your project meets these requirements, and consider updating the version to '10.7.1' if there’s no conflict with your current setup.

packages/sync/src/test-runners/index.ts (1)

1-1:

Details

✅ Verification successful

Export added for test runner.

This export statement makes the test runner functionality available through the index file, providing a cleaner import interface for consumers and aligning with the PR's goal of improving generator testing.


🏁 Script executed:

#!/bin/bash
# Check the implementation of the test-runner.js file to understand what's being exported
echo "Checking the test-runner.js implementation..."
cat packages/sync/src/test-runners/test-runner.js 2>/dev/null || 
cat packages/sync/src/test-runners/test-runner.ts 2>/dev/null || 
echo "Test runner file not found in expected location"

Length of output: 3497


Test Runner Export Verified and Approved

The export in packages/sync/src/test-runners/index.ts correctly re-exports the test runner functionality (from the compiled output file) as intended. The implementation in test-runner.ts confirms that the interface exposed via the index is consistent with the desired functionality for improving generator testing. No further changes are required.

packages/core-generators/src/generators/node/_composers/node.ts (1)

8-8:

Details

✅ Verification successful

Import path updated for nodeGenerator.

The import path has been updated to reflect a more specific file location, changing from the generic index file to a dedicated generator file. This improves code organization and makes dependencies more explicit.


🏁 Script executed:

#!/bin/bash
# Verify that the node.generator.js file exists and exports nodeGenerator
echo "Checking for nodeGenerator export in the new location..."
rg -A 3 "export const nodeGenerator" packages/core-generators/src/generators/node/node/node.generator.ts

# Check if any other imports of nodeGenerator need to be updated
echo "Checking for any other imports that might need updating..."
rg -A 1 "import.*nodeGenerator.*from.*node/index" --type ts

Length of output: 543


Verified: The updated import path for nodeGenerator is correct.

  • The file at packages/core-generators/src/generators/node/node/node.generator.ts correctly exports nodeGenerator, confirming that the dedicated generator file is in use.
  • No outdated import references to node/index were found in the codebase.
packages/sync/src/output/post-write-commands/run-commands.ts (1)

41-41:

Details

✅ Verification successful

Added environment variables support to command execution.

The addition of the env property allows passing environment variables to post-write commands, enhancing flexibility when executing commands with specific environment requirements. This improvement supports the PR's goal of better testability.


🏁 Script executed:

#!/bin/bash
# Verify the PostWriteCommand type definition includes the env property
echo "Checking if PostWriteCommand type includes env property..."
rg -A 20 "type PostWriteCommand" --type ts

# Check the executeCommand function to ensure it handles the env property
echo "Checking if executeCommand function handles the env property..."
rg -A 10 "function executeCommand" --type ts

Length of output: 11073


Environment Variables Enhancement Verified

The changes introduce and utilize the env property as intended:

  • The PostWriteCommand type now supports the env property (verified in the tests).
  • The executeCommand function in packages/sync/src/utils/exec.ts properly handles the environment variables passed via command.options?.env.

These modifications align with the goal of enhancing flexibility and testability for post-write command execution.

packages/sync/src/output/post-write-commands/types.ts (1)

43-46: Good addition of environment variable support for post-write commands

This feature enhances the flexibility of post-write commands by allowing them to run with specific environment variables, which will be useful for testing across different environments.

.changeset/hot-trees-take.md (1)

1-9: Good documentation of the patch updates

The changeset correctly documents the patch updates for the affected packages, with a clear description of the purpose: refactoring the node generator for more ergonomic usage.

.changeset/shaky-spoons-add.md (1)

1-8: Changeset aligns well with PR objectives

This changeset clearly documents the refactoring of generation methods to enable better unit testing of generator tasks, which directly aligns with the PR title and objectives.

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

4-4:

Details

✅ Verification successful

Export path updated to reflect restructured code

The export path now points to node.generator.js instead of a potential previous index.js file. This change reflects the reorganization of the Node generator code to improve testability.


🏁 Script executed:

#!/bin/bash
# Verify that node.generator.js exists and check what it exports
find packages/core-generators/src/generators/node -name "*.ts" | grep -E 'node(\.generator)?\.ts'

Length of output: 231


The export path correctly reflects the new folder structure.

  • Verified that the source file is now located at packages/core-generators/src/generators/node/node/node.generator.ts, which aligns with the updated export statement in packages/core-generators/src/generators/node/index.ts.
  • The change from a potential previous index.js to node.generator.js is appropriate given the reorganization for improved testability.
packages/react-generators/src/constants/react-packages.ts (1)

33-37: Well-structured addition of date picker packages

The date picker packages have been properly added with appropriate versions and are well-organized under a clear comment heading.

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

108-111: Improved package dependency management

This refactoring consolidates dependency management into a single, more structured method call with explicit separation between production and development dependencies. This is a cleaner approach that's likely more maintainable and easier to test.

The change is part of the broader refactoring to improve generator testability mentioned in the PR objectives.

packages/sync/src/utils/exec.ts (1)

6-6: Enhanced flexibility with custom environment variables

Adding an optional environment variables property to the ExecOptions interface improves flexibility for command execution, especially useful for testing scenarios.

packages/sync/src/generators/build-generator-entry.ts (1)

110-110: Structural change from array to object improves flexibility

Changing from tasks.map to Object.values(tasks).map indicates tasks are now stored as an object rather than an array. This provides more flexibility in how tasks are organized and referenced, which aligns well with the PR objective of improving unit testing capabilities.

packages/core-generators/src/providers/project.ts (1)

1-1: Improved provider type specificity

Changing from createProviderType to createOutputProviderType enhances type safety and clarifies the provider's role as an output provider. This is a positive change that makes the code more self-documenting and aligns with the refactoring goal of improving testability by being more explicit about component behaviors.

Also applies to: 7-8

packages/sync/src/utils/index.ts (1)

3-4:

Details

❓ Verification inconclusive

Architectural shift from setup tasks to config provider tasks

The replacement of setup task exports with config provider task exports represents a positive architectural change toward more modular and testable configuration management. This aligns well with the PR objective of improving testing capabilities.

However, ensure that any existing code depending on the removed setup task exports has been properly migrated to use the new config provider tasks to maintain backward compatibility.


🏁 Script executed:

#!/bin/bash
# Check if there are any remaining references to the removed setup task exports
echo "Checking for references to removed setup task exports..."
rg "createSetupTask|createSetupTaskWithInfo" --type ts

Length of output: 179


Architectural shift from setup tasks to config provider tasks

The updated exports in packages/sync/src/utils/index.ts clearly reflect a move toward a more modular and testable design, aligning well with the PR’s objective of improving unit testing. Although our initial check in TypeScript files revealed no lingering references to the removed setup task exports, please ensure—using the above full-repository search—that no usages remain in non-TypeScript files (or elsewhere). This is to safeguard backward compatibility across the codebase.


🏁 Script executed:

#!/bin/bash
echo "Searching for references to removed setup task exports across the entire repository..."
rg -i "create[-]?setup[-]?task" .

Length of output: 340


Architectural shift from setup tasks to config provider tasks

The changes in packages/sync/src/utils/index.ts clearly enhance modularity and testability in line with the PR’s intent. Our repository-wide searches for references to the removed setup task exports (e.g., looking for "createSetupTask" patterns) returned no results, indicating that the migration appears complete.

However, since the automated searches produced minimal output and to ensure no indirect dependencies are overlooked (especially in non-TypeScript files), please perform a final manual verification of any potential usages that might not be caught by the tooling.

packages/core-generators/src/utils/extract-packages.ts (1)

1-14: Well-designed utility function with strong typing

This utility function provides a clean and type-safe way to extract specific package versions, which supports the PR objective of better testability by enabling more modular package management. The use of generics preserves type information effectively.

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

40-40: Method signature updated to include taskId parameter

The run method now accepts a taskId parameter, which is destructured from the second argument. This enhances the generator's testability by providing a way to track and identify task operations.


44-53: Improved script management with taskId tracking

The implementation has been improved by replacing node.addScripts with node.scripts.mergeObj, which now includes the taskId parameter. This change provides better tracking of script additions by associating them with specific task identifiers, which facilitates testing and debugging.

packages/sync/src/generators/generators.ts (3)

187-191: Added AnyGeneratorTask type for better flexibility

Good addition of the AnyGeneratorTask type, which enhances flexibility when working with generator tasks without needing to specify exact generic types. This will be particularly useful in contexts where the precise types aren't required but type safety is still maintained.


213-218: Enhanced GeneratorBundle interface with generic TaskConfigs

The GeneratorBundle interface has been improved with a generic parameter TaskConfigs that defaults to a record of AnyGeneratorTask. This change provides better type safety and flexibility when working with different task configurations.


242-242: Changed tasks from array to record for better access

Tasks property has been changed from an array to a record (dictionary) with string keys. This enables direct access to specific tasks by name, which significantly improves testability by allowing tests to target individual tasks precisely.

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

3-12: Added package management utility imports

Good addition of createNodePackagesTask and extractPackageVersions imports. These utilities will improve package dependency management by providing dedicated functionality rather than handling it within the generator tasks directly.


39-44: Improved separation of concerns with dedicated package management task

Excellent refactoring by adding a dedicated task for package management using createNodePackagesTask. This approach:

  1. Separates package management concerns from the main generator logic
  2. Makes the code more maintainable and testable
  3. Provides a consistent pattern for managing dependencies

This is in line with the PR's goal of improving generator testing ergonomics.


57-57: Simplified run method by removing node parameter

Appropriately removed the node parameter from the run method since package management has been moved to a dedicated task. This simplifies the method signature and reduces the responsibility of the main generator task.

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

3-9: Added package management utility imports

Good addition of createNodePackagesTask and extractPackageVersions imports to provide dedicated functionality for package management.


35-37: Added dedicated task for package dependency management

Well-structured implementation of a dedicated task for managing the @node-rs/argon2 package dependency using createNodePackagesTask. This approach:

  1. Centralizes package management outside the main generator task
  2. Makes dependencies more explicit and traceable
  3. Follows a consistent pattern with other generators

This refactoring improves testability and maintainability of the code.


48-48: Simplified run method by removing node parameter

The run method has been appropriately simplified by removing the node parameter, as package management has been moved to a separate dedicated task. This separation of concerns makes the generator easier to test and maintain.

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

4-4: Updated imports to support the refactored generator pattern.

The imports have been appropriately updated to use the new writeJsonToBuilder utility and explicit imports of createGenerator and createGeneratorTask.

Also applies to: 6-6


63-74: Good refactoring of the build function.

The function has been simplified from an async function to a synchronous one, which makes it more testable. The addition of the id parameter provides better traceability when writing files.

packages/core-generators/src/writers/json.ts (2)

1-20: Well-defined interface with clear documentation.

The WriteJsonToBuilderOptions interface is properly typed and includes helpful JSDoc comments explaining each property's purpose.


25-42: Clean implementation of the JSON writer.

This function effectively encapsulates the logic for writing formatted JSON to a file through the builder pattern. The implementation correctly:

  1. Extracts required properties
  2. Formats the JSON with proper indentation
  3. Sets shouldFormat: true for consistent formatting

This approach improves testability by removing side effects from the previous implementation.

packages/core-generators/src/generators/node/node/package-dependencies-container.unit.test.ts (5)

1-12: Well-structured test initialization.

Good use of the Vitest framework with proper test organization and setup.


14-30: Comprehensive testing of basic functionality.

These tests effectively verify the container's ability to add production and development dependencies correctly.


32-40: Good edge case testing for version compatibility.

This test verifies that the container correctly merges compatible versions of the same dependency, demonstrating how it handles semantic versioning.


42-50: Important validation of error handling.

This test ensures that the container correctly rejects incompatible package versions, which is critical for preventing dependency conflicts.


52-88: Thorough testing of advanced functionality.

These tests cover important edge cases:

  1. Upgrading dependencies from dev to prod
  2. Adding multiple dependencies at once
  3. Merging complex dependency sets

This comprehensive test coverage will help ensure the container maintains its contract during future refactoring.

plugins/baseplate-plugin-storage/src/generators/fastify/storage-module/index.ts (2)

4-5: Added new utility imports for package management.

The addition of createNodePackagesTask and extractPackageVersions imports prepares for the refactoring of Node package handling.


67-75: Improved dependency management with task-based approach.

This change replaces direct manipulation of node packages with a declarative task-based approach, which:

  1. Makes the code more testable by isolating package management logic
  2. Improves maintainability by centralizing dependency specification
  3. Uses extractPackageVersions to selectively pull from the constants file

This aligns perfectly with the PR objective of enabling better unit testing of generators.

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

12-12: Import update aligns with task creation refactoring

The import statement has been updated to use createConfigProviderTask instead of the previous createSetupTask, which aligns with the task-based approach mentioned in the PR objectives.


33-42: Task creation approach updated for better testing

The function call has been changed to use createConfigProviderTask which provides a more consistent approach for configuration tasks throughout the codebase. This supports the PR's goal of enabling better unit testing by standardizing how configuration providers are created.

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

2-3: New imports support package management refactoring

These new imports support the task-based approach for package management that's being implemented across the codebase.


29-31: Package management moved to dedicated task

Moving the Postmark package dependency to a dedicated task using createNodePackagesTask is a good refactoring step. This separates package management concerns from the main task logic, which improves testability.


41-41: Removed node dependency from run parameters

The node parameter has been removed from the run function signature since package management is now handled by the dedicated task above. This simplifies the function and makes it more focused on its core responsibility.

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

4-5: New imports for task-based package management

The addition of these imports supports the new approach to package management using dedicated tasks.


42-45: Dedicated task for package dependencies

This new task clearly separates production and development dependencies. Using extractPackageVersions ensures consistent versioning by referencing the central package constants.


59-66: Simplified run function signature

The removal of the node parameter from the run function enhances testability by eliminating direct manipulation of the node provider. The function is now more focused on its core responsibilities rather than package management.

plugins/baseplate-plugin-storage/src/generators/react/upload-components/index.ts (3)

5-5: Import for task-based package management

The addition of this import supports the new approach to package management using dedicated tasks.


40-47: Centralized package management task

This implementation of createNodePackagesTask organizes multiple package dependencies from different sources into a single dedicated task. This makes package dependencies explicit and separates concerns effectively.


59-59: Streamlined run function signature

The removal of the node parameter from the run function improves testability by removing direct manipulation of external services, allowing the function to focus on its core responsibilities.

packages/react-generators/src/generators/core/react-datadog/index.ts (3)

2-3: Added essential utility imports for improved package management

The addition of createNodePackagesTask and extractPackageVersions imports indicates a shift toward a more modular approach for package management, aligning with the PR's goal of enabling better unit testing.


35-37: Improved package management with targeted dependency extraction

The implementation now uses a task-based approach with createNodePackagesTask and selectively extracts only the Datadog package from REACT_PACKAGES using extractPackageVersions. This is a significant improvement over directly manipulating the node provider.


49-49: Signature simplified by removing node dependency

The run method signature has been updated to remove the node parameter, which is consistent with the migration to task-based package management. This simplifies the function signature and makes the code more testable.

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

14-14: Updated import path to reflect new module structure

The import path for nodeProvider has been updated to reference node.generator.js instead of index.js, reflecting a more organized and explicit module structure.


42-42: Enhanced run method with task traceability

The run method now includes a taskId parameter, which improves traceability and allows for better identification of task-specific operations in logs and debugging.


75-92: Updated package management to use structured API

Package management has been updated to use node.packages.addDevPackages instead of node.addDevPackages, indicating a more structured and namespaced API that improves testability and modularity.


93-97: Script management updated with task ID for traceability

The script setting mechanism has been updated to use node.scripts.set with an additional taskId parameter, which enhances traceability and allows for better identification of which task created which script.


99-99: Simplified ESM detection with property access

The code now uses node.isEsm as a property rather than a method call node.isEsm(), resulting in cleaner, more concise code that follows modern JavaScript property access patterns.

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

15-15: Added package extraction utility import

The addition of the extractPackageVersions import provides a cleaner way to selectively include only the necessary packages, improving code maintainability.


19-22: Enhanced import organization with task-based approach

The imports now include createNodePackagesTask along with nodeProvider, reflecting the shift towards a task-based package management approach that improves testability.


43-48: Implemented task-based package management

Added createNodePackagesTask with selective package extraction for vitest and vite-tsconfig-paths, which simplifies package management and improves modularity.


68-68: Simplified ESM detection with property access

Changed from node.isEsm() method call to node.isEsm property access, resulting in more concise code that follows modern JavaScript property access patterns.

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

5-6: Added essential utilities for package management

The addition of createNodePackagesTask and extractPackageVersions imports enables a more declarative and modular approach to package management.


64-68: Implemented task-based package management for better testability

Added a dedicated task using createNodePackagesTask that extracts only the @fastify/request-context package from FASTIFY_PACKAGES. This approach separates concerns and improves testability by moving package management to a dedicated task.


78-78: Simplified dependency injection by removing node parameter

The run method no longer requires the node parameter since package management has been moved to a dedicated task. This simplifies the function signature and improves testability by reducing dependencies.

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

2-3: Well-structured import of new utility functions

The introduction of createNodePackagesTask and extractPackageVersions imports aligns with the PR's goal of improving testability by modularizing dependency management.


38-48: Good refactoring of package management

Using the dedicated createNodePackagesTask function to manage dependencies improves modularity and testability by extracting specific packages from the centralized FASTIFY_PACKAGES constant.


61-61: Appropriate signature update with dependency removal

Removing the node parameter from the task's run function signature is consistent with the shift away from direct node provider manipulation, and improves the testability of the generator.


125-127: Improved package version management

Using extractPackageVersions to retrieve specific package versions creates a more consistent and maintainable approach to dependency management across generators.

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

2-2: Good import refactoring

Replacing the nodeProvider import with createNodeTask aligns with the PR's goal of improving testability by providing a more task-oriented approach to managing node operations.


28-36: Well-structured script management task

The new task created with createNodeTask encapsulates script management logic in a dedicated, testable unit. This improves modularity and makes the code's intent clearer.


45-45: Appropriate parameter removal

Removing the node parameter from the run method signature is consistent with the shift towards task-based dependency management and improves the generator's testability.

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

2-3: Well-structured import of utility functions

The introduction of createNodePackagesTask and extractPackageVersions improves modularity and aligns with the PR's goal of enhancing testability through more isolated and focused tasks.


25-29: Good package management refactoring

The new task created with createNodePackagesTask provides a cleaner, more testable approach to managing package dependencies by isolating this concern in a dedicated task.

packages/react-generators/src/generators/core/react-sentry/index.ts (3)

4-5: Well-structured import of utility functions

The introduction of createNodePackagesTask and extractPackageVersions aligns with the PR's goal of enhancing testability by providing focused utilities for package management.


39-41: Good package management refactoring

Using createNodePackagesTask with extractPackageVersions to manage the Sentry package dependency improves modularity and testability by isolating package management concerns.


53-53: Appropriate parameter removal

Removing the node parameter from the run method signature reflects the shift away from direct node provider manipulation and improves the testability of the generator.

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

2-3: Good addition of utility imports for package management.

These imports support the new task-based approach for managing package dependencies, which aligns with the PR's goal of improving unit testing capabilities.


35-40: Great refactoring to use task-based package management.

The implementation properly uses the createNodePackagesTask with extractPackageVersions to specify Stripe dependencies. This approach removes direct manipulation of the node provider, which enables better unit testing of generators as mentioned in the PR objectives.

packages/react-generators/src/generators/core/react-tailwind/index.ts (3)

2-4: Good addition of utility imports for package management.

These imports support the new task-based approach for managing package dependencies, which improves testability.


39-46: Well-implemented task-based dependency management.

The code correctly extracts Tailwind-related development dependencies using the new task-based approach, which improves unit testing capabilities by isolating package management.


57-57: Correctly simplified method signature.

The node parameter has been removed from the run method since package management is now handled by a dedicated task, which is a cleaner separation of concerns.

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

8-10: Good addition of utility imports for task-based package management.

These imports support the new approach for managing package dependencies, aligning with the PR's goal to improve unit testing capabilities.


61-64: Effective implementation of package management task.

The code properly separates production and development dependencies for the logger service, using createNodePackagesTask with extractPackageVersions. This approach enhances testability by isolating package management logic.


74-74: Correctly simplified method signature.

Removing the node parameter from the run method is appropriate since package management is now handled by a dedicated task, improving code organization and testability.

packages/react-generators/src/generators/core/react-config/index.ts (3)

8-9: Good addition of utility imports for package management.

These imports support the task-based approach for managing package dependencies, which aligns with the PR objective of improving generator testing.


48-50: Effective implementation of Zod dependency management.

The code correctly adds the 'zod' package as a production dependency using the task-based approach, which is consistent with the refactoring pattern used throughout the PR.


59-59: Correctly simplified method signature.

The method signature has been appropriately simplified by removing the node parameter since package management is now handled by a dedicated task, which improves separation of concerns and testability.

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

4-5: Well-structured import additions for package management

These imports add support for the new task-based approach to manage package dependencies, enhancing modularity.


40-43: Good separation of package management concerns

The implementation correctly replaces direct node manipulation with a dedicated task for package management. This makes the generator more testable by isolating dependency installation logic.


55-55: Appropriately removed node parameter from run method

The parameter removal reflects the shift from direct node manipulation to task-based package management, making the function more focused on its core responsibilities.

packages/sync/src/utils/create-config-provider-task.ts (5)

1-21: Well-organized imports with appropriate types

The import structure follows good practices, clearly separating type imports from function imports.


22-44: Well-documented configuration options interface

The ConfigProviderTaskOptions interface is properly documented with JSDoc comments that explain each property's purpose.


46-53: Clear type definition with meaningful comments

The ConfigProviderTaskResult type is well-structured with helpful comments explaining each component of the tuple.


55-87: Excellent documentation with practical examples

The JSDoc comments provide comprehensive documentation including purpose, behavior, parameter details, return information, and a practical usage example that enhances developer understanding.


88-122: Well-implemented function with clean separation of concerns

The createConfigProviderTask function follows good practices:

  1. Creates properly named providers with prefixes
  2. Returns a logically structured tuple
  3. Implements clean separation between modifiable config and read-only values
  4. Uses appropriate dependency injection pattern

This implementation enhances testability by making configuration management more modular.

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

5-6: Appropriate imports for the package management approach

These imports support the refactored task-based dependency management approach.


77-84: Effective extraction of specific package versions

The implementation correctly uses extractPackageVersions to manage Fastify-related dependencies. This approach improves testability by isolating package management in a dedicated task.


96-96: Correctly updated run method signature

The removal of the node parameter from the run method signature aligns with the refactoring pattern to separate package management from core generator logic.

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

2-3: Consistent import pattern across generators

The imports follow the same pattern as other generator files, maintaining consistency throughout the codebase.


22-24: Clean implementation of package management task

The createNodePackagesTask implementation correctly extracts the Auth0 React package from the constants file, following the consistent pattern established in other generators.


31-31: Properly refactored method signature

The run method signature has been correctly updated to remove the node parameter, consistent with the pattern applied across all generators in this refactoring.

packages/react-generators/src/generators/core/react-router/index.ts (3)

7-8: Good addition of utility functions for package management.

These new imports bring in functions that centralize package management logic, making the code more maintainable and testable.


53-55: Well-implemented task-based approach for package management.

The new task using createNodePackagesTask and extractPackageVersions effectively separates package dependency management from other concerns. This decoupled approach improves testability by allowing package management to be tested independently.


68-68: Clean signature simplification.

Removing the node parameter from the function signature is a good refactoring step that aligns with the separation of package management into its own task.

packages/sync/src/generators/build-generator-entry.unit.test.ts (7)

11-11: Good update to import requirements.

Adding GeneratorBundle to the imports allows for proper type checking with the satisfies operator.


40-56: Well-structured task object format.

Converting from an array to a named object structure makes tasks more identifiable and accessible by key, which enhances testing capabilities. The structure now matches the GeneratorBundle interface expectations.


51-53: Improved no-op implementation.

Using a comment to indicate a no-operation is clearer than returning an empty object. This explicit approach helps with code readability.


102-112: Consistent task structure in child bundle.

This maintains the same pattern as the parent bundle, using a named object structure instead of an array for tasks. The consistency across the codebase improves maintainability.


113-113: Good use of type assertion.

Adding satisfies GeneratorBundle ensures type safety and catches potential errors at compile time, which is especially valuable for testing.


126-127: Appropriate empty task object and type assertion.

Using an empty object instead of an empty array and adding type assertion maintains consistency with the updated GeneratorBundle interface.


198-198: Consistent type assertion throughout.

Consistently using type assertions across all bundle definitions ensures type safety throughout the codebase.

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

8-9: Good addition of utility functions for package management.

These new imports centralize package management logic, making the code more maintainable and testable.


128-141: Well-structured task for package management.

The dedicated task for package management properly separates concerns and improves testability. The comprehensive list of dependencies is well-organized into production and development packages.


247-251: Improved package versioning consistency.

Using extractPackageVersions ensures consistent versioning across the application and improves maintainability. This approach allows for centralized version management.


285-290: Consistent package management approach.

This follows the same pattern as other package additions in the file, using extractPackageVersions to maintain version consistency across the application.

packages/react-generators/src/generators/core/react-error-boundary/index.ts (3)

2-3: Good addition of utility functions for package management.

These new imports centralize package management logic, making the code more maintainable and testable.


34-36: Well-implemented task-based approach for package management.

The new task using createNodePackagesTask and extractPackageVersions effectively separates package dependency management from other concerns, improving testability.


48-48: Clean signature simplification.

Removing the node parameter from the function signature is a good refactoring step that aligns with the separation of package management into its own task.

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

2-3: Good addition of utilities for package management.

The new imports createNodePackagesTask and extractPackageVersions support the separation of package management from generator logic, which improves testability.


30-32: Well-implemented package management task.

Creating a dedicated task for node package management is a good refactoring approach. Using extractPackageVersions to pull specific versions from FASTIFY_PACKAGES ensures consistency across the project.


43-43: Correctly simplified function signature.

Removing the node parameter from the run method signature is appropriate since package management has been extracted to a separate task, making this generator easier to test in isolation.

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

8-8: Good addition of package extraction utility.

Adding the extractPackageVersions import supports the refactoring to separate package management concerns.


84-109: Well-structured Node configuration task.

This new 'node' task properly encapsulates all Node.js package management and script configuration:

  1. It correctly handles Prisma client and dev dependencies using extractPackageVersions
  2. The postinstall script addresses a specific Prisma/pnpm issue (good comment explaining why)
  3. The seed script configuration is properly integrated with fastifyOutput flags

This separation of concerns improves testability and maintainability.


111-121: Well-refactored schema task.

The 'schema' task has been properly simplified by moving node-related operations to the dedicated 'node' task. This separation of concerns enhances testability and clarity.

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

4-5: Good addition of package management utilities.

The imports for createNodePackagesTask and extractPackageVersions support the refactoring to separate package management concerns.


32-34: Well-implemented package management task.

Creating a dedicated task for managing the nanoid dependency is a good approach. Using extractPackageVersions to pull the version from REACT_PACKAGES ensures consistency.


44-44: Correctly simplified function signature.

Removing the node parameter from the run method signature is appropriate since package management has been extracted to a separate task. This makes the generator easier to test in isolation.

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

8-9: Good addition of package management utilities.

The imports for createNodePackagesTask and extractPackageVersions support the refactoring to separate package management concerns.


72-75: Well-implemented package management task.

Creating a dedicated task for managing package dependencies is a good approach:

  1. Production dependencies (zod, cross-env) are properly specified
  2. Development dependency (dotenv) is correctly separated
  3. Using extractPackageVersions ensures version consistency with other parts of the application

This separation of concerns improves testability and maintainability.


83-83: Correctly simplified function signature.

Removing the node parameter from the run method signature is appropriate since package management has been extracted to a separate task. This makes the generator easier to test in isolation.

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

2-3: Properly extracted package management to a dedicated task

The refactoring extracts package management from the run method to a dedicated task, which improves testability by decoupling concerns. This makes it easier to test both the package management and the main generator task independently.

Also applies to: 16-16, 33-35


49-59: Added taskId parameter for improved task identification

The run method now accepts a taskId parameter, which is used when merging scripts. This change allows for better tracking of task operations during testing and execution.


70-76: Replaced direct script management with mergeObj method

The script management is now using node.scripts.mergeObj() with the taskId parameter, which provides better encapsulation and clarity compared to the previous approach (likely direct manipulation).

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

2-4: Properly extracted package dependencies to a dedicated task

The axios package dependency management has been extracted to a separate task using createNodePackagesTask and extractPackageVersions. This improves testability and maintains consistency with the new pattern being established across generators.

Also applies to: 21-23


26-30: Simplified dependencies by removing nodeProvider

The node parameter has been removed from the dependencies, which simplifies the generator task. Package management is now handled by the dedicated task, allowing the main task to focus on its core responsibilities.

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

6-9: Consistently applied the node packages task pattern

The refactoring follows the same pattern applied across generators, extracting package management to a dedicated task using createNodePackagesTask and extractPackageVersions. This improves testability and maintains consistency.

Also applies to: 42-44


46-54: Simplified run method by removing node dependency

The run method no longer needs to handle package management, which simplifies its implementation and improves testability by reducing its responsibilities.

packages/core-generators/src/generators/node/node/node.generator.unit.test.ts (6)

1-7: Good setup for unit testing the node generator

The test file properly imports the necessary testing utilities and the generator under test. Using vitest for testing is a good choice for TypeScript projects.


8-19: Well-structured test for project name retrieval

This test properly verifies that the project task correctly returns the project name. The test structure is clean and follows best practices by using a describe block for context and an it block for the specific test case.


21-57: Comprehensive test for package.json generation with default values

This test thoroughly validates that the generator creates a package.json with the expected default values. The test checks both the provider exports and the actual file content, which provides good coverage of the generator's functionality.


59-102: Good test coverage for custom configuration values

This test ensures that custom configuration values are properly applied to the generated package.json. Testing with a variety of custom values provides confidence that the generator handles different configurations correctly.


104-123: Proper validation of post-write commands

This test verifies that the generator correctly adds a post-write command for package installation. Checking the command details ensures that the installation will be triggered correctly after file generation.


126-168: Good test for package management through node provider

This test verifies that packages can be added to the node provider and that they appear correctly in the generated package.json. The test demonstrates how the new pattern of using the provider for package management works in practice.

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

2-3: New package management utilities added.

The code now imports createNodePackagesTask and extractPackageVersions to enable a more modular approach to package management.


25-27: Improved package management with dedicated task.

Package management has been extracted into a dedicated task using createNodePackagesTask, which enhances testability and separation of concerns. The task extracts the @fastify/cookie package version from the centralized FASTIFY_PACKAGES constant.


34-34: Simplified run method signature.

The run method no longer requires the node parameter since package management has been moved to its own dedicated task. This simplifies the function and makes it more focused on its core responsibility.

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

1-4: Updated imports for task-based approach.

The imports have been updated to include createNodeTask and extractPackageVersions, enabling the transition to a task-based approach for node operations.


8-42: Refactored node setup to use task-based approach.

The original setupViteNode function has been replaced with a constant viteNodeTask that uses createNodeTask. This change:

  1. Consolidates package management into a single node.packages.addPackages call
  2. Uses extractPackageVersions to efficiently manage package versions
  3. Updates script handling to use node.scripts.mergeObj instead of direct script addition
  4. Updates extra properties handling to use node.extraProperties.merge

This refactoring improves testability by encapsulating node setup in a dedicated task, making it easier to mock and verify in unit tests.

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

4-5: Added package management utilities.

The imports for createNodePackagesTask and extractPackageVersions have been added to support the new task-based approach for package management.


78-105: Enhanced dependency management with dedicated tasks.

Package management has been refactored to use dedicated tasks:

  1. A base task that handles common React component dependencies
  2. A conditional task for date picker packages when includeDatePicker is true

This approach:

  • Separates package management from the component logic
  • Makes dependencies explicit and centralized
  • Improves testability by isolating package management
  • Maintains conditional logic for optional dependencies

The use of extractPackageVersions ensures consistent version management from the centralized REACT_PACKAGES constant.


116-116: Simplified run method signature.

The run method signature has been updated to remove the node parameter, as package management has been extracted to dedicated tasks. This creates a cleaner separation of concerns.

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

2-3: Added package management utilities.

The imports for createNodePackagesTask and extractPackageVersions have been added to support the task-based approach for package management.


45-54: Conditional package management with dedicated task.

A conditional task has been added to manage the auth0 package dependency when includeManagement is true. This:

  • Improves testability by isolating package management
  • Maintains the conditional logic for optional dependencies
  • Uses extractPackageVersions to get the version from the centralized FASTIFY_PACKAGES constant

This separation of concerns makes the code more modular and easier to test.


188-190: Added dedicated task for auth0 verify package.

A new dedicated task has been added to manage the fastify-auth0-verify package dependency. This extraction:

  • Separates package management from plugin registration
  • Improves testability
  • Uses extractPackageVersions to maintain consistent version management

This change follows the pattern of separation of concerns applied throughout the PR.


197-197: Simplified plugin registration task.

The run method signature of the fastifyAuth0Plugin task has been simplified by removing the node parameter, as package management has been moved to a dedicated task. The plugin registration now focuses solely on its core responsibility.

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

2-3: Good addition of utility imports.

The new imports for createNodePackagesTask and extractPackageVersions set the stage for improved package management.


35-37: Excellent refactoring to decouple package management.

This change improves testability by moving package dependency management to a dedicated task. The createNodePackagesTask approach is more modular than directly manipulating the node provider in the main task.


47-47: Clean function signature update.

Removing the unused node parameter from the run function signature is a good practice. This reflects the improved architecture where package management has been moved to a dedicated task.

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

9-10: Good addition of utility imports.

Adding the createNodePackagesTask and extractPackageVersions imports is consistent with the refactoring pattern across the project.


62-62: Property access instead of method call.

Changed from method call node.isEsm() to property access node.isEsm. This is a good consistency improvement if isEsm is now defined as a property rather than a method.


87-87: Property access instead of method call.

Similar to line 62, this change ensures consistent use of node.isEsm as a property.


117-125: Well-structured package dependency management.

This is a good refactoring that:

  1. Separates production and development dependencies
  2. Extracts only the needed packages from FASTIFY_PACKAGES
  3. Improves testability by encapsulating package management in a dedicated task

The approach is more maintainable than directly manipulating the node provider in task run functions.


137-137: Clean function signature update.

Removing the unused node parameter from the run function signature is appropriate since package management has been moved to a dedicated task.

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

2-3: Good addition of utility imports.

Adding the createNodePackagesTask and extractPackageVersions imports is consistent with the refactoring pattern across the project.


12-12: Improved imports organization.

Maintaining the FASTIFY_PACKAGES import to extract specific package versions needed by this generator.


26-31: Well-structured package dependency management.

Excellent refactoring to move package management to a dedicated task. This approach:

  1. Makes the code more testable by isolating package installation logic
  2. Clearly specifies exactly which packages this generator needs
  3. Maintains consistency with the refactoring pattern across the project

39-39: Clean function signature update.

Removing the unused node parameter from the run function signature reflects the improved architecture where package management has been moved to a dedicated task.

packages/react-generators/src/generators/core/react/index.ts (6)

9-9: Streamlined node configuration imports.

Good replacement of node-related imports with nodeConfigProvider, which suggests a more centralized approach to node configuration.


26-26: Improved task organization.

Importing a pre-defined task viteNodeTask instead of creating it inline improves code organization and reusability.


56-56: Updated dependency management.

Changing the dependency from (likely) nodeSetup to nodeConfig aligns with the architectural changes made to node configuration management.


59-59: Improved ESM configuration.

Using nodeConfig.isEsm.set(true, taskId) provides better traceability with the taskId parameter, which can help with debugging and tracking configuration changes.


63-63: Enhanced task composition.

Using the imported viteNodeTask directly in the tasks array improves modularity and reusability compared to inline task creation.


74-74: Clean function signature update.

Removing the unused node parameter from the run function signature is appropriate as node configuration is now handled through the dedicated tasks.

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

4-7: New imports for task-based approach

These new imports enable the task-based approach for managing node packages and extracting package versions, which aligns with the PR objective of improving unit testing capabilities.


83-95: Good modular approach to dependency management

Using createNodePackagesTask to handle both production and development dependencies makes the code more testable and maintainable by separating concerns. The use of extractPackageVersions ensures version consistency from a central source.


96-104: Well-structured script management with createNodeTask

This approach nicely encapsulates script management in a dedicated task, making it easier to test and maintain. The mergeObj method with the 'graphql-codegen' identifier provides good organization of related scripts.


105-114: Clean conditional task handling for subscriptions

Good use of conditional task creation based on feature flags. The additional packages are only added when subscriptions are enabled, which keeps dependencies minimal.


129-129: Simplified function signature

Removing the node parameter from the run method signature is consistent with the refactoring approach, as node operations have been moved to dedicated tasks.

packages/sync/src/test-runners/test-runner.ts (6)

17-26: Well-defined result interface for test runs

This interface clearly defines the shape of test runner results, including exports, outputs, and utility methods for retrieving file contents and post-write commands. This provides a good foundation for testing generator tasks.


28-39: Comprehensive test runner interface

The TaskTestRunner interface provides a clean API for running tasks with dependencies and optionally executing code on the generated providers. The Promise-based approach handles async operations appropriately.


41-45: Flexible options for test runner creation

The options interface allows for customization of task and generator identifiers, which is helpful for testing in different contexts.


47-61: Type-safe function signature for test runner creation

Good use of TypeScript generics to maintain type safety across the different maps involved in generator tasks. This ensures that the test runner will work correctly with various task configurations.


62-87: Properly executed task initialization and provider manipulation

The implementation correctly handles task execution, including initialization and running the provided function on the exported providers. The use of Promise.resolve() ensures proper handling of both synchronous and asynchronous operations.


88-104: Comprehensive result object with utility methods

The returned result object includes all necessary data from the task execution and provides utility methods for accessing file contents and post-write commands. The handling of binary file contents is particularly good.

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

4-7: Updated imports for task-based approach

These imports enable the new task-based approach and node configuration, replacing the direct node manipulation approach. The extractPackageVersions function is particularly useful for managing package versions from a central source.


20-22: Added imports for packages and typescript setup

The inclusion of FASTIFY_PACKAGES and the external fastifyTypescriptTask improves modularity by separating concerns and making the code more testable.


74-77: Updated dependency and configuration for ESM

The change from nodeSetupProvider to nodeConfigProvider and the updated method for setting ESM mode aligns with the new approach to configuration management.


81-97: Well-structured package and configuration setup

Using fastifyTypescriptTask and createNodeTask for setting up packages and node properties improves the organization of the code and makes it more testable. The task approach properly separates different aspects of node configuration.


110-110: Updated function signature to include taskId

Adding taskId to the function signature is important for tracking which task is making changes to shared resources, improving traceability and debugging capabilities.


149-156: Improved script management with mergeObj

Using node.scripts.mergeObj with a taskId provides better organization and tracking of script additions, making it easier to test and debug script configurations.

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

10-10: Updated import for config provider task

The change from createSetupTaskWithInfo to createConfigProviderTaskWithInfo represents an improvement in how configuration tasks are created and named.


35-35: Added import for package version extraction

The import of extractPackageVersions enables a more modular approach to managing package dependencies, aligning with the overall refactoring goals.


45-48: Updated imports for TypeScript code handling

The restructured imports improve readability by grouping related functionality and introducing the new writeJsonToBuilder function that simplifies JSON file creation.


51-51: Added import for node package task creation

This import enables the task-based approach for managing node packages, which is consistent with the refactoring pattern seen in other files.


152-166: Updated configuration provider creation

The change from createSetupTaskWithInfo to createConfigProviderTaskWithInfo and the rename of outputScope to configValuesScope provides more clarity about the purpose of these parameters.


242-244: Added task for TypeScript package management

The addition of createNodePackagesTask to handle the TypeScript development dependency is consistent with the task-based approach and improves testability.


251-251: Simplified function signature

Removing the node parameter from the run method signature aligns with the refactoring approach, as node operations have been moved to dedicated tasks.


335-345: Improved JSON file creation with dedicated function

Using the writeJsonToBuilder function instead of creating a custom action improves code consistency and readability. This approach is more declarative and easier to test.

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

25-25: New import for JSON writer looks good.
No issues in importing writeJsonToBuilder.


27-27: New import of nodeProvider is consistent with usage.
No concerns — confirmed usage at line 131.


131-131: Introduced taskId parameter for the task runner.
This ensures tasks can be identified or referenced consistently.


160-160: New build function structure.
Implementation aligns with the broader generator pattern. No immediate issues seen.


257-263: Refactored to add dev packages via node.packages.addDevPackages.
Modern usage of Object.fromEntries is clear. Good approach for dynamic plugin version handling.


264-270: Using node.scripts.mergeObj to add Prettier scripts.
This is consistent with the new script management approach. Looks good.


272-280: Replaced direct action with writeJsonToBuilder for Prettier config.
Writing to .prettierrc with plugin references is clean and maintainable.

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

8-8: Importing createNodePackagesTask.
No issues with adding this utility for package management.


10-10: Importing extractPackageVersions.
No concerns — used to slice out relevant package versions.


156-162: Introducing the createNodePackagesTask for Pothos deps.
Specifying Pothos packages under prod is correct, given these are runtime dependencies.


363-363: Renaming the task to generate-schema-script.
Adds clarity to the task name.


368-379: Added taskId parameter and using node.scripts.set.
This neatly registers the generate:schema script. Confirm that 'src/index.ts' path is correct for schema generation.

packages/core-generators/src/generators/node/node/node.generator.ts (10)

1-3: Type imports for generator tasks.
Straightforward usage of types from @halfdomelabs/sync and @halfdomelabs/utils.


4-14: Core imports for config and generator utilities.
These look appropriate and align with typical usage of @halfdomelabs/sync functions.


19-26: Importing Node & PNPM constants, project scope, and JSON writer.
All relevant references for Node config. No concerns.


28-38: Descriptor schema for Node project metadata.
Defining fields such as nodeVersion and pnpmVersion ensures easy customization. Consider validating exact semver strings.


40-55: nodePackageJsonFieldsSchema defining packages, scripts, and extra props.
Pattern ensures structured package.json management. Using preinstall script to enforce PNPM usage is neat.


57-69: NodeProvider interface.
Provides typed access to Node/ESM configuration. This helps keep project setup consistent.


71-86: createNodeTask helper function.
Allows modular extension of Node config. The approach to receive the provider and context is flexible.


88-104: createNodePackagesTask helper function.
Cleanly handles adding partial packages to Node’s dependency container. Straightforward usage.


106-111: Config provider for Node “isEsm” setting.
This approach is scalable if more Node config flags are needed.


114-189: nodeGenerator definition.
Generates package.json, manages post-write command for dependencies, sets up Node environment. Implementation is coherent and user-friendly.

packages/sync/src/utils/create-config-provider-task-with-info.ts (1)

94-107: Ensure safe merging of descriptor-derived info.
Consider the possibility that fields in infoFromDescriptor(descriptor) might inadvertently override keys within the config’s field map schema. If overriding is intentional, explicitly document this behavior and confirm it’s acceptable. Otherwise, you may want to namespace the descriptor-derived info to avoid collisions (e.g., store under an info: { ... } key).

packages/sync/src/utils/create-generator.ts (5)

17-22: Type flexibility is beneficial.
Allowing TaskConfigs to be a record of AnyGeneratorTask provides good extensibility for different generator tasks. This design effectively supports a variety of custom tasks without additional overhead.


73-79: Great extension of GeneratorBundleCreator.
This expanded type signature adds clarity and flexibility by incorporating TaskConfigs. It better captures the shape of a generator’s tasks.


98-101: Well-structured utility type.
InferTaskConfigsFromGenerator effectively extracts TaskConfigs from the GeneratorBundleCreator type. Coupled with InferDescriptorFromGenerator, these generics significantly improve type safety.


123-140: Robust duplicate task check.
Throwing an error on duplicate task names is a helpful safeguard that should prevent hidden collisions. This logic looks sound and ensures that tasks remain uniquely identified.


148-148: Good final assignment of tasks into the generator bundle.
By normalizing both array-based and object-based tasks into taskConfigs, you provide a consistent interface to the rest of the system.

packages/utils/src/field-map/field-map.ts (7)

1-7: Well-defined base interface.
Introducing FieldContainer<T> as a lightweight interface clarifies the contract for all container implementations, improving reusability and readability across different container types.


9-40: Prevent value overwrites with helpful error messages.
ScalarContainer enforces single-set semantics with a detailed error message if code attempts an overwrite. This design is excellent for defending against accidental reassignments.


72-110: Robust approach for ObjectContainer.
Storing key-value pairs alongside which source last set them is practical for config merges. The merge method is intuitive, although you might consider a blueprint method for merging deeply nested objects in future expansions.


113-158: Map merging is comprehensive.
MapContainer supports merges from both Map and Record, providing flexibility. The set-once logic is consistent with other containers.


201-206: Logical creation of ArrayContainer.
Passing initialValue and options directly into the constructor is a clean approach. The optional stripDuplicates is an excellent configuration detail.


214-222: Great convenience method for map initialization.
mapFromObj improves ergonomics by allowing direct object-to-map usage. It simplifies many common setup flows.


251-251: Efficient iteration for building values.
By iterating over each schema key and calling getValue(), createFieldMap remains consistent and type-safe. This approach unifies container-based logic with minimal overhead.

packages/core-generators/src/generators/node/node/package-dependencies-container.ts (7)

1-17: Well-structured type definitions and imports.

The type definitions for NodePackageDependencyType, NodePackageDependencyInfo, and NodePackageDependencies are clear and appropriate for managing package dependencies. The use of TypeScript interfaces provides good type safety for the container implementation.


21-28: Good implementation of the FieldContainer interface.

The class correctly implements the FieldContainer interface from the utils package and uses a private Map for efficient dependency storage. This makes lookups by package name O(1), which is ideal for dependency management.


43-57: Excellent semver compatibility logic.

The algorithm for determining version compatibility and selecting the most appropriate version is well-implemented:

  1. Keeps existing version if it's more specific or equal
  2. Uses new version if it's more specific than existing
  3. Throws an error for incompatible versions

This ensures consistent and reliable dependency management.


59-67: Appropriate type precedence handling.

Production dependencies correctly take precedence over development dependencies, which is the expected behavior since a package used in production should be treated as a production dependency even if also needed for development.


78-96: Well-implemented convenience methods for adding packages by type.

The addProdPackages and addDevPackages methods provide a clean API for bulk-adding dependencies of a specific type, improving the usability of the container class.


112-127: Clean implementation of getValue method.

The getValue method efficiently transforms the internal Map representation into the expected output format with separate dev and prod categories, using functional programming concepts. The use of a nested function for code reuse is elegant.


130-133: Useful helper function for container creation.

The createNodePackageDependenciesContainer factory function provides a convenient way to instantiate the container, which could be useful for dependency injection or when using the builder pattern mentioned in the comment.

scopes: [],
children: {},
tasks: [],
tasks: {},
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Change from array to object for tasks aligns with refactoring goal

This change from tasks: [] to tasks: {} represents a shift from an array-based to an object-based representation of tasks, which aligns with the overall PR objective of improving generator testing.

However, I noticed that the buildTestGeneratorEntry function (lines 65-76) still handles tasks as an array. Consider reviewing to ensure consistency across the codebase.


🏁 Script executed:

#!/bin/bash
# Check for other occurrences of task representations in the codebase
echo "Searching for task array vs object representations..."
rg -A 3 -B 3 "tasks: \[\]" --type ts
rg -A 3 -B 3 "tasks: {}" --type ts

Length of output: 799


Action Required: Align Task Representation in Generator Entry Function
The refactoring in packages/sync/src/runner/tests/factories.test-helper.ts now correctly sets tasks as an object (tasks: {}), which aligns with the overall PR goal. However, our search confirms that in packages/sync/src/runner/dependency-map.unit.test.ts (and specifically within the buildTestGeneratorEntry function, lines 65–76), tasks are still initialized as an array (tasks: []).

  • File Affected: packages/sync/src/runner/dependency-map.unit.test.ts
  • Issue: The use of an array for tasks conflicts with the recently refactored object-based approach.

Please update the buildTestGeneratorEntry function (or related test setup) to handle tasks as an object for consistency across the codebase.

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 (4)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (4)

5-16: Consider refining the dev/prod type representation.
The current union-based NodePackageDependencyType is concise. Optionally, you might consider a literal or enum approach if you foresee expansions (e.g., test, peer).


78-96: Reduce repetitive logic between addProdPackages and addDevPackages.
Both methods share a similar structure. Consider extracting the iteration logic into a helper or unifying them in a single method that accepts the dependency type.


98-110: Streamline addPackages if adding large sets.
Current approach is clear, but an optional single pass could reduce iteration overhead if you frequently add large dev and prod sets concurrently.


112-127: Optimize getValue for large dependency sets.
Constructing two filtered objects on every call can be slightly inefficient for very large sets. This is minor, so consider caching or storing the results if performance demands scale.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 14a7e39 and 570a282.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1 hunks)
  • packages/sync/src/utils/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/sync/src/utils/index.ts
🧰 Additional context used
🧬 Code Definitions (1)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (1)
packages/utils/src/field-map/field-map.ts (1)
  • FieldContainer (4-6)
🔇 Additional comments (4)
packages/core-generators/src/generators/node/node/package-dependencies-container.ts (4)

1-2: Ensure proper usage of type imports.
Using import type is a nice approach for tree-shaking in TypeScript. No issues detected here.


21-28: Implementation of FieldContainer looks solid.
Clear adherence to the FieldContainer interface. LGTM.


130-133: Helper function name is sufficiently descriptive.
Great addition for easier container creation. This fosters consistency in code usage.


30-76:

Details

❓ Verification inconclusive

Confirm semver merging behavior.
The approach of merging versions using semver.subset is advanced. Suggest verifying with sample inputs to ensure correct range resolution and error handling.


🏁 Script executed:

#!/bin/bash
# Verify semver merging logic with sample version inputs
# Expected: Each scenario merges or rejects versions as intended.
cat <<EOF > /tmp/versions.txt
1) "existing=^2.0.0" "new=^2.1.0"
2) "existing=~1.2.3" "new=^1.2.0"
3) "existing=2.0.0" "new=3.0.0"
4) "existing=^2.0.0" "new=3.0.0"
EOF

while read -r line; do
  echo "Testing scenario: $line"
  # Hypothetical check: refer to your test or harness that uses semver.subset
done < /tmp/versions.txt

Length of output: 526


Confirm semver merging behavior and add assertions to the test harness.

While the current test script executes and logs four sample scenarios, it only prints the test scenarios without asserting expected outcomes. Please ensure that:

  • For scenarios 1 and 2, the merged version is correctly determined (e.g., scenario 1 should retain the existing ^2.0.0 if it is a subset of the new ^2.1.0).
  • For scenarios 3 and 4, the function properly throws an error for incompatible ranges.
  • Consider updating the test harness to include explicit assertions that verify both the merged version outcomes and error messages, ensuring robust verification of the semver.subset logic.

@kingston kingston merged commit 73b0006 into main Apr 6, 2025
7 checks passed
@kingston kingston deleted the kingston/eng-604-create-a-testing-framework-for-baseplate-generators branch April 6, 2025 12:28
@github-actions github-actions bot mentioned this pull request Apr 6, 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