nx 21.0.0-canary.20250425-ee097a8 → 21.0.0-canary.20250426-da4f55b

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 (28) hide show
  1. package/migrations.json +0 -35
  2. package/package.json +11 -11
  3. package/src/command-line/migrate/migrate-ui-api.d.ts +2 -0
  4. package/src/command-line/migrate/migrate-ui-api.js +39 -0
  5. package/src/command-line/migrate/migrate.d.ts +0 -4
  6. package/src/command-line/migrate/migrate.js +8 -21
  7. package/src/command-line/release/version/release-group-processor.js +8 -0
  8. package/src/command-line/repair/repair.js +0 -1
  9. package/src/config/misc-interfaces.d.ts +0 -1
  10. package/src/core/graph/main.js +1 -1
  11. package/src/native/index.d.ts +2 -0
  12. package/src/native/native-bindings.js +1 -0
  13. package/src/native/nx.wasm32-wasi.wasm +0 -0
  14. package/src/project-graph/file-utils.d.ts +1 -10
  15. package/src/project-graph/file-utils.js +2 -77
  16. package/src/tasks-runner/task-orchestrator.js +3 -0
  17. package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
  18. package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
  19. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.d.ts +0 -2
  20. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
  21. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
  22. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
  23. package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
  24. package/src/migrations/update-17-2-0/move-default-base.js +0 -21
  25. package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
  26. package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
  27. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
  28. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
