nx 23.0.0-beta.21 → 23.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/src/adapter/compat.d.ts +1 -1
  2. package/dist/src/adapter/compat.js +1 -0
  3. package/dist/src/command-line/examples.js +4 -4
  4. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +5 -0
  5. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +1 -0
  6. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +5 -0
  7. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +1 -0
  8. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +5 -0
  9. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +1 -0
  10. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +1 -0
  11. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +15 -0
  12. package/dist/src/command-line/migrate/agentic/run-step.d.ts +7 -0
  13. package/dist/src/command-line/migrate/agentic/run-step.js +3 -1
  14. package/dist/src/command-line/migrate/agentic/select.js +120 -32
  15. package/dist/src/command-line/migrate/command-object.d.ts +42 -0
  16. package/dist/src/command-line/migrate/command-object.js +37 -7
  17. package/dist/src/command-line/migrate/migrate-config.d.ts +27 -0
  18. package/dist/src/command-line/migrate/migrate-config.js +103 -0
  19. package/dist/src/command-line/migrate/migrate.d.ts +37 -2
  20. package/dist/src/command-line/migrate/migrate.js +97 -8
  21. package/dist/src/command-line/release/changelog/version-plan-filtering.d.ts +3 -1
  22. package/dist/src/command-line/release/changelog/version-plan-filtering.js +7 -3
  23. package/dist/src/command-line/release/changelog.d.ts +7 -0
  24. package/dist/src/command-line/release/changelog.js +22 -9
  25. package/dist/src/command-line/release/release.js +65 -55
  26. package/dist/src/command-line/release/utils/git.d.ts +6 -0
  27. package/dist/src/command-line/release/utils/git.js +33 -0
  28. package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +3 -2
  29. package/dist/src/command-line/release/version.d.ts +3 -0
  30. package/dist/src/command-line/release/version.js +13 -3
  31. package/dist/src/config/misc-interfaces.d.ts +8 -0
  32. package/dist/src/config/nx-json.d.ts +49 -0
  33. package/dist/src/core/graph/main.js +1 -1
  34. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  35. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  36. package/dist/src/plugins/js/lock-file/lock-file.d.ts +5 -0
  37. package/dist/src/plugins/js/lock-file/lock-file.js +34 -24
  38. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +2 -4
  39. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +121 -43
  40. package/dist/src/project-graph/file-utils.d.ts +7 -0
  41. package/dist/src/project-graph/file-utils.js +78 -10
  42. package/dist/src/tasks-runner/init-tasks-runner.d.ts +2 -2
  43. package/dist/src/tasks-runner/init-tasks-runner.js +6 -6
  44. package/dist/src/tasks-runner/task-orchestrator.d.ts +2 -2
  45. package/dist/src/tasks-runner/task-orchestrator.js +6 -6
  46. package/migrations.json +18 -9
  47. package/package.json +11 -11
  48. package/schemas/nx-schema.json +41 -0
@@ -15,11 +15,12 @@ isPrerelease, latestMatchingGitTag, releaseGraph, fallbackCurrentVersionResolver
15
15
  ? [projectGraphNode.name]
16
16
  : releaseGroup.projects;
17
17
  // latestMatchingGitTag will be undefined if the current version was resolved from the disk fallback.
18
- // In this case, we want to use the first commit as the ref to be consistent with the changelog command.
18
+ // In this case, use the first commit that touched this project rather than the repo's first commit,
19
+ // to avoid scanning the entire git history for projects that were added after the repo was created.
19
20
  const previousVersionRef = latestMatchingGitTag
20
21
  ? latestMatchingGitTag.tag
21
22
  : fallbackCurrentVersionResolver === 'disk'
22
- ? await (0, git_1.getFirstGitCommit)()
23
+ ? await (0, git_1.getFirstProjectCommit)(projectGraphNode.data.root)
23
24
  : undefined;
