nx 21.0.0-canary.20250423-16fc551 → 21.0.0-canary.20250425-ee097a8

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 (60) hide show
  1. package/migrations.json +5 -0
  2. package/package.json +11 -11
  3. package/schemas/nx-schema.json +34 -38
  4. package/schemas/project-schema.json +5 -0
  5. package/src/command-line/init/configure-plugins.js +5 -3
  6. package/src/command-line/init/implementation/utils.d.ts +2 -1
  7. package/src/command-line/init/implementation/utils.js +2 -1
  8. package/src/command-line/init/init-v2.js +8 -7
  9. package/src/command-line/release/command-object.d.ts +6 -0
  10. package/src/command-line/release/config/config.js +15 -8
  11. package/src/command-line/release/config/use-legacy-versioning.js +4 -4
  12. package/src/command-line/release/version/release-group-processor.d.ts +10 -9
  13. package/src/command-line/release/version/release-group-processor.js +17 -8
  14. package/src/command-line/release/version/test-utils.d.ts +2 -4
  15. package/src/command-line/release/version/test-utils.js +13 -14
  16. package/src/command-line/release/version/version-actions.d.ts +9 -8
  17. package/src/command-line/release/version/version-actions.js +21 -9
  18. package/src/command-line/release/version.js +6 -2
  19. package/src/command-line/run/executor-utils.d.ts +6 -1
  20. package/src/command-line/run/executor-utils.js +10 -1
  21. package/src/command-line/run/run.js +1 -1
  22. package/src/config/misc-interfaces.d.ts +1 -0
  23. package/src/config/nx-json.d.ts +15 -9
  24. package/src/config/workspace-json-project-json.d.ts +2 -2
  25. package/src/core/graph/main.js +1 -1
  26. package/src/core/graph/styles.css +1 -1
  27. package/src/devkit-internals.d.ts +1 -1
  28. package/src/devkit-internals.js +2 -1
  29. package/src/executors/run-commands/run-commands.impl.d.ts +1 -2
  30. package/src/executors/run-commands/run-commands.impl.js +1 -1
  31. package/src/executors/run-commands/running-tasks.d.ts +5 -2
  32. package/src/executors/run-commands/running-tasks.js +42 -6
  33. package/src/migrations/update-21-0-0/release-version-config-changes.d.ts +2 -0
  34. package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
  35. package/src/native/index.d.ts +2 -0
  36. package/src/native/nx.wasm32-wasi.wasm +0 -0
  37. package/src/plugins/package-json/create-nodes.js +1 -1
  38. package/src/project-graph/plugins/public-api.d.ts +1 -1
  39. package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
  40. package/src/project-graph/utils/project-configuration-utils.js +29 -10
  41. package/src/tasks-runner/batch/run-batch.js +1 -1
  42. package/src/tasks-runner/create-task-graph.d.ts +0 -1
  43. package/src/tasks-runner/create-task-graph.js +0 -1
  44. package/src/tasks-runner/init-tasks-runner.d.ts +1 -1
  45. package/src/tasks-runner/init-tasks-runner.js +8 -2
  46. package/src/tasks-runner/life-cycle.d.ts +4 -0
  47. package/src/tasks-runner/life-cycle.js +14 -0
  48. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
  49. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +8 -5
  50. package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
  51. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +29 -4
  52. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +2 -0
  53. package/src/tasks-runner/run-command.d.ts +1 -0
  54. package/src/tasks-runner/run-command.js +4 -6
  55. package/src/tasks-runner/running-tasks/running-task.d.ts +1 -0
  56. package/src/tasks-runner/task-orchestrator.d.ts +2 -1
  57. package/src/tasks-runner/task-orchestrator.js +31 -12
  58. package/src/tasks-runner/utils.js +3 -1
  59. package/src/utils/package-json.d.ts +1 -1
  60. package/src/utils/package-json.js +16 -2
package/migrations.json CHANGED
@@ -63,6 +63,11 @@
63
63
  "description": "Set `useLegacyCache` to true for migrating workspaces",
64
64
  "implementation": "./src/migrations/update-20-0-1/use-legacy-cache",
65
65
  "x-repair-skip": true
66
+ },
67
+ "release-version-config-changes": {
68
+ "version": "21.0.0-beta.1",
69
+ "description": "Updates release version config based on the breaking changes in Nx v21",
70
+ "implementation": "./src/migrations/update-21-0-0/release-version-config-changes"
66
71
  }
67
72
  }