package/migrations.json CHANGED
@@ -1,40 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "17.0.0-move-cache-directory": {
4
- "cli": "nx",
5
- "version": "17.0.0-beta.1",
6
- "description": "Updates the default cache directory to .nx/cache",
7
- "implementation": "./src/migrations/update-17-0-0/move-cache-directory"
8
- },
9
- "17.0.0-use-minimal-config-for-tasks-runner-options": {
10
- "cli": "nx",
11
- "version": "17.0.0-beta.3",
12
- "description": "Use minimal config for tasksRunnerOptions",
13
- "implementation": "./src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options"
14
- },
15
- "rm-default-collection-npm-scope": {
16
- "version": "17.0.0-rc.1",
17
- "description": "Migration for v17.0.0-rc.1",
18
- "implementation": "./src/migrations/update-17-0-0/rm-default-collection-npm-scope"
19
- },
20
- "17.3.0-update-nx-wrapper": {
21
- "cli": "nx",
22
- "version": "17.3.0-beta.6",
23
- "description": "Updates the nx wrapper.",
24
- "implementation": "./src/migrations/update-17-3-0/update-nxw"
25
- },
26
- "18.0.0-disable-adding-plugins-for-existing-workspaces": {
27
- "cli": "nx",
28
- "version": "18.0.0-beta.2",
29
- "description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
30
- "implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
31
- "x-repair-skip": true
32
- },
33
- "move-default-base-to-nx-json-root": {
34
- "version": "18.1.0-beta.3",
35
- "description": "Moves affected.defaultBase to defaultBase in `nx.json`",
36
- "implementation": "./src/migrations/update-17-2-0/move-default-base"
37
- },
38
3
  "19-2-0-move-graph-cache-directory": {
39
4
  "cli": "nx",
40
5
  "version": "19.2.0-beta.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.0.0-canary.20250425-ee097a8",
3
+ "version": "21.0.0-canary.20250426-da4f55b",
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.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"
86
+ "@nx/nx-darwin-arm64": "21.0.0-canary.20250426-da4f55b",
87
+ "@nx/nx-darwin-x64": "21.0.0-canary.20250426-da4f55b",
88
+ "@nx/nx-freebsd-x64": "21.0.0-canary.20250426-da4f55b",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250426-da4f55b",
90
+ "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250426-da4f55b",
91
+ "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250426-da4f55b",
92
+ "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250426-da4f55b",
93
+ "@nx/nx-linux-x64-musl": "21.0.0-canary.20250426-da4f55b",
94
+ "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250426-da4f55b",
95
+ "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250426-da4f55b"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -33,6 +33,7 @@ export declare function runSingleMigration(workspacePath: string, migration: Mig
33
33
  export declare function getImplementationPath(workspacePath: string, migration: MigrationDetailsWithId): Promise<string>;
34
34
  export declare function modifyMigrationsJsonMetadata(workspacePath: string, modify: (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata): void;
35
35
  export declare function addSuccessfulMigration(id: string, fileChanges: Omit<FileChange, 'content'>[], ref: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
36
+ export declare function updateRefForSuccessfulMigration(id: string, ref: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
36
37
  export declare function addFailedMigration(id: string, error: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => {
37
38
  completedMigrations?: Record<string, SuccessfulMigration | FailedMigration | SkippedMigration>;
38
39
  runningMigrations?: string[];
@@ -54,3 +55,4 @@ export declare function addSkippedMigration(id: string): (migrationsJsonMetadata
54
55
  targetVersion?: string;
55
56
  };
56
57
  export declare function readMigrationsJsonMetadata(workspacePath: string): MigrationsJsonMetadata;
58
+ export declare function undoMigration(workspacePath: string, id: string): (migrationsJsonMetadata: MigrationsJsonMetadata) => MigrationsJsonMetadata;
@@ -6,9 +6,11 @@ exports.runSingleMigration = runSingleMigration;
6
6
  exports.getImplementationPath = getImplementationPath;
7
7
  exports.modifyMigrationsJsonMetadata = modifyMigrationsJsonMetadata;
8
8
  exports.addSuccessfulMigration = addSuccessfulMigration;
9
+ exports.updateRefForSuccessfulMigration = updateRefForSuccessfulMigration;
9
10
  exports.addFailedMigration = addFailedMigration;
10
11
  exports.addSkippedMigration = addSkippedMigration;
11
12
  exports.readMigrationsJsonMetadata = readMigrationsJsonMetadata;
13
+ exports.undoMigration = undoMigration;
12
14
  const child_process_1 = require("child_process");
13
15
  const fs_1 = require("fs");
14
16
  const path_1 = require("path");
@@ -88,6 +90,12 @@ async function runSingleMigration(workspacePath, migration, configuration) {
88
90
  cwd: workspacePath,
89
91
  encoding: 'utf-8',
90
92
  });
93
+ // The revision changes after the amend, so we need to update it
94
+ const amendedGitRef = (0, child_process_1.execSync)('git rev-parse HEAD', {
95
+ cwd: workspacePath,
96
+ encoding: 'utf-8',
97
+ }).trim();
98
+ modifyMigrationsJsonMetadata(workspacePath, updateRefForSuccessfulMigration(migration.id, amendedGitRef));
91
99
  }
92
100
  }
93
101
  catch (e) {
@@ -130,6 +138,22 @@ function addSuccessfulMigration(id, fileChanges, ref) {
130
138
  return copied;
131
139
  };
132
140
  }
141
+ function updateRefForSuccessfulMigration(id, ref) {
142
+ return (migrationsJsonMetadata) => {
143
+ const copied = { ...migrationsJsonMetadata };
144
+ if (!copied.completedMigrations) {
145
+ copied.completedMigrations = {};
146
+ }
147
+ const existing = copied.completedMigrations[id];
148
+ if (existing && existing.type === 'successful') {
149
+ existing.ref = ref;
150
+ }
151
+ else {
152
+ throw new Error(`Attempted to update ref for unsuccessful migration`);
153
+ }
154
+ return copied;
155
+ };
156
+ }
133
157
  function addFailedMigration(id, error) {
134
158
  return (migrationsJsonMetadata) => {
135
159
  const copied = { ...migrationsJsonMetadata };
@@ -186,3 +210,18 @@ function readMigrationsJsonMetadata(workspacePath) {
186
210
  const migrationsJson = JSON.parse((0, fs_1.readFileSync)(migrationsJsonPath, 'utf-8'));
187
211
  return migrationsJson['nx-console'];
188
212
  }
213
+ function undoMigration(workspacePath, id) {
214
+ return (migrationsJsonMetadata) => {
215
+ const existing = migrationsJsonMetadata.completedMigrations[id];
216
+ if (existing.type !== 'successful')
217
+ throw new Error(`undoMigration called on unsuccessful migration: ${id}`);
218
+ (0, child_process_1.execSync)(`git reset --hard ${existing.ref}^`, {
219
+ cwd: workspacePath,
220
+ encoding: 'utf-8',
221
+ });
222
+ migrationsJsonMetadata.completedMigrations[id] = {
223
+ type: 'skipped',
224
+ };
225
+ return migrationsJsonMetadata;
226
+ };
227
+ }
@@ -41,7 +41,6 @@ export declare class Migrator {
41
41
  name: string;
42
42
  version: string;
43
43
  description?: string;
44
- cli?: string;
45
44
  implementation?: string;
46
45
  factory?: string;
47
46
  requires?: Record<string, string>;
@@ -101,20 +100,17 @@ export declare function executeMigrations(root: string, migrations: {
101
100
  name: string;
102
101
  description?: string;
103
102
  version: string;
104
- cli?: 'nx' | 'angular';
105
103
  }[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string): Promise<{
106
104
  package: string;
107
105
  name: string;
108
106
  description?: string;
109
107
  version: string;
110
- cli?: "nx" | "angular";
111
108
  }[]>;
112
109
  export declare function runNxOrAngularMigration(root: string, migration: {
113
110
  package: string;
114
111
  name: string;
115
112
  description?: string;
116
113
  version: string;
117
- cli?: 'nx' | 'angular';
118
114
  }, isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, installDepsIfChanged?: () => void, handleInstallDeps?: boolean): Promise<FileChange[]>;
119
115
  export declare function migrate(root: string, args: {
120
116
  [k: string]: any;
@@ -647,7 +647,11 @@ async function getPackageMigrationsUsingInstall(packageName, packageVersion) {
647
647
  result = { ...migrations, packageGroup, version: packageJson.version };
648
648
  }
649
649
  catch (e) {
650
- logger_1.logger.warn(`Unable to fetch migrations for ${packageName}@${packageVersion}: ${e.message}`);
650
+ output_1.output.warn({
651
+ title: `Failed to fetch migrations for ${packageName}@${packageVersion}`,
652
+ bodyLines: [e.message],
653
+ });
654
+ return {};
651
655
  }
652
656
  finally {
653
657
  await cleanup();
@@ -870,7 +874,6 @@ function addSplitConfigurationMigrationIfAvailable(from, packageJson) {
870
874
  {
871
875
  version: '15.7.0-beta.0',
872
876
  description: 'Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.',
873
- cli: 'nx',
874
877
  implementation: './src/migrations/update-15-7-0/split-configuration-into-project-json-files',
875
878
  package: '@nrwl/workspace',
876
879
  name: '15-7-0-split-configuration-into-project-json-files',
@@ -973,7 +976,7 @@ async function runNxOrAngularMigration(root, migration, isVerbose, shouldCreateC
973
976
  }
974
977
  const { collection, collectionPath } = readMigrationCollection(migration.package, root);
975
978
  let changes = [];
976
- if (!isAngularMigration(collection, collectionPath, migration.name)) {
979
+ if (!isAngularMigration(collection, migration.name)) {
977
980
  changes = await runNxMigration(root, collectionPath, collection, migration.name);
978
981
  logger_1.logger.info(`Ran ${migration.name} from ${migration.package}`);
979
982
  logger_1.logger.info(` ${migration.description}\n`);
@@ -1214,24 +1217,8 @@ function addToNodePath(dir) {
1214
1217
  // Update the env variable.
1215
1218
  process.env.NODE_PATH = paths.join(delimiter);
1216
1219
  }
1217
- // TODO (v21): Remove CLI determination of Angular Migration
1218
- function isAngularMigration(collection, collectionPath, name) {
1219
- const entry = collection.generators?.[name] || collection.schematics?.[name];
1220
- const shouldBeNx = !!collection.generators?.[name];
1221
- const shouldBeNg = !!collection.schematics?.[name];
1222
- if (entry.cli && entry.cli !== 'nx' && collection.generators?.[name]) {
1223
- output_1.output.warn({
1224
- title: `The migration '${collection.name}:${name}' appears to be an Angular CLI migration, but is located in the 'generators' section of migrations.json.`,
1225
- bodyLines: [
1226
- 'In Nx 21, migrations inside `generators` will be treated as Nx Devkit migrations and therefore may not run correctly if they are using Angular Devkit.',
1227
- 'If the migration should be run with Angular Devkit, please place the migration inside `schematics` instead.',
1228
- "Please open an issue on the plugin's repository if you believe this is an error.",
1229
- ],
1230
- });
1231
- }
1232
- // Currently, if the cli property exists we listen to it. If its nx, its not an ng cli migration.
1233
- // If the property is not set, we will fall back to our intuition.
1234
- return entry.cli ? entry.cli !== 'nx' : !shouldBeNx && shouldBeNg;
1220
+ function isAngularMigration(collection, name) {
1221
+ return !collection.generators?.[name] && collection.schematics?.[name];
1235
1222
  }
1236
1223
  const getNgCompatLayer = (() => {
1237
1224
  let _ngCliAdapter;
@@ -205,6 +205,14 @@ class ReleaseGroupProcessor {
205
205
  const currentVersion = await (0, resolve_current_version_1.resolveCurrentVersion)(this.tree, projectGraphNode, releaseGroupNode.group, versionActions, this.projectLoggers.get(projectName), this.currentVersionsPerFixedReleaseGroup, finalConfigForProject, releaseTagPattern, latestMatchingGitTag);
206
206
  this.cachedCurrentVersions.set(projectName, currentVersion);
207
207
  }
208
+ // Ensure that there is an entry in versionData for each project being processed, even if they don't end up being bumped
209
+ for (const projectName of this.allProjectsToProcess) {
210
+ this.versionData.set(projectName, {
211
+ currentVersion: this.getCurrentCachedVersionForProject(projectName),
212
+ newVersion: null,
213
+ dependentProjects: this.getOriginalDependentProjects(projectName),
214
+ });
215
+ }
208
216
  }
209
217
  // Build the dependency relationships between groups
210
218
  this.buildGroupDependencyGraph();
@@ -12,7 +12,6 @@ async function repair(args, extraMigrations = []) {
12
12
  if (!skip) {
13
13
  agg.push({
14
14
  package: 'nx',
15
- cli: 'nx',
16
15
  name,
17
16
  description: migration.description,
18
17
  version: migration.version,
@@ -53,7 +53,6 @@ export type PackageJsonUpdates = {
53
53
  export interface MigrationsJsonEntry {
54
54
  version: string;
55
55
  description?: string;
56
- cli?: string;
57
56
  implementation?: string;
58
57
  factory?: string;
59
58
  requires?: Record<string, string>;