发布

  • feat(misc): convert prompt generator migrations to use prompt field (#35688)

    frostbyte_neo 发布于 2026-05-19 19:38:08 +00:00

    Current Behavior

    AI-instructions migrations in @nx/next, @nx/expo, @nx/nuxt,
    @nx/vite, @nx/vitest, and @nx/storybook are implemented as
    generator wrappers whose only purpose is to copy a bundled .md file
    into the workspace's tools/ai-migrations/ directory.

    Expected Behavior

    These migration entries declare a prompt field pointing directly at
    the .md source. nx migrate collects the prompt files into the
    workspace and surfaces a review banner, replacing the per-package
    generator wrappers. The @nx/storybook migration becomes a hybrid
    implementation + prompt entry (the implementation still runs sb upgrade).

    Implementation Details

    • @nx/next, @nx/expo, @nx/nuxt, @nx/vite (x2), @nx/vitest
      (x2)
      : 7 entries switched from implementation/factory to prompt;
      the 6 corresponding wrapper .ts files removed; the bundled .md files
      moved out of each migration's files/ subdirectory (a convention
      required only by the deleted wrappers' __dirname/files/... reads).
    • @nx/nuxt, @nx/vitest: added a migrations.spec.ts so their
      migration entries are covered by assertValidMigrationPaths. Removed
      stale orphans surfaced by the new nuxt spec: src/migrations/.gitkeep
      and src/migrations/update-18-1-0/add-include-tsconfig.{ts,spec.ts}
      (orphaned by an earlier pre-v19 migrations cleanup).
    • @nx/storybook: update-22-1-0-migrate-storybook-v10 becomes a
      hybrid implementation + prompt entry. The migrate-10 generator gains
      a skipAiInstructions schema property; the migration wrapper passes
      skipAiInstructions: true to avoid duplicating the prompt write (the
      framework now writes it to the managed
      tools/ai-migrations/<scope>/<package>/<version>-<basename>.md path).
      Standalone nx g @nx/storybook:migrate-10 invocations are unaffected
      and still write the legacy tools/ai-migrations/MIGRATE_STORYBOOK_10.md
      file.
    • assertValidMigrationPaths (in
      @nx/devkit/internal-testing-utils): updated to handle prompt-only
      entries — per-entry validation asserts the referenced .md exists, and
      the "all folders" check collects known dirs from both impl and
      prompt paths.
    • Lint coverage parity: @nx/nuxt, @nx/vite, @nx/vitest eslint
      configs now include ./migrations.json in the files block for
      @nx/nx-plugin-checks, matching @nx/next / @nx/expo /
      @nx/storybook.

    Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>

    下载附件