24
25
  if (!previousVersionRef) {
25
26
  // This should never happen since the checks above should catch if the current version couldn't be resolved
@@ -1,5 +1,7 @@
1
1
  import { NxReleaseConfiguration } from '../../config/nx-json';
2
+ import type { ProjectGraph } from '../../config/project-graph';
2
3
  import { VersionOptions } from './command-object';
4
+ import { type NxReleaseConfig } from './config/config';
3
5
  import { ReleaseGraph } from './utils/release-graph';
4
6
  import { VersionData } from './utils/shared';
5
7
  export interface NxReleaseVersionResult {
@@ -23,3 +25,4 @@ export interface NxReleaseVersionResult {
23
25
  }
24
26
  export declare const releaseVersionCLIHandler: (args: VersionOptions) => Promise<number>;
25
27
  export declare function createAPI(overrideReleaseConfig: NxReleaseConfiguration, ignoreNxJsonConfig: boolean): (args: VersionOptions) => Promise<NxReleaseVersionResult>;
28
+ export declare function hasDockerReleaseConfiguration(nxReleaseConfig: NxReleaseConfig, releaseGraph: ReleaseGraph, projectGraph: ProjectGraph): boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseVersionCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
+ exports.hasDockerReleaseConfiguration = hasDockerReleaseConfiguration;
5
6
  const tslib_1 = require("tslib");
6
7
  const pc = tslib_1.__importStar(require("picocolors"));
7
8
  const node_child_process_1 = require("node:child_process");
@@ -212,17 +213,17 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
212
213
  }, releaseGroup, true);
213
214
  }
214
215
  }
216
+ const shouldProcessDockerProjects = hasDockerReleaseConfiguration(nxReleaseConfig, releaseGraph, projectGraph);
215
217
  // TODO(colum): Remove when Docker support is no longer experimental
216
- if (nxReleaseConfig.docker ||
217
- releaseGraph.releaseGroups.some((rg) => rg.docker)) {
218
+ if (shouldProcessDockerProjects) {
218
219
  output_1.output.warn({
219
220
  title: 'Warning',
220
221
  bodyLines: [
221
222
  `Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.`,
222
223
  ],
223
224
  });
225
+ await processor.processDockerProjects(args.dockerVersionScheme, args.dockerVersion);
224
226
  }
225
- await processor.processDockerProjects(args.dockerVersionScheme, args.dockerVersion);
226
227
  const versionData = processor.getVersionData();
227
228
  // Resolve any git tags as early as possible so that we can hard error in case of any duplicates before reaching the actual git command
228
229
  const gitTagValues = (args.gitTag ?? nxReleaseConfig.version.git.tag)
@@ -298,6 +299,15 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
298
299
  };
299
300
  };
300
301
  }
