nx 21.0.0-beta.8 → 21.0.0-beta.9
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.
- package/migrations.json +5 -35
- package/package.json +11 -11
- package/schemas/nx-schema.json +34 -38
- package/src/command-line/migrate/migrate-ui-api.d.ts +2 -0
- package/src/command-line/migrate/migrate-ui-api.js +39 -0
- package/src/command-line/migrate/migrate.d.ts +0 -4
- package/src/command-line/migrate/migrate.js +8 -21
- package/src/command-line/release/command-object.d.ts +6 -0
- package/src/command-line/release/config/config.js +15 -8
- package/src/command-line/release/config/use-legacy-versioning.js +4 -4
- package/src/command-line/release/version/release-group-processor.d.ts +10 -9
- package/src/command-line/release/version/release-group-processor.js +25 -8
- package/src/command-line/release/version/test-utils.d.ts +2 -4
- package/src/command-line/release/version/test-utils.js +13 -14
- package/src/command-line/release/version/version-actions.d.ts +9 -8
- package/src/command-line/release/version/version-actions.js +21 -9
- package/src/command-line/release/version.js +6 -2
- package/src/command-line/repair/repair.js +0 -1
- package/src/config/misc-interfaces.d.ts +0 -1
- package/src/config/nx-json.d.ts +15 -9
- package/src/config/workspace-json-project-json.d.ts +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/native/index.d.ts +2 -0
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/lock-file/utils/package-json.js +6 -5
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- package/src/project-graph/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- package/src/tasks-runner/task-orchestrator.js +3 -0
- package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- 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",
|
@@ -63,6 +28,11 @@
|
|
63
28
|
"description": "Set `useLegacyCache` to true for migrating workspaces",
|
64
29
|
"implementation": "./src/migrations/update-20-0-1/use-legacy-cache",
|
65
30
|
"x-repair-skip": true
|
31
|
+
},
|
32
|
+
"release-version-config-changes": {
|
33
|
+
"version": "21.0.0-beta.1",
|
34
|
+
"description": "Updates release version config based on the breaking changes in Nx v21",
|
35
|
+
"implementation": "./src/migrations/update-21-0-0/release-version-config-changes"
|
66
36
|
}
|
67
37
|
}
|
68
38
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.0.0-beta.
|
3
|
+
"version": "21.0.0-beta.9",
|
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-beta.
|
87
|
-
"@nx/nx-darwin-x64": "21.0.0-beta.
|
88
|
-
"@nx/nx-freebsd-x64": "21.0.0-beta.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.0.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.0.0-beta.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.0.0-beta.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.0.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.0.0-beta.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.0.0-beta.
|
86
|
+
"@nx/nx-darwin-arm64": "21.0.0-beta.9",
|
87
|
+
"@nx/nx-darwin-x64": "21.0.0-beta.9",
|
88
|
+
"@nx/nx-freebsd-x64": "21.0.0-beta.9",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.9",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.0.0-beta.9",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.0.0-beta.9",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.0.0-beta.9",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.0.0-beta.9",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.0.0-beta.9",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.0.0-beta.9"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
package/schemas/nx-schema.json
CHANGED
@@ -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":
|
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":
|
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": {
|
@@ -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
|
-
|
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,
|
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
|
-
|
1218
|
-
|
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;
|
@@ -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
|
155
|
-
|
156
|
-
|
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
|
-
|
442
|
-
|
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
|
-
|
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 === '
|
6
|
-
?
|
7
|
-
:
|
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 {
|
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:
|
14
|
-
currentVersionResolver:
|
15
|
-
currentVersionResolverMetadata:
|
16
|
-
fallbackCurrentVersionResolver:
|
17
|
-
versionPrefix:
|
18
|
-
preserveLocalDependencyProtocols:
|
19
|
-
versionActionsOptions:
|
20
|
-
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;
|
@@ -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();
|
@@ -775,12 +783,26 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
775
783
|
/**
|
776
784
|
* versionActionsOptions, defaults to {}
|
777
785
|
*/
|
778
|
-
|
786
|
+
let versionActionsOptions = projectVersionConfig?.versionActionsOptions ??
|
779
787
|
releaseGroupVersionConfig?.versionActionsOptions ??
|
780
788
|
{};
|
781
|
-
|
789
|
+
// Apply any optional overrides that may be passed in from the programmatic API
|
790
|
+
versionActionsOptions = {
|
791
|
+
...versionActionsOptions,
|
792
|
+
...(this.options.versionActionsOptionsOverrides ?? {}),
|
793
|
+
};
|
794
|
+
const manifestRootsToUpdate = (projectVersionConfig?.manifestRootsToUpdate ??
|
782
795
|
releaseGroupVersionConfig?.manifestRootsToUpdate ??
|
783
|
-
[]
|
796
|
+
[]).map((manifestRoot) => {
|
797
|
+
if (typeof manifestRoot === 'string') {
|
798
|
+
return {
|
799
|
+
path: manifestRoot,
|
800
|
+
// Apply the project level preserveLocalDependencyProtocols setting that was already resolved
|
801
|
+
preserveLocalDependencyProtocols,
|
802
|
+
};
|
803
|
+
}
|
804
|
+
return manifestRoot;
|
805
|
+
});
|
784
806
|
return {
|
785
807
|
specifierSource,
|
786
808
|
currentVersionResolver,
|
@@ -818,11 +840,6 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
818
840
|
if (!currentDependencyVersion) {
|
819
841
|
continue;
|
820
842
|
}
|
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
843
|
let finalPrefix = '';
|
827
844
|
if (cachedFinalConfigForProject.versionPrefix === 'auto') {
|
828
845
|
const prefixMatch = currentDependencyVersion?.match(/^([~^=])/);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { NxJsonConfiguration,
|
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:
|
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
|
95
|
-
const cargoTomlString = tree
|
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
|
-
|
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
|
131
|
-
const cargoTomlString = tree
|
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 [];
|