nx 0.0.0-pr-31634-ece4eca → 0.0.0-pr-31972-e7c1663
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/package.json +11 -12
- package/schemas/nx-schema.json +0 -18
- package/src/command-line/release/changelog.js +5 -53
- package/src/command-line/release/config/config.js +1 -31
- package/src/command-line/release/utils/git.d.ts +4 -35
- package/src/command-line/release/utils/git.js +11 -71
- package/src/command-line/release/utils/shared.d.ts +0 -6
- package/src/command-line/release/utils/shared.js +2 -7
- package/src/command-line/release/version/project-logger.js +0 -1
- package/src/command-line/release/version/release-group-processor.d.ts +0 -3
- package/src/command-line/release/version/release-group-processor.js +2 -58
- package/src/command-line/release/version.js +9 -33
- package/src/config/nx-json.d.ts +0 -95
- package/src/native/index.d.ts +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/life-cycle.d.ts +2 -0
- package/src/tasks-runner/life-cycle.js +7 -0
- package/src/tasks-runner/task-orchestrator.js +5 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +3 -0
- package/src/command-line/release/version/noop-version-actions.d.ts +0 -25
- package/src/command-line/release/version/noop-version-actions.js +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-31972-e7c1663",
|
|
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": "0.0.0-pr-
|
|
87
|
-
"@nx/nx-darwin-x64": "0.0.0-pr-
|
|
88
|
-
"@nx/nx-freebsd-x64": "0.0.0-pr-
|
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-
|
|
90
|
-
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-
|
|
91
|
-
"@nx/nx-linux-arm64-musl": "0.0.0-pr-
|
|
92
|
-
"@nx/nx-linux-x64-gnu": "0.0.0-pr-
|
|
93
|
-
"@nx/nx-linux-x64-musl": "0.0.0-pr-
|
|
94
|
-
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-
|
|
95
|
-
"@nx/nx-win32-x64-msvc": "0.0.0-pr-
|
|
86
|
+
"@nx/nx-darwin-arm64": "0.0.0-pr-31972-e7c1663",
|
|
87
|
+
"@nx/nx-darwin-x64": "0.0.0-pr-31972-e7c1663",
|
|
88
|
+
"@nx/nx-freebsd-x64": "0.0.0-pr-31972-e7c1663",
|
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-31972-e7c1663",
|
|
90
|
+
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-31972-e7c1663",
|
|
91
|
+
"@nx/nx-linux-arm64-musl": "0.0.0-pr-31972-e7c1663",
|
|
92
|
+
"@nx/nx-linux-x64-gnu": "0.0.0-pr-31972-e7c1663",
|
|
93
|
+
"@nx/nx-linux-x64-musl": "0.0.0-pr-31972-e7c1663",
|
|
94
|
+
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-31972-e7c1663",
|
|
95
|
+
"@nx/nx-win32-x64-msvc": "0.0.0-pr-31972-e7c1663"
|
|
96
96
|
},
|
|
97
97
|
"nx-migrations": {
|
|
98
98
|
"migrations": "./migrations.json",
|
|
@@ -129,7 +129,6 @@
|
|
|
129
129
|
"@nx/vue",
|
|
130
130
|
"@nx/web",
|
|
131
131
|
"@nx/webpack",
|
|
132
|
-
"@nx/docker",
|
|
133
132
|
{
|
|
134
133
|
"package": "nx-cloud",
|
|
135
134
|
"version": "latest"
|
package/schemas/nx-schema.json
CHANGED
|
@@ -207,13 +207,6 @@
|
|
|
207
207
|
],
|
|
208
208
|
"description": "By default, we will try and resolve the latest match for the releaseTagPattern from the current branch, falling back to all branches if no match is found on the current branch. Setting this to true will cause us to ALWAYS check all branches for the latest match. Setting it to false will cause us to ONLY check the current branch for the latest match. Setting it to an array of strings will cause us to check all branches WHEN the current branch is one of the strings in the array. Glob patterns are supported."
|
|
209
209
|
},
|
|
210
|
-
"releaseTagPatternRequireSemver": {
|
|
211
|
-
"type": "boolean",
|
|
212
|
-
"description": "Whether to require semver to be used for the release tag pattern. If set to false, the release tag pattern will not be checked for semver compliance."
|
|
213
|
-
},
|
|
214
|
-
"releaseTagPatternStrictPreid": {
|
|
215
|
-
"$ref": "#/definitions/NxReleaseReleaseTagPatternStrictPreidConfiguration"
|
|
216
|
-
},
|
|
217
210
|
"versionPlans": {
|
|
218
211
|
"oneOf": [
|
|
219
212
|
{
|
|
@@ -302,13 +295,6 @@
|
|
|
302
295
|
}
|
|
303
296
|
],
|
|
304
297
|
"description": "By default, we will try and resolve the latest match for the releaseTagPattern from the current branch, falling back to all branches if no match is found on the current branch. Setting this to true will cause us to ALWAYS check all branches for the latest match. Setting it to false will cause us to ONLY check the current branch for the latest match. Setting it to an array of strings will cause us to check all branches WHEN the current branch is one of the strings in the array. Glob patterns are supported."
|
|
305
|
-
},
|
|
306
|
-
"releaseTagPatternRequireSemver": {
|
|
307
|
-
"type": "boolean",
|
|
308
|
-
"description": "Whether to require semver to be used for the release tag pattern. If set to false, the release tag pattern will not be checked for semver compliance."
|
|
309
|
-
},
|
|
310
|
-
"releaseTagPatternStrictPreid": {
|
|
311
|
-
"$ref": "#/definitions/NxReleaseReleaseTagPatternStrictPreidConfiguration"
|
|
312
298
|
}
|
|
313
299
|
}
|
|
314
300
|
},
|
|
@@ -939,10 +925,6 @@
|
|
|
939
925
|
}
|
|
940
926
|
}
|
|
941
927
|
},
|
|
942
|
-
"NxReleaseReleaseTagPatternStrictPreidConfiguration": {
|
|
943
|
-
"type": "boolean",
|
|
944
|
-
"description": "When set to true and multiple tags match your configured \"releaseTagPattern\", the git tag matching logic will strictly prefer the tag which contain a semver preid which matches the one given to the nx release invocation.\n\nFor example, let's say your \"releaseTagPattern\" is \"{projectName}@{version}\" and you have the following tags for project \"my-lib\", which uses semver:\n- my-lib@1.2.4-beta.1\n- my-lib@1.2.4-alpha.1\n- my-lib@1.2.3\n\nIf \"releaseTagPatternStrictPreid\" is set to true and you run:\n- `nx release --preid beta`, the git tag \"my-lib@1.2.4-beta.1\" will be resolved.\n- `nx release --preid alpha`, the git tag \"my-lib@1.2.4-alpha.1\" will be resolved.\n- `nx release` (no preid), the git tag \"my-lib@1.2.3\" will be resolved.\n\nIf \"releaseTagPatternStrictPreid\" is set to false, the git tag \"my-lib@1.2.4-beta.1\" will always be resolved as the latest tag that matches the pattern, regardless of any preid which gets passed to nx release.\n\nNOTE: This feature was added in a minor version and is therefore set to false by default, but this may change in a future major version."
|
|
945
|
-
},
|
|
946
928
|
"ChangelogRenderOptions": {
|
|
947
929
|
"type": "object",
|
|
948
930
|
"additionalProperties": true
|
|
@@ -5,7 +5,6 @@ exports.createAPI = createAPI;
|
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const enquirer_1 = require("enquirer");
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
|
-
const semver_1 = require("semver");
|
|
9
8
|
const tmp_1 = require("tmp");
|
|
10
9
|
const nx_json_1 = require("../../config/nx-json");
|
|
11
10
|
const tree_1 = require("../../generators/tree");
|
|
@@ -121,16 +120,6 @@ function createAPI(overrideReleaseConfig) {
|
|
|
121
120
|
const to = args.to || 'HEAD';
|
|
122
121
|
const toSHA = await (0, git_1.getCommitHash)(to);
|
|
123
122
|
const headSHA = to === 'HEAD' ? toSHA : await (0, git_1.getCommitHash)('HEAD');
|
|
124
|
-
/**
|
|
125
|
-
* Extract the preid from the workspace version and the project versions
|
|
126
|
-
*/
|
|
127
|
-
const workspacePreid = workspaceChangelogVersion
|
|
128
|
-
? extractPreid(workspaceChangelogVersion)
|
|
129
|
-
: undefined;
|
|
130
|
-
const projectsPreid = Object.fromEntries(Object.entries(projectsVersionData).map(([projectName, v]) => [
|
|
131
|
-
projectName,
|
|
132
|
-
v.newVersion ? extractPreid(v.newVersion) : undefined,
|
|
133
|
-
]));
|
|
134
123
|
/**
|
|
135
124
|
* Protect the user against attempting to create a new commit when recreating an old release changelog,
|
|
136
125
|
* this seems like it would always be unintentional.
|
|
@@ -202,13 +191,7 @@ function createAPI(overrideReleaseConfig) {
|
|
|
202
191
|
}
|
|
203
192
|
else {
|
|
204
193
|
let workspaceChangelogFromRef = args.from ||
|
|
205
|
-
(await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {},
|
|
206
|
-
checkAllBranchesWhen: nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen,
|
|
207
|
-
preid: workspacePreid ??
|
|
208
|
-
projectsPreid?.[Object.keys(projectsPreid)[0]],
|
|
209
|
-
releaseTagPatternRequireSemver: nxReleaseConfig.releaseTagPatternRequireSemver,
|
|
210
|
-
releaseTagPatternStrictPreid: nxReleaseConfig.releaseTagPatternStrictPreid,
|
|
211
|
-
}))?.tag;
|
|
194
|
+
(await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {}, nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen, nxReleaseConfig.releaseTagPatternRequireSemver))?.tag;
|
|
212
195
|
if (!workspaceChangelogFromRef) {
|
|
213
196
|
if (useAutomaticFromRef) {
|
|
214
197
|
workspaceChangelogFromRef = await (0, git_1.getFirstGitCommit)();
|
|
@@ -343,12 +326,7 @@ function createAPI(overrideReleaseConfig) {
|
|
|
343
326
|
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {
|
|
344
327
|
projectName: project.name,
|
|
345
328
|
releaseGroupName: releaseGroup.name,
|
|
346
|
-
},
|
|
347
|
-
checkAllBranchesWhen: releaseGroup.releaseTagPatternCheckAllBranchesWhen,
|
|
348
|
-
preid: projectsPreid[project.name],
|
|
349
|
-
releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver,
|
|
350
|
-
releaseTagPatternStrictPreid: releaseGroup.releaseTagPatternStrictPreid,
|
|
351
|
-
}))?.tag;
|
|
329
|
+
}, releaseGroup.releaseTagPatternCheckAllBranchesWhen, releaseGroup.releaseTagPatternRequireSemver))?.tag;
|
|
352
330
|
if (!fromRef && useAutomaticFromRef) {
|
|
353
331
|
const firstCommit = await (0, git_1.getFirstGitCommit)();
|
|
354
332
|
commits = await filterProjectCommits({
|
|
@@ -458,13 +436,7 @@ function createAPI(overrideReleaseConfig) {
|
|
|
458
436
|
}
|
|
459
437
|
else {
|
|
460
438
|
let fromRef = args.from ||
|
|
461
|
-
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {},
|
|
462
|
-
checkAllBranchesWhen: releaseGroup.releaseTagPatternCheckAllBranchesWhen,
|
|
463
|
-
preid: workspacePreid ??
|
|
464
|
-
projectsPreid?.[Object.keys(projectsPreid)[0]],
|
|
465
|
-
releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver,
|
|
466
|
-
releaseTagPatternStrictPreid: releaseGroup.releaseTagPatternStrictPreid,
|
|
467
|
-
}))?.tag;
|
|
439
|
+
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {}, releaseGroup.releaseTagPatternCheckAllBranchesWhen, releaseGroup.releaseTagPatternRequireSemver))?.tag;
|
|
468
440
|
if (!fromRef) {
|
|
469
441
|
if (useAutomaticFromRef) {
|
|
470
442
|
fromRef = await (0, git_1.getFirstGitCommit)();
|
|
@@ -827,15 +799,11 @@ async function generateChangelogForProjects({ tree, args, changes, projectsVersi
|
|
|
827
799
|
* no changelog entry is relevant in that case.
|
|
828
800
|
*/
|
|
829
801
|
if (!projectsVersionData[project.name] ||
|
|
830
|
-
|
|
831
|
-
!projectsVersionData[project.name].dockerVersion)) {
|
|
802
|
+
projectsVersionData[project.name].newVersion === null) {
|
|
832
803
|
continue;
|
|
833
804
|
}
|
|
834
805
|
const releaseVersion = new shared_1.ReleaseVersion({
|
|
835
|
-
version:
|
|
836
|
-
projectsVersionData[project.name].dockerVersion
|
|
837
|
-
? projectsVersionData[project.name].dockerVersion
|
|
838
|
-
: projectsVersionData[project.name].newVersion,
|
|
806
|
+
version: projectsVersionData[project.name].newVersion,
|
|
839
807
|
releaseTagPattern: releaseGroup.releaseTagPattern,
|
|
840
808
|
projectName: project.name,
|
|
841
809
|
});
|
|
@@ -999,19 +967,3 @@ function versionPlanSemverReleaseTypeToChangelogType(bump) {
|
|
|
999
967
|
throw new Error(`Invalid semver bump type: ${bump}`);
|
|
1000
968
|
}
|
|
1001
969
|
}
|
|
1002
|
-
function extractPreid(version) {
|
|
1003
|
-
if (!(0, shared_1.isPrerelease)(version)) {
|
|
1004
|
-
return undefined;
|
|
1005
|
-
}
|
|
1006
|
-
const preid = (0, semver_1.prerelease)(version)?.[0];
|
|
1007
|
-
if (typeof preid === 'string') {
|
|
1008
|
-
if (preid.trim() === '') {
|
|
1009
|
-
return undefined;
|
|
1010
|
-
}
|
|
1011
|
-
return preid;
|
|
1012
|
-
}
|
|
1013
|
-
if (typeof preid === 'number') {
|
|
1014
|
-
return preid.toString();
|
|
1015
|
-
}
|
|
1016
|
-
return undefined;
|
|
1017
|
-
}
|
|
@@ -114,16 +114,11 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
114
114
|
};
|
|
115
115
|
const defaultFixedReleaseTagPattern = 'v{version}';
|
|
116
116
|
/**
|
|
117
|
-
* TODO(
|
|
117
|
+
* TODO(v21): in v21, make it so that this pattern is used by default when any custom groups are used
|
|
118
118
|
*/
|
|
119
119
|
const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}';
|
|
120
120
|
const defaultIndependentReleaseTagPattern = '{projectName}@{version}';
|
|
121
|
-
const defaultReleaseTagPatternPreferDockerVersion = false;
|
|
122
121
|
const defaultReleaseTagPatternRequireSemver = true;
|
|
123
|
-
/**
|
|
124
|
-
* TODO(v22): in v22, set this to true by default
|
|
125
|
-
*/
|
|
126
|
-
const defaultReleaseTagPatternStrictPreid = false;
|
|
127
122
|
const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed';
|
|
128
123
|
const defaultGeneratorOptions = {};
|
|
129
124
|
if (userConfig.version?.conventionalCommits) {
|
|
@@ -165,8 +160,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
165
160
|
?.logUnchangedProjects ?? true,
|
|
166
161
|
updateDependents: userConfig.version
|
|
167
162
|
?.updateDependents ?? 'auto',
|
|
168
|
-
docker: userConfig.version
|
|
169
|
-
?.docker ?? undefined,
|
|
170
163
|
}),
|
|
171
164
|
},
|
|
172
165
|
changelog: {
|
|
@@ -208,12 +201,8 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
208
201
|
? defaultIndependentReleaseTagPattern
|
|
209
202
|
: defaultFixedReleaseTagPattern),
|
|
210
203
|
releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
|
|
211
|
-
releaseTagPatternPreferDockerVersion: userConfig.releaseTagPatternPreferDockerVersion ??
|
|
212
|
-
defaultReleaseTagPatternPreferDockerVersion,
|
|
213
204
|
releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
|
|
214
205
|
defaultReleaseTagPatternRequireSemver,
|
|
215
|
-
releaseTagPatternStrictPreid: userConfig.releaseTagPatternStrictPreid ??
|
|
216
|
-
defaultReleaseTagPatternStrictPreid,
|
|
217
206
|
conventionalCommits: conventional_commits_1.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
|
|
218
207
|
versionPlans: (userConfig.versionPlans ||
|
|
219
208
|
false),
|
|
@@ -221,8 +210,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
221
210
|
const groupProjectsRelationship = userConfig.projectsRelationship || WORKSPACE_DEFAULTS.projectsRelationship;
|
|
222
211
|
const groupReleaseTagPatternRequireSemver = userConfig.releaseTagPatternRequireSemver ??
|
|
223
212
|
WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver;
|
|
224
|
-
const groupReleaseTagPatternStrictPreid = userConfig.releaseTagPatternStrictPreid ??
|
|
225
|
-
defaultReleaseTagPatternStrictPreid;
|
|
226
213
|
const GROUP_DEFAULTS = {
|
|
227
214
|
projectsRelationship: groupProjectsRelationship,
|
|
228
215
|
version: USE_LEGACY_VERSIONING
|
|
@@ -256,11 +243,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
256
243
|
? defaultIndependentReleaseTagPattern
|
|
257
244
|
: WORKSPACE_DEFAULTS.releaseTagPattern,
|
|
258
245
|
releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
|
|
259
|
-
releaseTagPatternPreferDockerVersion: WORKSPACE_DEFAULTS.releaseTagPatternPreferDockerVersion ??
|
|
260
|
-
userConfig.releaseTagPatternPreferDockerVersion ??
|
|
261
|
-
defaultReleaseTagPatternPreferDockerVersion,
|
|
262
246
|
releaseTagPatternRequireSemver: groupReleaseTagPatternRequireSemver,
|
|
263
|
-
releaseTagPatternStrictPreid: groupReleaseTagPatternStrictPreid,
|
|
264
247
|
versionPlans: false,
|
|
265
248
|
};
|
|
266
249
|
/**
|
|
@@ -301,8 +284,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
301
284
|
};
|
|
302
285
|
delete rootVersionWithoutGlobalOptions.git;
|
|
303
286
|
delete rootVersionWithoutGlobalOptions.preVersionCommand;
|
|
304
|
-
delete rootVersionWithoutGlobalOptions
|
|
305
|
-
.docker?.preVersionCommand;
|
|
306
287
|
// Apply conventionalCommits shorthand to the final group defaults if explicitly configured in the original user config
|
|
307
288
|
if (userConfig.version?.conventionalCommits === true) {
|
|
308
289
|
if (USE_LEGACY_VERSIONING) {
|
|
@@ -364,9 +345,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
364
345
|
version: deepMergeDefaults([GROUP_DEFAULTS.version], rootVersionWithoutGlobalOptions),
|
|
365
346
|
// If the user has set something custom for releaseTagPattern at the top level, respect it for the implicit default group
|
|
366
347
|
releaseTagPattern: userConfig.releaseTagPattern || GROUP_DEFAULTS.releaseTagPattern,
|
|
367
|
-
releaseTagPatternPreferDockerVersion: GROUP_DEFAULTS.releaseTagPatternPreferDockerVersion ??
|
|
368
|
-
userConfig.releaseTagPatternPreferDockerVersion ??
|
|
369
|
-
defaultReleaseTagPatternPreferDockerVersion,
|
|
370
348
|
releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
|
|
371
349
|
GROUP_DEFAULTS.releaseTagPatternRequireSemver,
|
|
372
350
|
// Directly inherit the root level config for projectChangelogs, if set
|
|
@@ -448,15 +426,9 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
448
426
|
releaseTagPatternCheckAllBranchesWhen: releaseGroup.releaseTagPatternCheckAllBranchesWhen ??
|
|
449
427
|
userConfig.releaseTagPatternCheckAllBranchesWhen ??
|
|
450
428
|
undefined,
|
|
451
|
-
releaseTagPatternPreferDockerVersion: releaseGroup.releaseTagPatternPreferDockerVersion ??
|
|
452
|
-
userConfig.releaseTagPatternPreferDockerVersion ??
|
|
453
|
-
defaultReleaseTagPatternPreferDockerVersion,
|
|
454
429
|
releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver ??
|
|
455
430
|
userConfig.releaseTagPatternRequireSemver ??
|
|
456
431
|
defaultReleaseTagPatternRequireSemver,
|
|
457
|
-
releaseTagPatternStrictPreid: releaseGroup.releaseTagPatternStrictPreid ??
|
|
458
|
-
userConfig.releaseTagPatternStrictPreid ??
|
|
459
|
-
defaultReleaseTagPatternStrictPreid,
|
|
460
432
|
versionPlans: releaseGroup.versionPlans ?? rootVersionPlansConfig,
|
|
461
433
|
};
|
|
462
434
|
const finalReleaseGroup = deepMergeDefaults([groupDefaults], {
|
|
@@ -530,9 +502,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
|
530
502
|
projectsRelationship: WORKSPACE_DEFAULTS.projectsRelationship,
|
|
531
503
|
releaseTagPattern: WORKSPACE_DEFAULTS.releaseTagPattern,
|
|
532
504
|
releaseTagPatternCheckAllBranchesWhen: WORKSPACE_DEFAULTS.releaseTagPatternCheckAllBranchesWhen,
|
|
533
|
-
releaseTagPatternPreferDockerVersion: WORKSPACE_DEFAULTS.releaseTagPatternPreferDockerVersion,
|
|
534
505
|
releaseTagPatternRequireSemver: WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver,
|
|
535
|
-
releaseTagPatternStrictPreid: WORKSPACE_DEFAULTS.releaseTagPatternStrictPreid,
|
|
536
506
|
git: rootGitConfig,
|
|
537
507
|
version: rootVersionConfig,
|
|
538
508
|
changelog: rootChangelogConfig,
|
|
@@ -12,10 +12,6 @@ export interface Reference {
|
|
|
12
12
|
type: 'hash' | 'issue' | 'pull-request';
|
|
13
13
|
value: string;
|
|
14
14
|
}
|
|
15
|
-
export interface GitTagAndVersion {
|
|
16
|
-
tag: string;
|
|
17
|
-
extractedVersion: string;
|
|
18
|
-
}
|
|
19
15
|
export interface GitCommit extends RawGitCommit {
|
|
20
16
|
description: string;
|
|
21
17
|
type: string;
|
|
@@ -26,37 +22,10 @@ export interface GitCommit extends RawGitCommit {
|
|
|
26
22
|
affectedFiles: string[];
|
|
27
23
|
revertedHashes: string[];
|
|
28
24
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
releaseTagPatternStrictPreid: boolean;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Extract the tag and version from a tag string
|
|
37
|
-
*
|
|
38
|
-
* @param tag - The tag string to extract the tag and version from
|
|
39
|
-
* @param tagRegexp - The regex to use to extract the tag and version from the tag string
|
|
40
|
-
*
|
|
41
|
-
* @returns The tag and version
|
|
42
|
-
*/
|
|
43
|
-
export declare function extractTagAndVersion(tag: string, tagRegexp: string, options: GetLatestGitTagForPatternOptions): GitTagAndVersion;
|
|
44
|
-
/**
|
|
45
|
-
* Get the latest git tag for the configured release tag pattern.
|
|
46
|
-
*
|
|
47
|
-
* This function will:
|
|
48
|
-
* - Get all tags from the git repo, sorted by version
|
|
49
|
-
* - Filter the tags into a list with SEMVER-compliant tags, matching the release tag pattern
|
|
50
|
-
* - If a preid is provided, prioritise tags for that preid, then semver tags without a preid
|
|
51
|
-
* - If no preid is provided, search only for stable semver tags (i.e. no pre-release or build metadata)
|
|
52
|
-
*
|
|
53
|
-
* @param releaseTagPattern - The pattern to filter the tags list by
|
|
54
|
-
* @param additionalInterpolationData - Additional data used when interpolating the release tag pattern
|
|
55
|
-
* @param options - The options to use when getting the latest git tag for the pattern
|
|
56
|
-
*
|
|
57
|
-
* @returns The tag and version
|
|
58
|
-
*/
|
|
59
|
-
export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData: {}, options: GetLatestGitTagForPatternOptions): Promise<GitTagAndVersion | null>;
|
|
25
|
+
export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}, checkAllBranchesWhen?: boolean | string[], releaseTagPatternRequireSemver?: boolean): Promise<{
|
|
26
|
+
tag: string;
|
|
27
|
+
extractedVersion: string;
|
|
28
|
+
} | null>;
|
|
60
29
|
export declare function getGitDiff(from: string | undefined, to?: string): Promise<RawGitCommit[]>;
|
|
61
30
|
export declare function gitAdd({ changedFiles, deletedFiles, dryRun, verbose, logFn, cwd, }: {
|
|
62
31
|
changedFiles?: string[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractTagAndVersion = extractTagAndVersion;
|
|
4
3
|
exports.getLatestGitTagForPattern = getLatestGitTagForPattern;
|
|
5
4
|
exports.getGitDiff = getGitDiff;
|
|
6
5
|
exports.gitAdd = gitAdd;
|
|
@@ -22,50 +21,12 @@ const minimatch_1 = require("minimatch");
|
|
|
22
21
|
const utils_1 = require("../../../tasks-runner/utils");
|
|
23
22
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
24
23
|
const exec_command_1 = require("./exec-command");
|
|
25
|
-
const shared_1 = require("./shared");
|
|
26
24
|
function escapeRegExp(string) {
|
|
27
25
|
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
28
26
|
}
|
|
29
27
|
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
30
28
|
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;
|
|
31
|
-
|
|
32
|
-
* Extract the tag and version from a tag string
|
|
33
|
-
*
|
|
34
|
-
* @param tag - The tag string to extract the tag and version from
|
|
35
|
-
* @param tagRegexp - The regex to use to extract the tag and version from the tag string
|
|
36
|
-
*
|
|
37
|
-
* @returns The tag and version
|
|
38
|
-
*/
|
|
39
|
-
function extractTagAndVersion(tag, tagRegexp, options) {
|
|
40
|
-
const { releaseTagPatternRequireSemver } = options;
|
|
41
|
-
const [latestMatchingTag, ...rest] = tag.match(tagRegexp);
|
|
42
|
-
let version = releaseTagPatternRequireSemver
|
|
43
|
-
? rest.filter((r) => {
|
|
44
|
-
return r.match(SEMVER_REGEX);
|
|
45
|
-
})[0]
|
|
46
|
-
: rest[0];
|
|
47
|
-
return {
|
|
48
|
-
tag: latestMatchingTag,
|
|
49
|
-
extractedVersion: version ?? null,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get the latest git tag for the configured release tag pattern.
|
|
54
|
-
*
|
|
55
|
-
* This function will:
|
|
56
|
-
* - Get all tags from the git repo, sorted by version
|
|
57
|
-
* - Filter the tags into a list with SEMVER-compliant tags, matching the release tag pattern
|
|
58
|
-
* - If a preid is provided, prioritise tags for that preid, then semver tags without a preid
|
|
59
|
-
* - If no preid is provided, search only for stable semver tags (i.e. no pre-release or build metadata)
|
|
60
|
-
*
|
|
61
|
-
* @param releaseTagPattern - The pattern to filter the tags list by
|
|
62
|
-
* @param additionalInterpolationData - Additional data used when interpolating the release tag pattern
|
|
63
|
-
* @param options - The options to use when getting the latest git tag for the pattern
|
|
64
|
-
*
|
|
65
|
-
* @returns The tag and version
|
|
66
|
-
*/
|
|
67
|
-
async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, options) {
|
|
68
|
-
const { checkAllBranchesWhen, releaseTagPatternRequireSemver, releaseTagPatternStrictPreid, preid, } = options;
|
|
29
|
+
async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, checkAllBranchesWhen, releaseTagPatternRequireSemver = true) {
|
|
69
30
|
/**
|
|
70
31
|
* By default, we will try and resolve the latest match for the releaseTagPattern from the current branch,
|
|
71
32
|
* falling back to all branches if no match is found on the current branch.
|
|
@@ -157,37 +118,16 @@ async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolat
|
|
|
157
118
|
if (!matchingTags.length) {
|
|
158
119
|
return null;
|
|
159
120
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const version = match.find((part) => part.match(SEMVER_REGEX));
|
|
171
|
-
return version && version.includes(`-${preid}.`);
|
|
172
|
-
});
|
|
173
|
-
if (preidReleaseTags.length > 0) {
|
|
174
|
-
return extractTagAndVersion(preidReleaseTags[0], tagRegexp, options);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
// Then try to find the latest stable release tag
|
|
178
|
-
const stableReleaseTags = matchingTags.filter((tag) => {
|
|
179
|
-
const matches = tag.match(tagRegexp);
|
|
180
|
-
if (!matches)
|
|
181
|
-
return false;
|
|
182
|
-
const [, version] = matches;
|
|
183
|
-
return version && !(0, shared_1.isPrerelease)(version);
|
|
184
|
-
});
|
|
185
|
-
// If there are stable release tags, use the latest one
|
|
186
|
-
if (stableReleaseTags.length > 0) {
|
|
187
|
-
return extractTagAndVersion(stableReleaseTags[0], tagRegexp, options);
|
|
188
|
-
}
|
|
189
|
-
// Otherwise return null
|
|
190
|
-
return null;
|
|
121
|
+
const [latestMatchingTag, ...rest] = matchingTags[0].match(tagRegexp);
|
|
122
|
+
const version = releaseTagPatternRequireSemver
|
|
123
|
+
? rest.filter((r) => {
|
|
124
|
+
return r.match(SEMVER_REGEX);
|
|
125
|
+
})[0]
|
|
126
|
+
: rest[0];
|
|
127
|
+
return {
|
|
128
|
+
tag: latestMatchingTag,
|
|
129
|
+
extractedVersion: version,
|
|
130
|
+
};
|
|
191
131
|
}
|
|
192
132
|
catch {
|
|
193
133
|
return null;
|
|
@@ -10,11 +10,6 @@ export interface VersionDataEntry {
|
|
|
10
10
|
* e.g. when using conventional commits
|
|
11
11
|
*/
|
|
12
12
|
newVersion: string | null;
|
|
13
|
-
/**
|
|
14
|
-
* dockerVersion will be populated if the project is a docker project and has been
|
|
15
|
-
* included within this release.
|
|
16
|
-
*/
|
|
17
|
-
dockerVersion?: string;
|
|
18
13
|
/**
|
|
19
14
|
* The list of projects which depend upon the current project.
|
|
20
15
|
*/
|
|
@@ -26,7 +21,6 @@ export interface VersionDataEntry {
|
|
|
26
21
|
rawVersionSpec: string;
|
|
27
22
|
}[];
|
|
28
23
|
}
|
|
29
|
-
export declare function isPrerelease(version: string): boolean;
|
|
30
24
|
export declare class ReleaseVersion {
|
|
31
25
|
rawVersion: string;
|
|
32
26
|
gitTag: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReleaseVersion = exports.noDiffInChangelogMessage = void 0;
|
|
4
|
-
exports.isPrerelease = isPrerelease;
|
|
5
4
|
exports.commitChanges = commitChanges;
|
|
6
5
|
exports.createCommitMessageValues = createCommitMessageValues;
|
|
7
6
|
exports.createGitTagValues = createGitTagValues;
|
|
@@ -166,9 +165,7 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
|
|
|
166
165
|
const projectVersionData = versionData[project];
|
|
167
166
|
if (projectVersionData.newVersion !== null) {
|
|
168
167
|
tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
|
|
169
|
-
version:
|
|
170
|
-
? projectVersionData.dockerVersion
|
|
171
|
-
: projectVersionData.newVersion,
|
|
168
|
+
version: projectVersionData.newVersion,
|
|
172
169
|
projectName: project,
|
|
173
170
|
}));
|
|
174
171
|
}
|
|
@@ -179,9 +176,7 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
|
|
|
179
176
|
const projectVersionData = versionData[releaseGroupProjectNames[0]]; // all at the same version, so we can just pick the first one
|
|
180
177
|
if (projectVersionData.newVersion !== null) {
|
|
181
178
|
tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
|
|
182
|
-
version:
|
|
183
|
-
? projectVersionData.dockerVersion
|
|
184
|
-
: projectVersionData.newVersion,
|
|
179
|
+
version: projectVersionData.newVersion,
|
|
185
180
|
releaseGroupName: releaseGroup.name,
|
|
186
181
|
}));
|
|
187
182
|
}
|
|
@@ -18,7 +18,6 @@ export interface FinalConfigForProject {
|
|
|
18
18
|
preserveLocalDependencyProtocols: NxReleaseVersionConfiguration['preserveLocalDependencyProtocols'];
|
|
19
19
|
versionActionsOptions: NxReleaseVersionConfiguration['versionActionsOptions'];
|
|
20
20
|
manifestRootsToUpdate: Array<Exclude<ManifestRootToUpdate, string>>;
|
|
21
|
-
dockerOptions: NxReleaseVersionConfiguration['docker'];
|
|
22
21
|
}
|
|
23
22
|
export declare const BUMP_TYPE_REASON_TEXT: {
|
|
24
23
|
readonly DEPENDENCY_WAS_BUMPED: ", because a dependency was bumped, ";
|
|
@@ -28,7 +27,6 @@ export declare const BUMP_TYPE_REASON_TEXT: {
|
|
|
28
27
|
readonly VERSION_PLANS: ", read from version plan {versionPlanPath}, ";
|
|
29
28
|
readonly DEPENDENCY_ACROSS_GROUPS_WAS_BUMPED: ", because a dependency project belonging to another release group was bumped, ";
|
|
30
29
|
readonly OTHER_PROJECT_IN_FIXED_GROUP_WAS_BUMPED_DUE_TO_DEPENDENCY: ", because of a dependency-only bump to another project in the same fixed release group, ";
|
|
31
|
-
readonly NOOP_VERSION_ACTIONS: ", because this project uses docker, ";
|
|
32
30
|
};
|
|
33
31
|
interface ReleaseGroupProcessorOptions {
|
|
34
32
|
dryRun: boolean;
|
|
@@ -215,7 +213,6 @@ export declare class ReleaseGroupProcessor {
|
|
|
215
213
|
changedFiles: string[];
|
|
216
214
|
deletedFiles: string[];
|
|
217
215
|
}>;
|
|
218
|
-
processDockerProjects(): Promise<void>;
|
|
219
216
|
private processGroup;
|
|
220
217
|
private propagateChangesToDependentGroups;
|
|
221
218
|
private bumpVersions;
|
|
@@ -12,7 +12,6 @@ const project_logger_1 = require("./project-logger");
|
|
|
12
12
|
const resolve_current_version_1 = require("./resolve-current-version");
|
|
13
13
|
const topological_sort_1 = require("./topological-sort");
|
|
14
14
|
const version_actions_1 = require("./version-actions");
|
|
15
|
-
const noop_version_actions_1 = require("./noop-version-actions");
|
|
16
15
|
exports.BUMP_TYPE_REASON_TEXT = {
|
|
17
16
|
DEPENDENCY_WAS_BUMPED: ', because a dependency was bumped, ',
|
|
18
17
|
USER_SPECIFIER: ', from the given specifier, ',
|
|
@@ -21,7 +20,6 @@ exports.BUMP_TYPE_REASON_TEXT = {
|
|
|
21
20
|
VERSION_PLANS: ', read from version plan {versionPlanPath}, ',
|
|
22
21
|
DEPENDENCY_ACROSS_GROUPS_WAS_BUMPED: ', because a dependency project belonging to another release group was bumped, ',
|
|
23
22
|
OTHER_PROJECT_IN_FIXED_GROUP_WAS_BUMPED_DUE_TO_DEPENDENCY: ', because of a dependency-only bump to another project in the same fixed release group, ',
|
|
24
|
-
NOOP_VERSION_ACTIONS: ', because this project uses docker, ',
|
|
25
23
|
};
|
|
26
24
|
class ReleaseGroupProcessor {
|
|
27
25
|
constructor(tree, projectGraph, nxReleaseConfig, releaseGroups, releaseGroupToFilteredProjects, options) {
|
|
@@ -200,12 +198,7 @@ class ReleaseGroupProcessor {
|
|
|
200
198
|
if (finalConfigForProject.currentVersionResolver === 'git-tag') {
|
|
201
199
|
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
|
202
200
|
projectName: projectGraphNode.name,
|
|
203
|
-
},
|
|
204
|
-
checkAllBranchesWhen: releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen,
|
|
205
|
-
preid: this.options.preid,
|
|
206
|
-
releaseTagPatternRequireSemver: releaseGroupNode.group.releaseTagPatternRequireSemver,
|
|
207
|
-
releaseTagPatternStrictPreid: releaseGroupNode.group.releaseTagPatternStrictPreid,
|
|
208
|
-
});
|
|
201
|
+
}, releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen, releaseGroupNode.group.releaseTagPatternRequireSemver);
|
|
209
202
|
this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
|
|
210
203
|
}
|
|
211
204
|
// Cache the current version for the project
|
|
@@ -298,13 +291,7 @@ class ReleaseGroupProcessor {
|
|
|
298
291
|
if (!this.uniqueAfterAllProjectsVersioned.has(versionActionsPath)) {
|
|
299
292
|
this.uniqueAfterAllProjectsVersioned.set(versionActionsPath, afterAllProjectsVersioned);
|
|
300
293
|
}
|
|
301
|
-
|
|
302
|
-
// TODO we may need to use glob matching here rather than a simple project name lookup
|
|
303
|
-
if (finalConfigForProject.dockerOptions?.ignoreVersionActions &&
|
|
304
|
-
finalConfigForProject.dockerOptions?.ignoreVersionActions.includes(project)) {
|
|
305
|
-
versionActionsToUse = new noop_version_actions_1.NOOP_VERSION_ACTIONS(releaseGroup, projectGraphNode, finalConfigForProject);
|
|
306
|
-
}
|
|
307
|
-
this.projectsToVersionActions.set(project, versionActionsToUse);
|
|
294
|
+
this.projectsToVersionActions.set(project, versionActions);
|
|
308
295
|
});
|
|
309
296
|
}
|
|
310
297
|
}
|
|
@@ -484,34 +471,6 @@ class ReleaseGroupProcessor {
|
|
|
484
471
|
deletedFiles: Array.from(deletedFiles),
|
|
485
472
|
};
|
|
486
473
|
}
|
|
487
|
-
async processDockerProjects() {
|
|
488
|
-
const dockerProjects = new Map();
|
|
489
|
-
for (const project of this.versionData.keys()) {
|
|
490
|
-
const finalConfigForProject = this.finalConfigsByProject.get(project);
|
|
491
|
-
if (Object.keys(finalConfigForProject.dockerOptions).length === 0) {
|
|
492
|
-
continue;
|
|
493
|
-
}
|
|
494
|
-
dockerProjects.set(project, finalConfigForProject);
|
|
495
|
-
}
|
|
496
|
-
// If no docker projects to process, exit early to avoid unnecessary loading of docker handling
|
|
497
|
-
if (dockerProjects.size === 0) {
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
const { handleDockerVersion } = await Promise.resolve().then(() => require(
|
|
501
|
-
// @ts-ignore
|
|
502
|
-
'@nx/docker/release/version-utils'));
|
|
503
|
-
for (const [project, finalConfigForProject] of dockerProjects.entries()) {
|
|
504
|
-
const projectNode = this.projectGraph.nodes[project];
|
|
505
|
-
const { newVersion, logs } = await handleDockerVersion(projectNode, finalConfigForProject);
|
|
506
|
-
logs.forEach((log) => this.getProjectLoggerForProject(project).buffer(log));
|
|
507
|
-
const newVersionData = {
|
|
508
|
-
...this.versionData.get(project),
|
|
509
|
-
dockerVersion: newVersion,
|
|
510
|
-
};
|
|
511
|
-
this.versionData.set(project, newVersionData);
|
|
512
|
-
}
|
|
513
|
-
this.flushAllProjectLoggers();
|
|
514
|
-
}
|
|
515
474
|
async processGroup(releaseGroupName) {
|
|
516
475
|
const groupNode = this.groupGraph.get(releaseGroupName);
|
|
517
476
|
const bumped = await this.bumpVersions(groupNode.group);
|
|
@@ -727,14 +686,6 @@ class ReleaseGroupProcessor {
|
|
|
727
686
|
}
|
|
728
687
|
return `${log} within release group "${releaseGroup.name}"`;
|
|
729
688
|
};
|
|
730
|
-
const versionActions = this.getVersionActionsForProject(projectName);
|
|
731
|
-
if (versionActions instanceof noop_version_actions_1.NOOP_VERSION_ACTIONS) {
|
|
732
|
-
return {
|
|
733
|
-
newVersionInput: 'none',
|
|
734
|
-
newVersionInputReason: 'NOOP_VERSION_ACTIONS',
|
|
735
|
-
newVersionInputReasonData: {},
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
689
|
if (cachedFinalConfigForProject.specifierSource === 'prompt') {
|
|
739
690
|
let specifier;
|
|
740
691
|
if (releaseGroup.projectsRelationship === 'independent') {
|
|
@@ -868,12 +819,6 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
|
868
819
|
}
|
|
869
820
|
return manifestRoot;
|
|
870
821
|
});
|
|
871
|
-
// Merge docker options configured in project with release group config
|
|
872
|
-
// Project level configuration should take preference
|
|
873
|
-
const dockerOptions = {
|
|
874
|
-
...(releaseGroupVersionConfig?.docker ?? {}),
|
|
875
|
-
...(projectVersionConfig?.docker ?? {}),
|
|
876
|
-
};
|
|
877
822
|
return {
|
|
878
823
|
specifierSource,
|
|
879
824
|
currentVersionResolver,
|
|
@@ -883,7 +828,6 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
|
883
828
|
preserveLocalDependencyProtocols,
|
|
884
829
|
versionActionsOptions,
|
|
885
830
|
manifestRootsToUpdate,
|
|
886
|
-
dockerOptions,
|
|
887
831
|
};
|
|
888
832
|
}
|
|
889
833
|
async calculateNewVersion(project, newVersionInput, // any arbitrary string, whether or not it is valid is dependent upon the version actions implementation
|
|
@@ -154,6 +154,12 @@ function createAPI(overrideReleaseConfig) {
|
|
|
154
154
|
* within the context of the user's workspace.
|
|
155
155
|
*/
|
|
156
156
|
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, { silent: true });
|
|
157
|
+
const versionData = processor.getVersionData();
|
|
158
|
+
// 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
|
|
159
|
+
const gitTagValues = args.gitTag ?? nxReleaseConfig.version.git.tag
|
|
160
|
+
? (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionData)
|
|
161
|
+
: [];
|
|
162
|
+
(0, shared_1.handleDuplicateGitTags)(gitTagValues);
|
|
157
163
|
printAndFlushChanges(tree, !!args.dryRun);
|
|
158
164
|
const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
|
|
159
165
|
...nxReleaseConfig.version
|
|
@@ -162,36 +168,6 @@ function createAPI(overrideReleaseConfig) {
|
|
|
162
168
|
});
|
|
163
169
|
changed.forEach((f) => additionalChangedFiles.add(f));
|
|
164
170
|
deleted.forEach((f) => additionalDeletedFiles.add(f));
|
|
165
|
-
// After all version actions have run, process docker projects as a layer above
|
|
166
|
-
if ('docker' in nxReleaseConfig.version &&
|
|
167
|
-
nxReleaseConfig.version.docker.preVersionCommand) {
|
|
168
|
-
/**
|
|
169
|
-
* Run any configured top level docker pre-version command
|
|
170
|
-
*/
|
|
171
|
-
runPreVersionCommand(nxReleaseConfig.version.docker.preVersionCommand, {
|
|
172
|
-
dryRun: args.dryRun,
|
|
173
|
-
verbose: args.verbose,
|
|
174
|
-
}, undefined, true);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Run any configured docker pre-version command for the selected release groups
|
|
178
|
-
*/
|
|
179
|
-
for (const releaseGroup of releaseGroups) {
|
|
180
|
-
if ('docker' in releaseGroup.version &&
|
|
181
|
-
releaseGroup.version.docker.groupPreVersionCommand) {
|
|
182
|
-
runPreVersionCommand(releaseGroup.version.docker.groupPreVersionCommand, {
|
|
183
|
-
dryRun: args.dryRun,
|
|
184
|
-
verbose: args.verbose,
|
|
185
|
-
}, releaseGroup, true);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
await processor.processDockerProjects();
|
|
189
|
-
const versionData = processor.getVersionData();
|
|
190
|
-
// 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
|
|
191
|
-
const gitTagValues = args.gitTag ?? nxReleaseConfig.version.git.tag
|
|
192
|
-
? (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionData)
|
|
193
|
-
: [];
|
|
194
|
-
(0, shared_1.handleDuplicateGitTags)(gitTagValues);
|
|
195
171
|
// Only applicable when there is a single release group with a fixed relationship
|
|
196
172
|
let workspaceVersion = undefined;
|
|
197
173
|
if (releaseGroups.length === 1) {
|
|
@@ -289,13 +265,13 @@ function printAndFlushChanges(tree, isDryRun) {
|
|
|
289
265
|
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
|
|
290
266
|
}
|
|
291
267
|
}
|
|
292
|
-
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup
|
|
268
|
+
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup) {
|
|
293
269
|
if (!preVersionCommand) {
|
|
294
270
|
return;
|
|
295
271
|
}
|
|
296
272
|
output_1.output.logSingleLine(releaseGroup
|
|
297
|
-
? `Executing
|
|
298
|
-
: `Executing
|
|
273
|
+
? `Executing release group pre-version command for "${releaseGroup.name}"`
|
|
274
|
+
: `Executing pre-version command`);
|
|
299
275
|
if (verbose) {
|
|
300
276
|
console.log(`Executing the following pre-version command:`);
|
|
301
277
|
console.log(preVersionCommand);
|
package/src/config/nx-json.d.ts
CHANGED
|
@@ -62,47 +62,6 @@ export type ManifestRootToUpdate = string | {
|
|
|
62
62
|
preserveLocalDependencyProtocols: boolean;
|
|
63
63
|
};
|
|
64
64
|
export interface NxReleaseVersionConfiguration {
|
|
65
|
-
/**
|
|
66
|
-
* Configure options to handle versioning docker projects. Docker projects will be identified via the presence of a Dockerfile.
|
|
67
|
-
*/
|
|
68
|
-
docker?: {
|
|
69
|
-
/**
|
|
70
|
-
* A command to run after validation of nx release configuration, but before versioning begins.
|
|
71
|
-
* Useful for preparing docker build artifacts. If --dry-run is passed, the command is still executed,
|
|
72
|
-
* but with the NX_DRY_RUN environment variable set to 'true'.
|
|
73
|
-
*/
|
|
74
|
-
preVersionCommand?: string;
|
|
75
|
-
/**
|
|
76
|
-
* A command to run after validation of nx release configuration, but before versioning begins.
|
|
77
|
-
* Used for preparing docker build artifacts. If --dry-run is passed, the command is still executed, but
|
|
78
|
-
* with the NX_DRY_RUN environment variable set to 'true'.
|
|
79
|
-
* It will run in addition to the global `preVersionCommand`
|
|
80
|
-
*/
|
|
81
|
-
groupPreVersionCommand?: string;
|
|
82
|
-
/**
|
|
83
|
-
* Array of projects which should use a no-op VersionActions implementation rather than any potentially inferred by default or via Inference Plugins.
|
|
84
|
-
*/
|
|
85
|
-
ignoreVersionActions?: string[];
|
|
86
|
-
/**
|
|
87
|
-
* Record of named version patterns to choose between when versioning docker projects.
|
|
88
|
-
*
|
|
89
|
-
* e.g.
|
|
90
|
-
* ```
|
|
91
|
-
* "production": "{currentDate|YYMM.DD}.{shortCommitSha}",
|
|
92
|
-
* "hotfix": "{currentDate|YYMM.DD}-hotfix"
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
versionSchemes?: Record<string, string>;
|
|
96
|
-
/**
|
|
97
|
-
* Repository name for the image on the configured registry
|
|
98
|
-
*/
|
|
99
|
-
repositoryName?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Url of the Docker Image/Container Registry to push images to.
|
|
102
|
-
* Defaults to Docker Hub.
|
|
103
|
-
*/
|
|
104
|
-
registryUrl?: string;
|
|
105
|
-
};
|
|
106
65
|
/**
|
|
107
66
|
* Whether to use the legacy versioning strategy. This value was true in Nx v20 and became false in Nx v21.
|
|
108
67
|
* The legacy versioning implementation will be removed in Nx v22, as will this flag.
|
|
@@ -383,13 +342,6 @@ export interface NxReleaseConfiguration {
|
|
|
383
342
|
* - Setting it to an array of strings will cause us to check all branches WHEN the current branch matches one of the strings in the array. Glob patterns are supported.
|
|
384
343
|
*/
|
|
385
344
|
releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
|
|
386
|
-
/**
|
|
387
|
-
* By default, we will use the version defined in any existing manifest files or passed through from `nx release`.
|
|
388
|
-
*
|
|
389
|
-
* - Setting this to true will cause us to use the version calculated for corresponding docker images.
|
|
390
|
-
* - Setting it to false will use the version found within manifest files or passed through from `nx release`.
|
|
391
|
-
*/
|
|
392
|
-
releaseTagPatternPreferDockerVersion?: boolean;
|
|
393
345
|
/**
|
|
394
346
|
* By default, we will use semver when searching through the tags to find the latest matching tag.
|
|
395
347
|
*
|
|
@@ -397,26 +349,6 @@ export interface NxReleaseConfiguration {
|
|
|
397
349
|
* - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
|
|
398
350
|
*/
|
|
399
351
|
releaseTagPatternRequireSemver?: boolean;
|
|
400
|
-
/**
|
|
401
|
-
* When set to true and multiple tags match your configured "releaseTagPattern", the git tag matching logic will strictly prefer the tag which contain a semver preid which matches the one
|
|
402
|
-
* given to the nx release invocation.
|
|
403
|
-
*
|
|
404
|
-
* For example, let's say your "releaseTagPattern" is "{projectName}@{version}" and you have the following tags for project "my-lib", which uses semver:
|
|
405
|
-
* - my-lib@1.2.4-beta.1
|
|
406
|
-
* - my-lib@1.2.4-alpha.1
|
|
407
|
-
* - my-lib@1.2.3
|
|
408
|
-
*
|
|
409
|
-
* If "releaseTagPatternStrictPreid" is set to true and you run:
|
|
410
|
-
* - `nx release --preid beta`, the git tag "my-lib@1.2.4-beta.1" will be resolved.
|
|
411
|
-
* - `nx release --preid alpha`, the git tag "my-lib@1.2.4-alpha.1" will be resolved.
|
|
412
|
-
* - `nx release` (no preid), the git tag "my-lib@1.2.3" will be resolved.
|
|
413
|
-
*
|
|
414
|
-
* If "releaseTagPatternStrictPreid" is set to false, the git tag "my-lib@1.2.4-beta.1" will always be resolved as the latest tag that matches the pattern,
|
|
415
|
-
* regardless of any preid which gets passed to nx release.
|
|
416
|
-
*
|
|
417
|
-
* NOTE: This feature was added in a minor version and is therefore set to false by default, but this may change in a future major version.
|
|
418
|
-
*/
|
|
419
|
-
releaseTagPatternStrictPreid?: boolean;
|
|
420
352
|
/**
|
|
421
353
|
* Enables using version plans as a specifier source for versioning and
|
|
422
354
|
* to determine changes for changelog generation.
|
|
@@ -485,13 +417,6 @@ export interface NxReleaseConfiguration {
|
|
|
485
417
|
* - Setting it to an array of strings will cause us to check all branches WHEN the current branch matches one of the strings in the array. Glob patterns are supported.
|
|
486
418
|
*/
|
|
487
419
|
releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
|
|
488
|
-
/**
|
|
489
|
-
* By default, we will use the version defined in any existing manifest files or passed through from `nx release`.
|
|
490
|
-
*
|
|
491
|
-
* - Setting this to true will cause us to use the version calculated for corresponding docker images.
|
|
492
|
-
* - Setting it to false will use the version found within manifest files or passed through from `nx release`.
|
|
493
|
-
*/
|
|
494
|
-
releaseTagPatternPreferDockerVersion?: boolean;
|
|
495
420
|
/**
|
|
496
421
|
* By default, we will use semver when searching through the tags to find the latest matching tag.
|
|
497
422
|
*
|
|
@@ -499,26 +424,6 @@ export interface NxReleaseConfiguration {
|
|
|
499
424
|
* - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
|
|
500
425
|
*/
|
|
501
426
|
releaseTagPatternRequireSemver?: boolean;
|
|
502
|
-
/**
|
|
503
|
-
* When set to true and multiple tags match your configured "releaseTagPattern", the git tag matching logic will strictly prefer the tag which contain a semver preid which matches the one
|
|
504
|
-
* given to the nx release invocation.
|
|
505
|
-
*
|
|
506
|
-
* For example, let's say your "releaseTagPattern" is "{projectName}@{version}" and you have the following tags for project "my-lib", which uses semver:
|
|
507
|
-
* - my-lib@1.2.4-beta.1
|
|
508
|
-
* - my-lib@1.2.4-alpha.1
|
|
509
|
-
* - my-lib@1.2.3
|
|
510
|
-
*
|
|
511
|
-
* If "releaseTagPatternStrictPreid" is set to true and you run:
|
|
512
|
-
* - `nx release --preid beta`, the git tag "my-lib@1.2.4-beta.1" will be resolved.
|
|
513
|
-
* - `nx release --preid alpha`, the git tag "my-lib@1.2.4-alpha.1" will be resolved.
|
|
514
|
-
* - `nx release` (no preid), the git tag "my-lib@1.2.3" will be resolved.
|
|
515
|
-
*
|
|
516
|
-
* If "releaseTagPatternStrictPreid" is set to false, the git tag "my-lib@1.2.4-beta.1" will always be resolved as the latest tag that matches the pattern,
|
|
517
|
-
* regardless of any preid which gets passed to nx release.
|
|
518
|
-
*
|
|
519
|
-
* NOTE: This feature was added in a minor version and is therefore set to false by default, but this may change in a future major version.
|
|
520
|
-
*/
|
|
521
|
-
releaseTagPatternStrictPreid?: boolean;
|
|
522
427
|
/**
|
|
523
428
|
* Enable and configure automatic git operations as part of the release
|
|
524
429
|
*/
|
package/src/native/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare class AppLifeCycle {
|
|
|
22
22
|
setTaskStatus(taskId: string, status: TaskStatus): void
|
|
23
23
|
registerForcedShutdownCallback(forcedShutdownCallback: () => any): void
|
|
24
24
|
__setCloudMessage(message: string): Promise<void>
|
|
25
|
+
setEstimatedTaskTimings(timings: Record<string, number>): void
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export declare class ChildProcess {
|
|
Binary file
|
|
@@ -41,6 +41,7 @@ export interface LifeCycle {
|
|
|
41
41
|
appendTaskOutput?(taskId: string, output: string, isPtyTask: boolean): void;
|
|
42
42
|
setTaskStatus?(taskId: string, status: NativeTaskStatus): void;
|
|
43
43
|
registerForcedShutdownCallback?(callback: () => void): void;
|
|
44
|
+
setEstimatedTaskTimings?(timings: Record<string, number>): void;
|
|
44
45
|
}
|
|
45
46
|
export declare class CompositeLifeCycle implements LifeCycle {
|
|
46
47
|
private readonly lifeCycles;
|
|
@@ -58,4 +59,5 @@ export declare class CompositeLifeCycle implements LifeCycle {
|
|
|
58
59
|
appendTaskOutput(taskId: string, output: string, isPtyTask: boolean): void;
|
|
59
60
|
setTaskStatus(taskId: string, status: NativeTaskStatus): void;
|
|
60
61
|
registerForcedShutdownCallback(callback: () => void): void;
|
|
62
|
+
setEstimatedTaskTimings(timings: Record<string, number>): void;
|
|
61
63
|
}
|
|
@@ -102,5 +102,12 @@ class CompositeLifeCycle {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
setEstimatedTaskTimings(timings) {
|
|
106
|
+
for (let l of this.lifeCycles) {
|
|
107
|
+
if (l.setEstimatedTaskTimings) {
|
|
108
|
+
l.setEstimatedTaskTimings(timings);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
105
112
|
}
|
|
106
113
|
exports.CompositeLifeCycle = CompositeLifeCycle;
|
|
@@ -66,6 +66,11 @@ class TaskOrchestrator {
|
|
|
66
66
|
}),
|
|
67
67
|
'init' in this.cache ? this.cache.init() : null,
|
|
68
68
|
]);
|
|
69
|
+
// Pass estimated timings to TUI after TasksSchedule is initialized
|
|
70
|
+
if (this.tuiEnabled) {
|
|
71
|
+
const estimatedTimings = this.tasksSchedule.getEstimatedTaskTimings();
|
|
72
|
+
this.options.lifeCycle.setEstimatedTaskTimings(estimatedTimings);
|
|
73
|
+
}
|
|
69
74
|
}
|
|
70
75
|
async run() {
|
|
71
76
|
await this.init();
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { VersionActions } from './version-actions';
|
|
2
|
-
import { Tree } from '../../../generators/tree';
|
|
3
|
-
import { NxReleaseVersionConfiguration } from '../../../config/nx-json';
|
|
4
|
-
import { ProjectGraph } from '../../../config/project-graph';
|
|
5
|
-
export declare class NOOP_VERSION_ACTIONS extends VersionActions {
|
|
6
|
-
validManifestFilenames: any;
|
|
7
|
-
readCurrentVersionFromRegistry(tree: Tree, currentVersionResolverMetadata: NxReleaseVersionConfiguration['currentVersionResolverMetadata']): Promise<{
|
|
8
|
-
currentVersion: string | null;
|
|
9
|
-
logText: string;
|
|
10
|
-
} | null>;
|
|
11
|
-
readCurrentVersionFromSourceManifest(tree: Tree): Promise<{
|
|
12
|
-
currentVersion: string;
|
|
13
|
-
manifestPath: string;
|
|
14
|
-
} | null>;
|
|
15
|
-
readCurrentVersionOfDependency(tree: Tree, projectGraph: ProjectGraph, dependencyProjectName: string): Promise<{
|
|
16
|
-
currentVersion: string | null;
|
|
17
|
-
dependencyCollection: string | null;
|
|
18
|
-
}>;
|
|
19
|
-
calculateNewVersion(currentVersion: string | null, newVersionInput: string, newVersionInputReason: string, newVersionInputReasonData: Record<string, unknown>, preid: string): Promise<{
|
|
20
|
-
newVersion: string;
|
|
21
|
-
logText: string;
|
|
22
|
-
}>;
|
|
23
|
-
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>): Promise<string[]>;
|
|
24
|
-
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
25
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NOOP_VERSION_ACTIONS = void 0;
|
|
4
|
-
const version_actions_1 = require("./version-actions");
|
|
5
|
-
class NOOP_VERSION_ACTIONS extends version_actions_1.VersionActions {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.validManifestFilenames = null;
|
|
9
|
-
}
|
|
10
|
-
readCurrentVersionFromRegistry(tree, currentVersionResolverMetadata) {
|
|
11
|
-
return Promise.resolve(null);
|
|
12
|
-
}
|
|
13
|
-
readCurrentVersionFromSourceManifest(tree) {
|
|
14
|
-
return Promise.resolve(null);
|
|
15
|
-
}
|
|
16
|
-
readCurrentVersionOfDependency(tree, projectGraph, dependencyProjectName) {
|
|
17
|
-
return Promise.resolve({
|
|
18
|
-
currentVersion: null,
|
|
19
|
-
dependencyCollection: null,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
async calculateNewVersion(currentVersion, newVersionInput, newVersionInputReason, newVersionInputReasonData, preid) {
|
|
23
|
-
return Promise.resolve({
|
|
24
|
-
newVersion: '0.0.0',
|
|
25
|
-
logText: 'Skipped default versioning as no-op.',
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
updateProjectDependencies(tree, projectGraph, dependenciesToUpdate) {
|
|
29
|
-
return Promise.resolve([]);
|
|
30
|
-
}
|
|
31
|
-
updateProjectVersion(tree, newVersion) {
|
|
32
|
-
return Promise.resolve([]);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.NOOP_VERSION_ACTIONS = NOOP_VERSION_ACTIONS;
|