302
+ function hasDockerReleaseConfiguration(nxReleaseConfig, releaseGraph, projectGraph) {
303
+ if (nxReleaseConfig.docker) {
304
+ return true;
305
+ }
306
+ if (releaseGraph.releaseGroups.some((rg) => rg.docker)) {
307
+ return true;
308
+ }
309
+ return Array.from(releaseGraph.allProjectsToProcess).some((projectName) => projectGraph.nodes[projectName]?.data.release?.docker !== undefined);
310
+ }
301
311
  function printAndFlushChanges(tree, isDryRun) {
302
312
  const changes = tree.listChanges();
303
313
  console.log('');
@@ -84,6 +84,13 @@ export interface MigrationsJsonEntry {
84
84
  factory?: string;
85
85
  prompt?: string;
86
86
  requires?: Record<string, string>;
87
+ /**
88
+ * Path to a markdown doc describing the migration, relative to the
89
+ * `migrations.json` and resolved like `implementation`/`factory`. Always
90
+ * supplementary; never stands in for them. Under `--run-migrations
91
+ * --agentic` the resolved path is passed to the agent as extra context.
92
+ */
93
+ documentation?: string;
87
94
  }
88
95
  export type MigrationDetailsWithId = GeneratedMigrationDetails & {
89
96
  id: string;
@@ -95,6 +102,7 @@ export interface GeneratedMigrationDetails {
95
102
  description: string;
96
103
  implementation?: string;
97
104
  prompt?: string;
105
+ documentation?: string;
98
106
  }
99
107
  export interface MigrationsJson {
100
108
  name?: string;
@@ -1,6 +1,8 @@
1
1
  import type ChangelogRenderer from '../../release/changelog-renderer';
2
2
  import type { ChangelogRenderOptions } from '../../release/changelog-renderer';
3
3
  import type { validReleaseVersionPrefixes } from '../command-line/release/utils/release-graph';
4
+ import type { AgentId } from '../command-line/migrate/agentic/cli-args';
5
+ import type { MigrateMode, MultiMajorMode } from '../command-line/migrate/command-object';
4
6
  import type { PackageManager } from '../utils/package-manager';
5
7
  import type { InputDefinition, TargetConfiguration, TargetDependencyConfig } from './workspace-json-project-json';
6
8
  export type ImplicitDependencyEntry<T = '*' | string[]> = {
@@ -651,6 +653,49 @@ export interface NxSyncConfiguration {
651
653
  */
652
654
  disabledTaskSyncGenerators?: string[];
653
655
  }
656
+ export interface NxMigrateConfiguration {
657
+ /**
658
+ * Whether to automatically create a git commit after each migration runs.
659
+ * Equivalent to the `--create-commits` flag. Defaults to `false`.
660
+ */
661
+ createCommits?: boolean;
662
+ /**
663
+ * Commit message prefix applied to each migration commit when commits are
664
+ * enabled (via `createCommits` or `--create-commits`). Equivalent to the
665
+ * `--commit-prefix` flag. Defaults to `"chore: [nx migration] "`.
666
+ */
667
+ commitPrefix?: string;
668
+ /**
669
+ * Restricts which packages to migrate when migrating Nx itself. Equivalent to
670
+ * the `--mode` flag.
671
+ * - `first-party`: only Nx and its plugins.
672
+ * - `third-party`: only the third-party dependencies referenced by Nx.
673
+ * - `all`: everything (default).
674
+ */
675
+ mode?: MigrateMode;
676
+ /**
677
+ * How to handle a migration that crosses more than one major version.
678
+ * Equivalent to the `--multi-major-mode` flag. The `NX_MULTI_MAJOR_MODE`
679
+ * environment variable takes precedence over this setting.
680
+ * - `direct`: migrate straight to the requested target.
681
+ * - `gradual`: migrate to the smallest recommended step.
682
+ */
683
+ multiMajorMode?: MultiMajorMode;
684
+ /**
685
+ * Default for the agentic flow used by `nx migrate --run-migrations`.
686
+ * Equivalent to the `--agentic` flag.
687
+ * - `false`: never use the agentic flow.
688
+ * - `true`: use the agentic flow and resolve the installed agent.
689
+ * - an agent id (`"claude-code"`, `"codex"`, `"opencode"`): always use that agent.
690
+ */
691
+ agentic?: boolean | AgentId;
692
+ /**
693
+ * Whether to run agent-driven validation after generator-only migrations when
694
+ * the agentic flow is enabled. Equivalent to the `--validate` flag. Defaults
695
+ * to `true` when the agentic flow is enabled.
696
+ */
697
+ validate?: boolean;
698
+ }
654
699
  /**
655
700
  * Nx.json configuration
656
701
  *
@@ -810,6 +855,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
810
855
  * Configuration for the `nx sync` command.
811
856
  */
812
857
  sync?: NxSyncConfiguration;
858
+ /**
859
+ * Configuration for the `nx migrate` command.
860
+ */
861
+ migrate?: NxMigrateConfiguration;
813
862
  /**
814
863
  * Sets the maximum size of the local cache. Accepts a number followed by a unit (e.g. 100MB). Accepted units are B, KB, MB, and GB.
815
864
  */