68
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.0.0-canary.20250423-16fc551",
3
+ "version": "21.0.0-canary.20250425-ee097a8",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.0.0-canary.20250423-16fc551",
87
- "@nx/nx-darwin-x64": "21.0.0-canary.20250423-16fc551",
88
- "@nx/nx-freebsd-x64": "21.0.0-canary.20250423-16fc551",
89
- "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250423-16fc551",
90
- "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250423-16fc551",
91
- "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250423-16fc551",
92
- "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250423-16fc551",
93
- "@nx/nx-linux-x64-musl": "21.0.0-canary.20250423-16fc551",
94
- "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250423-16fc551",
95
- "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250423-16fc551"
86
+ "@nx/nx-darwin-arm64": "21.0.0-canary.20250425-ee097a8",
87
+ "@nx/nx-darwin-x64": "21.0.0-canary.20250425-ee097a8",
88
+ "@nx/nx-freebsd-x64": "21.0.0-canary.20250425-ee097a8",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250425-ee097a8",
90
+ "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250425-ee097a8",
91
+ "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250425-ee097a8",
92
+ "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250425-ee097a8",
93
+ "@nx/nx-linux-x64-musl": "21.0.0-canary.20250425-ee097a8",
94
+ "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250425-ee097a8",
95
+ "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250425-ee097a8"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -707,49 +707,17 @@
707
707
  "$comment": "When using the latest versioning implementation a lot of configuration has been able to move directly onto the version property.",
708
708
  "properties": {
709
709
  "useLegacyVersioning": {
710
- "const": true
710
+ "const": false
711
711
  }
712
712
  }
713
713
  },
714
714
  "then": {
715
- "properties": {
716
- "useLegacyVersioning": {
717
- "type": "boolean",
718
- "description": "Whether to use the legacy versioning strategy. This value will be true in Nx v20 and false in Nx v21. The legacy versioning implementation will be removed in Nx v22, as will this flag.",
719
- "default": true
720
- },
721
- "conventionalCommits": {
722
- "type": "boolean",
723
- "description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
724
- "default": false
725
- },
726
- "git": {
727
- "$ref": "#/definitions/NxReleaseGitConfiguration"
728
- },
729
- "preVersionCommand": {
730
- "type": "string",
731
- "description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
732
- },
733
- "generator": {
734
- "type": "string",
735
- "description": "The generator implementation to use for versioning.",
736
- "default": "@nx/js:release-version"
737
- },
738
- "generatorOptions": {
739
- "type": "object",
740
- "description": "These options will be passed to the configured \"release.version.generator\" (which will be \"@nx/js:release-version\" if not set explicitly).",
741
- "additionalProperties": true
742
- }
743
- },
744
- "additionalProperties": false
745
- },
746
- "else": {
747
715
  "additionalProperties": false,
748
716
  "properties": {
749
717
  "useLegacyVersioning": {
750
718
  "type": "boolean",
751
719
  "description": "Whether to use the legacy versioning strategy. This value will be true in Nx v20 and false in Nx v21. The legacy versioning implementation will be removed in Nx v22, as will this flag.",
752
- "default": true
720
+ "default": false
753
721
  },
754
722
  "conventionalCommits": {
755
723
  "type": "boolean",
@@ -791,10 +759,6 @@
791
759
  "enum": ["disk"],
792
760
  "description": "The fallback version resolver to use when the configured currentVersionResolver fails to resolve the current version."
793
761
  },
794
- "firstRelease": {
795
- "type": "boolean",
796
- "description": "Whether or not this is the first release of one of more projects. This removes certain validation checks that are not possible to enforce if the project has never been released before."
797
- },
798
762
  "versionPrefix": {
799
763
  "type": "string",
800
764
  "enum": ["auto", "", "~", "^", "="],
@@ -833,6 +797,38 @@
833
797
  "additionalProperties": true
834
798
  }
835
799
  }
800
+ },
801
+ "else": {
802
+ "properties": {
803
+ "useLegacyVersioning": {
804
+ "type": "boolean",
805
+ "description": "Whether to use the legacy versioning strategy. This value was true in Nx v20 and became false in Nx v21. The legacy versioning implementation will be removed in Nx v22, as will this flag.",
806
+ "default": false
807
+ },
808
+ "conventionalCommits": {
809
+ "type": "boolean",
810
+ "description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
811
+ "default": false
812
+ },
813
+ "git": {
814
+ "$ref": "#/definitions/NxReleaseGitConfiguration"
815
+ },
816
+ "preVersionCommand": {
817
+ "type": "string",
818
+ "description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
819
+ },
820
+ "generator": {
821
+ "type": "string",
822
+ "description": "The generator implementation to use for versioning.",
823
+ "default": "@nx/js:release-version"
824
+ },
825
+ "generatorOptions": {
826
+ "type": "object",
827
+ "description": "These options will be passed to the configured \"release.version.generator\" (which will be \"@nx/js:release-version\" if not set explicitly).",
828
+ "additionalProperties": true
829
+ }
830
+ },
831
+ "additionalProperties": false
836
832
  }
837
833
  },
838
834
  "NxReleaseGroupVersionConfiguration": {
@@ -138,6 +138,11 @@
138
138
  "type": "boolean",
139
139
  "description": "Specifies if the given target should be cacheable"
140
140
  },
141
+ "continuous": {
142
+ "type": "boolean",
143
+ "default": false,
144
+ "description": "Whether this target runs continuously until stopped"
145
+ },
141
146
  "parallelism": {
142
147
  "type": "boolean",
143
148
  "default": true,
@@ -65,9 +65,11 @@ async function runPluginInitGenerator(plugin, repoRoot = workspace_root_1.worksp
65
65
  }
66
66
  catch {
67
67
  // init generator does not exist, so this function should noop
68
- output_1.output.log({
69
- title: `No "init" generator found in ${plugin}. Skipping initialization.`,
70
- });
68
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
69
+ output_1.output.log({
70
+ title: `No "init" generator found in ${plugin}. Skipping initialization.`,
71
+ });
72
+ }
71
73
  return;
72
74
  }
73
75
  }
@@ -12,8 +12,9 @@ export declare function initCloud(installationSource: 'nx-init' | 'nx-init-angul
12
12
  export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void;
13
13
  export declare function markRootPackageJsonAsNxProjectLegacy(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void;
14
14
  export declare function markPackageJsonAsNxProject(packageJsonPath: string): void;
15
- export declare function printFinalMessage({ learnMoreLink, }: {
15
+ export declare function printFinalMessage({ learnMoreLink, appendLines, }: {
16
16
  learnMoreLink?: string;
17
+ appendLines?: string[];
17
18
  }): void;
18
19
  export declare function isMonorepo(packageJson: PackageJson): boolean;
19
20
  export declare function isCRA(packageJson: PackageJson): boolean;
@@ -248,7 +248,7 @@ function markPackageJsonAsNxProject(packageJsonPath) {
248
248
  json.nx = {};
249
249
  (0, fileutils_1.writeJsonFile)(packageJsonPath, json);
250
250
  }
251
- function printFinalMessage({ learnMoreLink, }) {
251
+ function printFinalMessage({ learnMoreLink, appendLines, }) {
252
252
  const pmc = (0, package_manager_1.getPackageManagerCommand)();
253
253
  output_1.output.success({
254
254
  title: '🎉 Done!',
@@ -256,6 +256,7 @@ function printFinalMessage({ learnMoreLink, }) {
256
256
  `- Run "${(0, child_process_2.getRunNxBaseCommand)(pmc)} run-many -t build" to run the build target for every project in the workspace. Run it again to replay the cached computation. https://nx.dev/features/cache-task-results`,
257
257
  `- Run "${(0, child_process_2.getRunNxBaseCommand)(pmc)} graph" to see the graph of projects and tasks in your workspace. https://nx.dev/core-features/explore-graph`,
258
258
  learnMoreLink ? `- Learn more at ${learnMoreLink}.` : undefined,
259
+ ...(appendLines ?? []),
259
260
  ].filter(Boolean),
260
261
  });
261
262
  }
@@ -45,11 +45,6 @@ async function initHandler(options) {
45
45
  const _isTurborepo = (0, fs_1.existsSync)('turbo.json');
46
46
  const _isMonorepo = _isNonJs ? false : (0, utils_1.isMonorepo)(packageJson);
47
47
  const _isCRA = _isNonJs ? false : (0, utils_1.isCRA)(packageJson);
48
- const learnMoreLink = _isTurborepo
49
- ? 'https://nx.dev/recipes/adopting-nx/from-turborepo'
50
- : _isMonorepo
51
- ? 'https://nx.dev/getting-started/tutorials/npm-workspaces-tutorial'
52
- : 'https://nx.dev/recipes/adopting-nx/adding-to-existing-project';
53
48
  /**
54
49
  * Turborepo users must have set up individual scripts already, and we keep the transition as minimal as possible.
55
50
  * We log a message during the conversion process in addNxToTurborepo about how they can learn more about the power
@@ -61,7 +56,7 @@ async function initHandler(options) {
61
56
  interactive: options.interactive,
62
57
  });
63
58
  (0, utils_1.printFinalMessage)({
64
- learnMoreLink,
59
+ learnMoreLink: 'https://nx.dev/recipes/adopting-nx/from-turborepo',
65
60
  });
66
61
  return;
67
62
  }
@@ -118,7 +113,13 @@ async function initHandler(options) {
118
113
  await (0, utils_1.initCloud)('nx-init');
119
114
  }
120
115
  (0, utils_1.printFinalMessage)({
121
- learnMoreLink,
116
+ appendLines: _isMonorepo
117
+ ? [
118
+ `- Learn how Nx helps manage your TypeScript monorepo at https://nx.dev/features/maintain-ts-monorepos.`,
119
+ ]
120
+ : [
121
+ `- Learn how Nx works with any type of project at https://nx.dev/recipes/adopting-nx/adding-to-existing-project.`,
122
+ ],
122
123
  });
123
124
  }
124
125
  const npmPackageToPluginMap = {
@@ -26,7 +26,13 @@ export type VersionOptions = NxReleaseArgs & GitOptions & VersionPlanArgs & Firs
26
26
  specifier?: string;
27
27
  preid?: string;
28
28
  stageChanges?: boolean;
29
+ /**
30
+ * @deprecated Use versionActionsOptionsOverrides instead.
31
+ *
32
+ * Using generatorOptionsOverrides is only valid when release.version.useLegacyVersioning is set to true.
33
+ */
29
34
  generatorOptionsOverrides?: Record<string, unknown>;
35
+ versionActionsOptionsOverrides?: Record<string, unknown>;
30
36
  };
31
37
  export type ChangelogOptions = NxReleaseArgs & GitOptions & VersionPlanArgs & FirstReleaseArgs & {
32
38
  version?: string | null;
@@ -151,9 +151,12 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
151
151
  versionActionsOptions: {},
152
152
  currentVersionResolver: defaultGeneratorOptions.currentVersionResolver,
153
153
  specifierSource: defaultGeneratorOptions.specifierSource,
154
- preserveLocalDependencyProtocols: userConfig.version?.preserveLocalDependencyProtocols ?? true,
155
- logUnchangedProjects: userConfig.version?.logUnchangedProjects ?? true,
156
- updateDependents: userConfig.version?.updateDependents ?? 'auto',
154
+ preserveLocalDependencyProtocols: userConfig.version
155
+ ?.preserveLocalDependencyProtocols ?? true,
156
+ logUnchangedProjects: userConfig.version
157
+ ?.logUnchangedProjects ?? true,
158
+ updateDependents: userConfig.version
159
+ ?.updateDependents ?? 'auto',
157
160
  }),
158
161
  },
159
162
  changelog: {
@@ -438,8 +441,11 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
438
441
  }
439
442
  if (releaseGroup.version?.conventionalCommits === false &&
440
443
  releaseGroupName !== exports.IMPLICIT_DEFAULT_RELEASE_GROUP) {
441
- delete finalReleaseGroup.version.generatorOptions.currentVersionResolver;
442
- delete finalReleaseGroup.version.generatorOptions.specifierSource;
444
+ if (USE_LEGACY_VERSIONING) {
445
+ delete finalReleaseGroup.version.generatorOptions
446
+ ?.currentVersionResolver;
447
+ delete finalReleaseGroup.version.generatorOptions?.specifierSource;
448
+ }
443
449
  delete finalReleaseGroup.version
444
450
  .currentVersionResolver;
445
451
  delete finalReleaseGroup.version
@@ -462,7 +468,9 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
462
468
  }
463
469
  if (releaseGroup.versionPlans === false &&
464
470
  releaseGroupName !== exports.IMPLICIT_DEFAULT_RELEASE_GROUP) {
465
- delete finalReleaseGroup.version.generatorOptions.specifierSource;
471
+ if (USE_LEGACY_VERSIONING) {
472
+ delete finalReleaseGroup.version.generatorOptions?.specifierSource;
473
+ }
466
474
  delete finalReleaseGroup.version
467
475
  .specifierSource;
468
476
  }
@@ -796,8 +804,7 @@ function hasInvalidConventionalCommitsConfig(userConfig) {
796
804
  // v2 config - directly on version config
797
805
  (userConfig.version
798
806
  ?.currentVersionResolver ||
799
- userConfig.version
800
- ?.specifierSource ||
807
+ userConfig.version?.specifierSource ||
801
808
  // Legacy config - on generatorOptions
802
809
  userConfig.version
803
810
  ?.generatorOptions?.currentVersionResolver ||
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldUseLegacyVersioning = shouldUseLegacyVersioning;
4
+ // TODO(v22): remove this function and entire concept of legacy versioning in v22
4
5
  function shouldUseLegacyVersioning(releaseConfig) {
5
- return process.env.NX_INTERNAL_USE_LEGACY_VERSIONING === 'false'
6
- ? false
7
- : // TODO(v21): switch this to false by default in Nx v21 and remove this function in v22
8
- releaseConfig?.version?.useLegacyVersioning ?? true;
6
+ return process.env.NX_INTERNAL_USE_LEGACY_VERSIONING === 'true'
7
+ ? true
8
+ : releaseConfig?.version?.useLegacyVersioning ?? false;
9
9
  }
@@ -1,4 +1,4 @@
1
- import { NxReleaseVersionV2Configuration } from '../../../config/nx-json';
1
+ import { ManifestRootToUpdate, NxReleaseVersionConfiguration } from '../../../config/nx-json';
2
2
  import { ProjectGraph } from '../../../config/project-graph';
3
3
  import { Tree } from '../../../generators/tree';
4
4
  import { type NxReleaseConfig } from '../config/config';
@@ -10,14 +10,14 @@ import type { VersionData } from '../utils/shared';
10
10
  * and referenced throughout the versioning process.
11
11
  */
12
12
  export interface FinalConfigForProject {
13
- specifierSource: NxReleaseVersionV2Configuration['specifierSource'];
14
- currentVersionResolver: NxReleaseVersionV2Configuration['currentVersionResolver'];
15
- currentVersionResolverMetadata: NxReleaseVersionV2Configuration['currentVersionResolverMetadata'];
16
- fallbackCurrentVersionResolver: NxReleaseVersionV2Configuration['fallbackCurrentVersionResolver'];
17
- versionPrefix: NxReleaseVersionV2Configuration['versionPrefix'];
18
- preserveLocalDependencyProtocols: NxReleaseVersionV2Configuration['preserveLocalDependencyProtocols'];
19
- versionActionsOptions: NxReleaseVersionV2Configuration['versionActionsOptions'];
20
- manifestRootsToUpdate: NxReleaseVersionV2Configuration['manifestRootsToUpdate'];
13
+ specifierSource: NxReleaseVersionConfiguration['specifierSource'];
14
+ currentVersionResolver: NxReleaseVersionConfiguration['currentVersionResolver'];
15
+ currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata'];
16
+ fallbackCurrentVersionResolver: NxReleaseVersionConfiguration['fallbackCurrentVersionResolver'];
17
+ versionPrefix: NxReleaseVersionConfiguration['versionPrefix'];
18
+ preserveLocalDependencyProtocols: NxReleaseVersionConfiguration['preserveLocalDependencyProtocols'];
19
+ versionActionsOptions: NxReleaseVersionConfiguration['versionActionsOptions'];
20
+ manifestRootsToUpdate: Array<Exclude<ManifestRootToUpdate, string>>;
21
21
  }
22
22
  export declare const BUMP_TYPE_REASON_TEXT: {
23
23
  readonly DEPENDENCY_WAS_BUMPED: ", because a dependency was bumped, ";
@@ -44,6 +44,7 @@ interface ReleaseGroupProcessorOptions {
44
44
  projects?: string[];
45
45
  groups?: string[];
46
46
  };
47
+ versionActionsOptionsOverrides?: Record<string, unknown>;
47
48
  }
48
49
  export declare class ReleaseGroupProcessor {
49
50
  private tree;
@@ -775,12 +775,26 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
775
775
  /**
776
776
  * versionActionsOptions, defaults to {}
777
777
  */
778
- const versionActionsOptions = projectVersionConfig?.versionActionsOptions ??
778
+ let versionActionsOptions = projectVersionConfig?.versionActionsOptions ??
779
779
  releaseGroupVersionConfig?.versionActionsOptions ??
780
780
  {};
781
- const manifestRootsToUpdate = projectVersionConfig?.manifestRootsToUpdate ??
781
+ // Apply any optional overrides that may be passed in from the programmatic API
782
+ versionActionsOptions = {
783
+ ...versionActionsOptions,
784
+ ...(this.options.versionActionsOptionsOverrides ?? {}),
785
+ };
786
+ const manifestRootsToUpdate = (projectVersionConfig?.manifestRootsToUpdate ??
782
787
  releaseGroupVersionConfig?.manifestRootsToUpdate ??
783
- [];
788
+ []).map((manifestRoot) => {
789
+ if (typeof manifestRoot === 'string') {
790
+ return {
791
+ path: manifestRoot,
792
+ // Apply the project level preserveLocalDependencyProtocols setting that was already resolved
793
+ preserveLocalDependencyProtocols,
794
+ };
795
+ }
796
+ return manifestRoot;
797
+ });
784
798
  return {
785
799
  specifierSource,
786
800
  currentVersionResolver,
@@ -818,11 +832,6 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
818
832
  if (!currentDependencyVersion) {
819
833
  continue;
820
834
  }
821
- // If preserveLocalDependencyProtocols is true, and the dependency uses a local dependency protocol, skip updating the dependency
822
- if (cachedFinalConfigForProject.preserveLocalDependencyProtocols &&
823
- (await versionActions.isLocalDependencyProtocol(currentDependencyVersion))) {
824
- continue;
825
- }
826
835
  let finalPrefix = '';
827
836
  if (cachedFinalConfigForProject.versionPrefix === 'auto') {
828
837
  const prefixMatch = currentDependencyVersion?.match(/^([~^=])/);
@@ -1,4 +1,4 @@
1
- import type { NxJsonConfiguration, NxReleaseVersionV2Configuration } from '../../../config/nx-json';
1
+ import type { NxJsonConfiguration, NxReleaseVersionConfiguration } from '../../../config/nx-json';
2
2
  import type { ProjectGraph } from '../../../config/project-graph';
3
3
  import type { Tree } from '../../../generators/tree';
4
4
  import { NxReleaseConfig } from '../config/config';
@@ -48,7 +48,7 @@ export declare class ExampleRustVersionActions extends VersionActions {
48
48
  currentVersion: string;
49
49
  manifestPath: string;
50
50
  }>;
51
- readCurrentVersionFromRegistry(tree: Tree, _currentVersionResolverMetadata: NxReleaseVersionV2Configuration['currentVersionResolverMetadata']): Promise<{
51
+ readCurrentVersionFromRegistry(tree: Tree, _currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata']): Promise<{
52
52
  currentVersion: string;
53
53
  logText: string;
54
54
  }>;
@@ -57,7 +57,6 @@ export declare class ExampleRustVersionActions extends VersionActions {
57
57
  currentVersion: string;
58
58
  dependencyCollection: string;
59
59
  }>;
60
- isLocalDependencyProtocol(_versionSpecifier: string): Promise<boolean>;
61
60
  updateProjectDependencies(tree: Tree, _projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>): Promise<string[]>;
62
61
  }
63
62
  export declare class ExampleNonSemverVersionActions extends VersionActions {
@@ -68,7 +67,6 @@ export declare class ExampleNonSemverVersionActions extends VersionActions {
68
67
  currentVersion: any;
69
68
  dependencyCollection: any;
70
69
  }>;
71
- isLocalDependencyProtocol(): Promise<boolean>;
72
70
  updateProjectVersion(tree: any, newVersion: any): Promise<any[]>;
73
71
  updateProjectDependencies(): Promise<any[]>;
74
72
  calculateNewVersion(currentVersion: string | null, newVersionInput: string, newVersionInputReason: string, newVersionInputReasonData: Record<string, unknown>, preid: string): Promise<{
@@ -91,13 +91,15 @@ class ExampleRustVersionActions extends version_actions_1.VersionActions {
91
91
  }
92
92
  async updateProjectVersion(tree, newVersion) {
93
93
  const logMessages = [];
94
- for (const manifestPath of this.manifestsToUpdate) {
95
- const cargoTomlString = tree.read(manifestPath, 'utf-8').toString();
94
+ for (const manifestToUpdate of this.manifestsToUpdate) {
95
+ const cargoTomlString = tree
96
+ .read(manifestToUpdate.manifestPath, 'utf-8')
97
+ .toString();
96
98
  const cargoToml = this.parseCargoToml(cargoTomlString);
97
99
  ExampleRustVersionActions.modifyCargoTable(cargoToml, 'package', 'version', newVersion);
98
100
  const updatedCargoTomlString = ExampleRustVersionActions.stringifyCargoToml(cargoToml);
99
- tree.write(manifestPath, updatedCargoTomlString);
100
- logMessages.push(`✍️ New version ${newVersion} written to manifest: ${manifestPath}`);
101
+ tree.write(manifestToUpdate.manifestPath, updatedCargoTomlString);
102
+ logMessages.push(`✍️ New version ${newVersion} written to manifest: ${manifestToUpdate.manifestPath}`);
101
103
  }
102
104
  return logMessages;
103
105
  }
@@ -117,9 +119,7 @@ class ExampleRustVersionActions extends version_actions_1.VersionActions {
117
119
  dependencyCollection: 'dependencies',
118
120
  };
119
121
  }
120
- async isLocalDependencyProtocol(_versionSpecifier) {
121
- return false;
122
- }
122
+ // NOTE: Does not take the preserveLocalDependencyProtocols setting into account yet
123
123
  async updateProjectDependencies(tree, _projectGraph, dependenciesToUpdate) {
124
124
  const numDependenciesToUpdate = Object.keys(dependenciesToUpdate).length;
125
125
  const depText = numDependenciesToUpdate === 1 ? 'dependency' : 'dependencies';
@@ -127,15 +127,17 @@ class ExampleRustVersionActions extends version_actions_1.VersionActions {
127
127
  return [];
128
128
  }
129
129
  const logMessages = [];
130
- for (const manifestPath of this.manifestsToUpdate) {
131
- const cargoTomlString = tree.read(manifestPath, 'utf-8').toString();
130
+ for (const manifestToUpdate of this.manifestsToUpdate) {
131
+ const cargoTomlString = tree
132
+ .read(manifestToUpdate.manifestPath, 'utf-8')
133
+ .toString();
132
134
  const cargoToml = this.parseCargoToml(cargoTomlString);
133
135
  for (const [dep, version] of Object.entries(dependenciesToUpdate)) {
134
136
  ExampleRustVersionActions.modifyCargoTable(cargoToml, 'dependencies', dep, version);
135
137
  }
136
138
  const updatedCargoTomlString = ExampleRustVersionActions.stringifyCargoToml(cargoToml);
137
- tree.write(manifestPath, updatedCargoTomlString);
138
- logMessages.push(`✍️ Updated ${numDependenciesToUpdate} ${depText} in manifest: ${manifestPath}`);
139
+ tree.write(manifestToUpdate.manifestPath, updatedCargoTomlString);
140
+ logMessages.push(`✍️ Updated ${numDependenciesToUpdate} ${depText} in manifest: ${manifestToUpdate.manifestPath}`);
139
141
  }
140
142
  return logMessages;
141
143
  }
@@ -158,9 +160,6 @@ class ExampleNonSemverVersionActions extends version_actions_1.VersionActions {
158
160
  dependencyCollection: null,
159
161
  };
160
162
  }
161
- async isLocalDependencyProtocol() {
162
- return false;
163
- }
164
163
  async updateProjectVersion(tree, newVersion) {
165
164
  tree.write((0, node_path_1.join)(this.projectGraphNode.data.root, 'version.txt'), newVersion);
166
165
  return [];
@@ -1,5 +1,5 @@
1
1
  import { ReleaseType } from 'semver';
2
- import { NxReleaseVersionV2Configuration } from '../../../config/nx-json';
2
+ import { NxReleaseVersionConfiguration } from '../../../config/nx-json';
3
3
  import type { ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode } from '../../../config/project-graph';
4
4
  import type { Tree } from '../../../generators/tree';
5
5
  import { ReleaseGroupWithName } from '../config/filter-release-groups';
@@ -49,8 +49,14 @@ export declare abstract class VersionActions {
49
49
  * The interpolated manifest paths to update, if applicable based on the user's configuration, when new
50
50
  * versions and dependencies are determined. If no manifest files should be updated based on the user's
51
51
  * configuration, this will be an empty array.
52
+ *
53
+ * The final value for preserveLocalDependencyProtocols will be based on the resolved config for the current
54
+ * project and any overrides from the user's configuration for the manifestRootsToUpdate.
52
55
  */
53
- manifestsToUpdate: string[];
56
+ manifestsToUpdate: {
57
+ manifestPath: string;
58
+ preserveLocalDependencyProtocols: boolean;
59
+ }[];
54
60
  constructor(releaseGroup: ReleaseGroupWithName, projectGraphNode: ProjectGraphProjectNode, finalConfigForProject: FinalConfigForProject);
55
61
  /**
56
62
  * Asynchronous initialization of the version actions and validation of certain configuration options.
@@ -106,7 +112,7 @@ export declare abstract class VersionActions {
106
112
  * NOTE: The version actions implementation does not need to provide the method for handling resolution
107
113
  * from git tags, this is done directly by nx release.
108
114
  */
109
- abstract readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata: NxReleaseVersionV2Configuration['currentVersionResolverMetadata']): Promise<{
115
+ abstract readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata']): Promise<{
110
116
  currentVersion: string | null;
111
117
  logText: string;
112
118
  } | null>;
@@ -138,11 +144,6 @@ export declare abstract class VersionActions {
138
144
  currentVersion: string | null;
139
145
  dependencyCollection: string | null;
140
146
  }>;
141
- /**
142
- * Implementation details of determining if a version specifier uses a local dependency protocol that is relevant to this
143
- * specific project. E.g. in a package.json context, `file:` and `workspace:` protocols should return true here.
144
- */
145
- abstract isLocalDependencyProtocol(versionSpecifier: string): Promise<boolean>;
146
147
  /**
147
148
  * Implementation details of updating a newly derived version in some source of truth.
148
149
  *
@@ -92,6 +92,9 @@ class VersionActions {
92
92
  * The interpolated manifest paths to update, if applicable based on the user's configuration, when new
93
93
  * versions and dependencies are determined. If no manifest files should be updated based on the user's
94
94
  * configuration, this will be an empty array.
95
+ *
96
+ * The final value for preserveLocalDependencyProtocols will be based on the resolved config for the current
97
+ * project and any overrides from the user's configuration for the manifestRootsToUpdate.
95
98
  */
96
99
  this.manifestsToUpdate = [];
97
100
  }
@@ -104,31 +107,40 @@ class VersionActions {
104
107
  this.finalConfigForProject.manifestRootsToUpdate.length === 0) {
105
108
  for (const manifestFilename of this.validManifestFilenames) {
106
109
  if (tree.exists((0, node_path_1.join)(this.projectGraphNode.data.root, manifestFilename))) {
107
- this.finalConfigForProject.manifestRootsToUpdate.push(this.projectGraphNode.data.root);
110
+ this.finalConfigForProject.manifestRootsToUpdate.push({
111
+ path: this.projectGraphNode.data.root,
112
+ preserveLocalDependencyProtocols: this.finalConfigForProject.preserveLocalDependencyProtocols,
113
+ });
108
114
  break;
109
115
  }
110
116
  }
111
117
  }
112
118
  const interpolatedManifestRoots = this.finalConfigForProject.manifestRootsToUpdate.map((manifestRoot) => {
113
- return (0, utils_1.interpolate)(manifestRoot, {
114
- workspaceRoot: '',
115
- projectRoot: this.projectGraphNode.data.root,
116
- projectName: this.projectGraphNode.name,
117
- });
119
+ return {
120
+ ...manifestRoot,
121
+ path: (0, utils_1.interpolate)(manifestRoot.path, {
122
+ workspaceRoot: '',
123
+ projectRoot: this.projectGraphNode.data.root,
124
+ projectName: this.projectGraphNode.name,
125
+ }),
126
+ };
118
127
  });
119
128
  for (const interpolatedManifestRoot of interpolatedManifestRoots) {
120
129
  let hasValidManifest = false;
121
130
  for (const manifestFilename of this.validManifestFilenames) {
122
- const manifestPath = (0, node_path_1.join)(interpolatedManifestRoot, manifestFilename);
131
+ const manifestPath = (0, node_path_1.join)(interpolatedManifestRoot.path, manifestFilename);
123
132
  if (tree.exists(manifestPath)) {
124
- this.manifestsToUpdate.push(manifestPath);
133
+ this.manifestsToUpdate.push({
134
+ ...interpolatedManifestRoot,
135
+ manifestPath,
136
+ });
125
137
  hasValidManifest = true;
126
138
  break;
127
139
  }
128
140
  }
129
141
  if (!hasValidManifest) {
130
142
  const validManifestFilenames = this.validManifestFilenames?.join(' or ');
131
- throw new Error(`The project "${this.projectGraphNode.name}" does not have a ${validManifestFilenames} file available in ./${interpolatedManifestRoot}.
143
+ throw new Error(`The project "${this.projectGraphNode.name}" does not have a ${validManifestFilenames} file available in ./${interpolatedManifestRoot.path}.
132
144
 
133
145
  To fix this you will either need to add a ${validManifestFilenames} file at that location, or configure "release" within your nx.json to exclude "${this.projectGraphNode.name}" from the current release group, or amend the "release.version.manifestRootsToUpdate" configuration to point to where the relevant manifest should be.`);
134
146
  }
@@ -133,6 +133,7 @@ function createAPI(overrideReleaseConfig) {
133
133
  projects: args.projects,
134
134
  groups: args.groups,
135
135
  },
136
+ versionActionsOptionsOverrides: args.versionActionsOptionsOverrides,
136
137
  });
137
138
  try {
138
139
  await processor.init();
@@ -160,8 +161,11 @@ function createAPI(overrideReleaseConfig) {
160
161
  : [];
161
162
  (0, shared_1.handleDuplicateGitTags)(gitTagValues);
162
163
  printAndFlushChanges(tree, !!args.dryRun);
163
- const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned(nxReleaseConfig.version
164
- .versionActionsOptions);
164
+ const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
165
+ ...nxReleaseConfig.version
166
+ .versionActionsOptions,
167
+ ...(args.versionActionsOptionsOverrides ?? {}),
168
+ });
165
169
  changed.forEach((f) => additionalChangedFiles.add(f));
166
170
  deleted.forEach((f) => additionalDeletedFiles.add(f));
167
171
  // Only applicable when there is a single release group with a fixed relationship