nx 21.3.0-beta.6 → 21.3.0-canary.20250613-18155f4
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/bin/init-local.js +0 -6
- package/bin/nx.js +9 -5
- package/package.json +12 -12
- package/release/changelog-renderer/index.js +2 -10
- package/src/adapter/decorate-cli.js +1 -2
- package/src/adapter/ngcli-adapter.d.ts +0 -11
- package/src/adapter/ngcli-adapter.js +7 -101
- package/src/command-line/affected/affected.js +1 -1
- package/src/command-line/{nx-cloud/connect → connect}/command-object.js +4 -4
- package/src/command-line/{nx-cloud/connect → connect}/connect-to-nx-cloud.d.ts +4 -4
- package/src/command-line/{nx-cloud/connect → connect}/connect-to-nx-cloud.js +10 -10
- package/src/command-line/{nx-cloud/connect → connect}/view-logs.js +6 -6
- package/src/command-line/format/command-object.js +6 -12
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
- package/src/command-line/init/implementation/angular/index.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
- package/src/command-line/init/implementation/utils.js +1 -1
- package/src/command-line/init/init-v2.js +1 -1
- package/src/command-line/{nx-cloud/login → login}/command-object.js +1 -1
- package/src/command-line/login/login.js +19 -0
- package/src/command-line/{nx-cloud/logout → logout}/command-object.js +1 -1
- package/src/command-line/{nx-cloud/utils.js → logout/logout.js} +4 -4
- package/src/command-line/migrate/migrate-ui-api.d.ts +3 -20
- package/src/command-line/migrate/migrate-ui-api.js +12 -115
- package/src/command-line/migrate/migrate.js +1 -1
- package/src/command-line/nx-commands.js +6 -12
- package/src/command-line/release/changelog.js +13 -3
- package/src/command-line/release/config/config.js +0 -12
- package/src/command-line/release/utils/git.d.ts +1 -1
- package/src/command-line/release/utils/git.js +10 -18
- package/src/command-line/release/utils/shared.js +1 -7
- package/src/command-line/release/version/release-group-processor.js +1 -1
- package/src/command-line/run/run-one.js +1 -1
- package/src/command-line/run-many/run-many.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +0 -1
- package/src/command-line/yargs-utils/shared-options.js +0 -5
- package/src/config/nx-json.d.ts +0 -14
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/server/server.js +1 -7
- package/src/native/index.d.ts +1 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +0 -1
- package/src/plugins/js/lock-file/lock-file.js +0 -2
- package/src/plugins/js/lock-file/npm-parser.js +3 -42
- package/src/plugins/js/lock-file/pnpm-parser.js +16 -43
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +1 -4
- package/src/plugins/js/lock-file/project-graph-pruning.js +5 -32
- package/src/plugins/js/lock-file/yarn-parser.js +7 -19
- package/src/plugins/package-json/create-nodes.js +1 -4
- package/src/tasks-runner/forked-process-task-runner.js +0 -4
- package/src/tasks-runner/is-tui-enabled.js +0 -8
- package/src/tasks-runner/run-command.js +1 -1
- package/src/tasks-runner/running-tasks/node-child-process.d.ts +0 -2
- package/src/tasks-runner/running-tasks/node-child-process.js +2 -16
- package/src/tasks-runner/task-orchestrator.js +1 -7
- package/src/utils/command-line-utils.d.ts +0 -1
- package/src/utils/package-json.js +1 -1
- package/src/utils/package-manager.d.ts +0 -1
- package/src/utils/package-manager.js +1 -10
- package/src/utils/project-graph-utils.d.ts +1 -6
- package/src/utils/project-graph-utils.js +6 -11
- package/src/utils/workspace-context.js +1 -1
- package/src/command-line/migrate/run-migration-process.js +0 -85
- package/src/command-line/nx-cloud/fix-ci/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/fix-ci/command-object.js +0 -12
- package/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +0 -4
- package/src/command-line/nx-cloud/fix-ci/fix-ci.js +0 -7
- package/src/command-line/nx-cloud/login/login.js +0 -10
- package/src/command-line/nx-cloud/logout/logout.js +0 -7
- package/src/command-line/nx-cloud/record/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/record/command-object.js +0 -12
- package/src/command-line/nx-cloud/record/record.d.ts +0 -4
- package/src/command-line/nx-cloud/record/record.js +0 -7
- package/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +0 -2
- package/src/command-line/nx-cloud/start-ci-run/command-object.js +0 -12
- package/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +0 -4
- package/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +0 -7
- package/src/command-line/nx-cloud/utils.d.ts +0 -1
- package/src/plugins/js/utils/get-workspace-packages-from-graph.d.ts +0 -2
- package/src/plugins/js/utils/get-workspace-packages-from-graph.js +0 -13
- /package/src/command-line/{nx-cloud/connect → connect}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/connect → connect}/view-logs.d.ts +0 -0
- /package/src/command-line/{nx-cloud/login → login}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/login → login}/login.d.ts +0 -0
- /package/src/command-line/{nx-cloud/logout → logout}/command-object.d.ts +0 -0
- /package/src/command-line/{nx-cloud/logout → logout}/logout.d.ts +0 -0
@@ -9,18 +9,12 @@ exports.addSuccessfulMigration = addSuccessfulMigration;
|
|
9
9
|
exports.updateRefForSuccessfulMigration = updateRefForSuccessfulMigration;
|
10
10
|
exports.addFailedMigration = addFailedMigration;
|
11
11
|
exports.addSkippedMigration = addSkippedMigration;
|
12
|
-
exports.addStoppedMigration = addStoppedMigration;
|
13
12
|
exports.readMigrationsJsonMetadata = readMigrationsJsonMetadata;
|
14
13
|
exports.undoMigration = undoMigration;
|
15
|
-
exports.killMigrationProcess = killMigrationProcess;
|
16
|
-
exports.stopMigration = stopMigration;
|
17
14
|
const child_process_1 = require("child_process");
|
18
15
|
const fs_1 = require("fs");
|
19
16
|
const path_1 = require("path");
|
20
17
|
const migrate_1 = require("./migrate");
|
21
|
-
let currentMigrationProcess = null;
|
22
|
-
let currentMigrationId = null;
|
23
|
-
let migrationCancelled = false;
|
24
18
|
function recordInitialMigrationMetadata(workspacePath, versionToMigrateTo) {
|
25
19
|
const migrationsJsonPath = (0, path_1.join)(workspacePath, 'migrations.json');
|
26
20
|
const parsedMigrationsJson = JSON.parse((0, fs_1.readFileSync)(migrationsJsonPath, 'utf-8'));
|
@@ -69,62 +63,20 @@ function finishMigrationProcess(workspacePath, squashCommits, commitMessage) {
|
|
69
63
|
}
|
70
64
|
async function runSingleMigration(workspacePath, migration, configuration) {
|
71
65
|
try {
|
72
|
-
// Set current migration tracking
|
73
|
-
currentMigrationId = migration.id;
|
74
|
-
migrationCancelled = false;
|
75
66
|
modifyMigrationsJsonMetadata(workspacePath, addRunningMigration(migration.id));
|
76
67
|
const gitRefBefore = (0, child_process_1.execSync)('git rev-parse HEAD', {
|
77
68
|
cwd: workspacePath,
|
78
69
|
encoding: 'utf-8',
|
79
70
|
}).trim();
|
80
|
-
//
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
migration.package,
|
87
|
-
migration.name,
|
88
|
-
migration.version,
|
89
|
-
configuration.createCommits.toString(),
|
90
|
-
configuration.commitPrefix || 'chore: [nx migration] ',
|
91
|
-
], {
|
71
|
+
// For Migrate UI, this current module is loaded either from:
|
72
|
+
// 1. The CLI path to the migrated modules. The version of Nx is of the user's choosing. This may or may not have the new migrate API, so Console will check that `runSingleMigration` exists before using it.
|
73
|
+
// 2. Bundled into Console, so the version is fixed to what we build Console with.
|
74
|
+
const updatedMigrateModule = await Promise.resolve().then(() => require('./migrate.js'));
|
75
|
+
const { changes: fileChanges, nextSteps } = await updatedMigrateModule.runNxOrAngularMigration(workspacePath, migration, false, configuration.createCommits, configuration.commitPrefix || 'chore: [nx migration] ', undefined, true);
|
76
|
+
const gitRefAfter = (0, child_process_1.execSync)('git rev-parse HEAD', {
|
92
77
|
cwd: workspacePath,
|
93
|
-
|
94
|
-
});
|
95
|
-
// Track the process for cancellation
|
96
|
-
currentMigrationProcess = migrationProcess;
|
97
|
-
// Handle process output
|
98
|
-
let output = '';
|
99
|
-
migrationProcess.stdout.on('data', (data) => {
|
100
|
-
output += data.toString();
|
101
|
-
});
|
102
|
-
migrationProcess.stderr.on('data', (data) => {
|
103
|
-
console.error('Migration stderr:', data.toString());
|
104
|
-
});
|
105
|
-
// Wait for the process to complete
|
106
|
-
const exitCode = await new Promise((resolve, reject) => {
|
107
|
-
migrationProcess.on('close', (code) => {
|
108
|
-
resolve(code);
|
109
|
-
});
|
110
|
-
migrationProcess.on('error', (error) => {
|
111
|
-
reject(error);
|
112
|
-
});
|
113
|
-
});
|
114
|
-
currentMigrationProcess = null;
|
115
|
-
if (exitCode !== 0) {
|
116
|
-
throw new Error(`Migration process exited with code ${exitCode}`);
|
117
|
-
}
|
118
|
-
// Parse the result from the migration process (extract the JSON output)
|
119
|
-
const jsonStr = output
|
120
|
-
.trim()
|
121
|
-
.split('\n')
|
122
|
-
.find((line) => line.startsWith('{'));
|
123
|
-
const result = JSON.parse(jsonStr);
|
124
|
-
if (result.type === 'error') {
|
125
|
-
throw new Error(result.message);
|
126
|
-
}
|
127
|
-
const { fileChanges, gitRefAfter, nextSteps } = result;
|
78
|
+
encoding: 'utf-8',
|
79
|
+
}).trim();
|
128
80
|
modifyMigrationsJsonMetadata(workspacePath, addSuccessfulMigration(migration.id, fileChanges.map((change) => ({
|
129
81
|
path: change.path,
|
130
82
|
type: change.type,
|
@@ -147,21 +99,9 @@ async function runSingleMigration(workspacePath, migration, configuration) {
|
|
147
99
|
}
|
148
100
|
}
|
149
101
|
catch (e) {
|
150
|
-
|
151
|
-
if (migrationCancelled && currentMigrationId === migration.id) {
|
152
|
-
// Migration was stopped by user, don't add as failed since it's already marked as stopped
|
153
|
-
console.log(`Migration ${migration.id} was stopped by user`);
|
154
|
-
}
|
155
|
-
else {
|
156
|
-
// Migration failed normally
|
157
|
-
modifyMigrationsJsonMetadata(workspacePath, addFailedMigration(migration.id, e.message));
|
158
|
-
}
|
102
|
+
modifyMigrationsJsonMetadata(workspacePath, addFailedMigration(migration.id, e.message));
|
159
103
|
}
|
160
104
|
finally {
|
161
|
-
// Clear the tracking variables
|
162
|
-
currentMigrationProcess = null;
|
163
|
-
currentMigrationId = null;
|
164
|
-
migrationCancelled = false;
|
165
105
|
modifyMigrationsJsonMetadata(workspacePath, removeRunningMigration(migration.id));
|
166
106
|
(0, child_process_1.execSync)('git add migrations.json', {
|
167
107
|
cwd: workspacePath,
|
@@ -247,23 +187,6 @@ function addSkippedMigration(id) {
|
|
247
187
|
return copied;
|
248
188
|
};
|
249
189
|
}
|
250
|
-
function addStoppedMigration(id, error) {
|
251
|
-
return (migrationsJsonMetadata) => {
|
252
|
-
const copied = { ...migrationsJsonMetadata };
|
253
|
-
if (!copied.completedMigrations) {
|
254
|
-
copied.completedMigrations = {};
|
255
|
-
}
|
256
|
-
copied.completedMigrations = {
|
257
|
-
...copied.completedMigrations,
|
258
|
-
[id]: {
|
259
|
-
type: 'stopped',
|
260
|
-
name: id,
|
261
|
-
error,
|
262
|
-
},
|
263
|
-
};
|
264
|
-
return copied;
|
265
|
-
};
|
266
|
-
}
|
267
190
|
function addRunningMigration(id) {
|
268
191
|
return (migrationsJsonMetadata) => {
|
269
192
|
migrationsJsonMetadata.runningMigrations = [
|
@@ -277,6 +200,9 @@ function removeRunningMigration(id) {
|
|
277
200
|
return (migrationsJsonMetadata) => {
|
278
201
|
migrationsJsonMetadata.runningMigrations =
|
279
202
|
migrationsJsonMetadata.runningMigrations?.filter((n) => n !== id);
|
203
|
+
if (migrationsJsonMetadata.runningMigrations?.length === 0) {
|
204
|
+
delete migrationsJsonMetadata.runningMigrations;
|
205
|
+
}
|
280
206
|
return migrationsJsonMetadata;
|
281
207
|
};
|
282
208
|
}
|
@@ -300,32 +226,3 @@ function undoMigration(workspacePath, id) {
|
|
300
226
|
return migrationsJsonMetadata;
|
301
227
|
};
|
302
228
|
}
|
303
|
-
function killMigrationProcess(migrationId, workspacePath) {
|
304
|
-
try {
|
305
|
-
if (workspacePath) {
|
306
|
-
modifyMigrationsJsonMetadata(workspacePath, stopMigration(migrationId));
|
307
|
-
}
|
308
|
-
// Check if this is the currently running migration and kill the process
|
309
|
-
if (currentMigrationId === migrationId && currentMigrationProcess) {
|
310
|
-
currentMigrationProcess.kill('SIGTERM');
|
311
|
-
// Some processes may not respond to SIGTERM immediately,
|
312
|
-
// so we give it a short timeout before forcefully killing it
|
313
|
-
setTimeout(() => {
|
314
|
-
if (currentMigrationProcess && !currentMigrationProcess.killed) {
|
315
|
-
currentMigrationProcess.kill('SIGKILL');
|
316
|
-
}
|
317
|
-
}, 2000);
|
318
|
-
}
|
319
|
-
return true;
|
320
|
-
}
|
321
|
-
catch (error) {
|
322
|
-
console.error(`Failed to stop migration ${migrationId}:`, error);
|
323
|
-
return false;
|
324
|
-
}
|
325
|
-
}
|
326
|
-
function stopMigration(migrationId) {
|
327
|
-
return (migrationsJsonMetadata) => {
|
328
|
-
const updated = addStoppedMigration(migrationId, 'Migration was stopped by user')(migrationsJsonMetadata);
|
329
|
-
return removeRunningMigration(migrationId)(updated);
|
330
|
-
};
|
331
|
-
}
|
@@ -24,7 +24,7 @@ const git_utils_1 = require("../../utils/git-utils");
|
|
24
24
|
const package_json_1 = require("../../utils/package-json");
|
25
25
|
const package_manager_1 = require("../../utils/package-manager");
|
26
26
|
const handle_errors_1 = require("../../utils/handle-errors");
|
27
|
-
const connect_to_nx_cloud_1 = require("../
|
27
|
+
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
28
28
|
const output_1 = require("../../utils/output");
|
29
29
|
const fs_1 = require("fs");
|
30
30
|
const workspace_root_1 = require("../../utils/workspace-root");
|
@@ -5,7 +5,7 @@ const chalk = require("chalk");
|
|
5
5
|
const yargs = require("yargs");
|
6
6
|
const command_object_1 = require("./register/command-object");
|
7
7
|
const command_object_2 = require("./affected/command-object");
|
8
|
-
const command_object_3 = require("./
|
8
|
+
const command_object_3 = require("./connect/command-object");
|
9
9
|
const command_object_4 = require("./daemon/command-object");
|
10
10
|
const command_object_5 = require("./graph/command-object");
|
11
11
|
const command_object_6 = require("./exec/command-object");
|
@@ -25,13 +25,10 @@ const command_object_19 = require("./watch/command-object");
|
|
25
25
|
const command_object_20 = require("./reset/command-object");
|
26
26
|
const command_object_21 = require("./release/command-object");
|
27
27
|
const command_object_22 = require("./add/command-object");
|
28
|
-
const command_object_23 = require("./
|
29
|
-
const command_object_24 = require("./
|
30
|
-
const command_object_25 = require("./nx-cloud/record/command-object");
|
31
|
-
const command_object_26 = require("./nx-cloud/start-ci-run/command-object");
|
32
|
-
const command_object_27 = require("./nx-cloud/fix-ci/command-object");
|
28
|
+
const command_object_23 = require("./login/command-object");
|
29
|
+
const command_object_24 = require("./logout/command-object");
|
33
30
|
const command_objects_1 = require("./deprecated/command-objects");
|
34
|
-
const
|
31
|
+
const command_object_25 = require("./sync/command-object");
|
35
32
|
const output_1 = require("../utils/output");
|
36
33
|
// Ensure that the output takes up the available width of the terminal.
|
37
34
|
yargs.wrap(yargs.terminalWidth());
|
@@ -78,16 +75,13 @@ exports.commandsObject = yargs
|
|
78
75
|
.command(command_object_16.yargsRunCommand)
|
79
76
|
.command(command_object_17.yargsRunManyCommand)
|
80
77
|
.command(command_object_18.yargsShowCommand)
|
81
|
-
.command(
|
82
|
-
.command(
|
78
|
+
.command(command_object_25.yargsSyncCommand)
|
79
|
+
.command(command_object_25.yargsSyncCheckCommand)
|
83
80
|
.command(command_object_3.yargsViewLogsCommand)
|
84
81
|
.command(command_object_19.yargsWatchCommand)
|
85
82
|
.command(command_object_16.yargsNxInfixCommand)
|
86
83
|
.command(command_object_23.yargsLoginCommand)
|
87
84
|
.command(command_object_24.yargsLogoutCommand)
|
88
|
-
.command(command_object_25.yargsRecordCommand)
|
89
|
-
.command(command_object_26.yargsStartCiRunCommand)
|
90
|
-
.command(command_object_27.yargsFixCiCommand)
|
91
85
|
.command(resolveConformanceCommandObject())
|
92
86
|
.command(resolveConformanceCheckCommandObject())
|
93
87
|
.scriptName('nx')
|
@@ -5,6 +5,7 @@ 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");
|
8
9
|
const tmp_1 = require("tmp");
|
9
10
|
const nx_json_1 = require("../../config/nx-json");
|
10
11
|
const tree_1 = require("../../generators/tree");
|
@@ -191,7 +192,7 @@ function createAPI(overrideReleaseConfig) {
|
|
191
192
|
}
|
192
193
|
else {
|
193
194
|
let workspaceChangelogFromRef = args.from ||
|
194
|
-
(await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {}, nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen
|
195
|
+
(await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {}, nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen))?.tag;
|
195
196
|
if (!workspaceChangelogFromRef) {
|
196
197
|
if (useAutomaticFromRef) {
|
197
198
|
workspaceChangelogFromRef = await (0, git_1.getFirstGitCommit)();
|
@@ -326,7 +327,7 @@ function createAPI(overrideReleaseConfig) {
|
|
326
327
|
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {
|
327
328
|
projectName: project.name,
|
328
329
|
releaseGroupName: releaseGroup.name,
|
329
|
-
}, releaseGroup.releaseTagPatternCheckAllBranchesWhen
|
330
|
+
}, releaseGroup.releaseTagPatternCheckAllBranchesWhen))?.tag;
|
330
331
|
if (!fromRef && useAutomaticFromRef) {
|
331
332
|
const firstCommit = await (0, git_1.getFirstGitCommit)();
|
332
333
|
commits = await filterProjectCommits({
|
@@ -436,7 +437,7 @@ function createAPI(overrideReleaseConfig) {
|
|
436
437
|
}
|
437
438
|
else {
|
438
439
|
let fromRef = args.from ||
|
439
|
-
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {}, releaseGroup.releaseTagPatternCheckAllBranchesWhen
|
440
|
+
(await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {}, releaseGroup.releaseTagPatternCheckAllBranchesWhen))?.tag;
|
440
441
|
if (!fromRef) {
|
441
442
|
if (useAutomaticFromRef) {
|
442
443
|
fromRef = await (0, git_1.getFirstGitCommit)();
|
@@ -501,6 +502,15 @@ function resolveChangelogVersions(args, releaseGroups, releaseGroupToFilteredPro
|
|
501
502
|
if (!args.version && !args.versionData) {
|
502
503
|
throw new Error(`You must provide a version string and/or a versionData object.`);
|
503
504
|
}
|
505
|
+
/**
|
506
|
+
* TODO: revaluate this assumption holistically in a dedicated PR when we add support for calver
|
507
|
+
* (e.g. the Release class also uses semver utils to check if prerelease).
|
508
|
+
*
|
509
|
+
* Right now, the given version must be valid semver in order to proceed
|
510
|
+
*/
|
511
|
+
if (args.version && !(0, semver_1.valid)(args.version)) {
|
512
|
+
throw new Error(`The given version "${args.version}" is not a valid semver version. Please provide your version in the format "1.0.0", "1.0.0-beta.1" etc`);
|
513
|
+
}
|
504
514
|
const versionData = releaseGroups.reduce((versionData, releaseGroup) => {
|
505
515
|
const releaseGroupProjectNames = Array.from(releaseGroupToFilteredProjects.get(releaseGroup));
|
506
516
|
for (const projectName of releaseGroupProjectNames) {
|
@@ -118,7 +118,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
118
118
|
*/
|
119
119
|
const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}';
|
120
120
|
const defaultIndependentReleaseTagPattern = '{projectName}@{version}';
|
121
|
-
const defaultReleaseTagPatternRequireSemver = true;
|
122
121
|
const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed';
|
123
122
|
const defaultGeneratorOptions = {};
|
124
123
|
if (userConfig.version?.conventionalCommits) {
|
@@ -201,15 +200,11 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
201
200
|
? defaultIndependentReleaseTagPattern
|
202
201
|
: defaultFixedReleaseTagPattern),
|
203
202
|
releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
|
204
|
-
releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
|
205
|
-
defaultReleaseTagPatternRequireSemver,
|
206
203
|
conventionalCommits: conventional_commits_1.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
|
207
204
|
versionPlans: (userConfig.versionPlans ||
|
208
205
|
false),
|
209
206
|
};
|
210
207
|
const groupProjectsRelationship = userConfig.projectsRelationship || WORKSPACE_DEFAULTS.projectsRelationship;
|
211
|
-
const groupReleaseTagPatternRequireSemver = userConfig.releaseTagPatternRequireSemver ??
|
212
|
-
WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver;
|
213
208
|
const GROUP_DEFAULTS = {
|
214
209
|
projectsRelationship: groupProjectsRelationship,
|
215
210
|
version: USE_LEGACY_VERSIONING
|
@@ -243,7 +238,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
243
238
|
? defaultIndependentReleaseTagPattern
|
244
239
|
: WORKSPACE_DEFAULTS.releaseTagPattern,
|
245
240
|
releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
|
246
|
-
releaseTagPatternRequireSemver: groupReleaseTagPatternRequireSemver,
|
247
241
|
versionPlans: false,
|
248
242
|
};
|
249
243
|
/**
|
@@ -345,8 +339,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
345
339
|
version: deepMergeDefaults([GROUP_DEFAULTS.version], rootVersionWithoutGlobalOptions),
|
346
340
|
// If the user has set something custom for releaseTagPattern at the top level, respect it for the implicit default group
|
347
341
|
releaseTagPattern: userConfig.releaseTagPattern || GROUP_DEFAULTS.releaseTagPattern,
|
348
|
-
releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
|
349
|
-
GROUP_DEFAULTS.releaseTagPatternRequireSemver,
|
350
342
|
// Directly inherit the root level config for projectChangelogs, if set
|
351
343
|
changelog: rootChangelogConfig.projectChangelogs || false,
|
352
344
|
versionPlans: rootVersionPlansConfig || GROUP_DEFAULTS.versionPlans,
|
@@ -426,9 +418,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
426
418
|
releaseTagPatternCheckAllBranchesWhen: releaseGroup.releaseTagPatternCheckAllBranchesWhen ??
|
427
419
|
userConfig.releaseTagPatternCheckAllBranchesWhen ??
|
428
420
|
undefined,
|
429
|
-
releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver ??
|
430
|
-
userConfig.releaseTagPatternRequireSemver ??
|
431
|
-
defaultReleaseTagPatternRequireSemver,
|
432
421
|
versionPlans: releaseGroup.versionPlans ?? rootVersionPlansConfig,
|
433
422
|
};
|
434
423
|
const finalReleaseGroup = deepMergeDefaults([groupDefaults], {
|
@@ -502,7 +491,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
|
|
502
491
|
projectsRelationship: WORKSPACE_DEFAULTS.projectsRelationship,
|
503
492
|
releaseTagPattern: WORKSPACE_DEFAULTS.releaseTagPattern,
|
504
493
|
releaseTagPatternCheckAllBranchesWhen: WORKSPACE_DEFAULTS.releaseTagPatternCheckAllBranchesWhen,
|
505
|
-
releaseTagPatternRequireSemver: WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver,
|
506
494
|
git: rootGitConfig,
|
507
495
|
version: rootVersionConfig,
|
508
496
|
changelog: rootChangelogConfig,
|
@@ -22,7 +22,7 @@ export interface GitCommit extends RawGitCommit {
|
|
22
22
|
affectedFiles: string[];
|
23
23
|
revertedHashes: string[];
|
24
24
|
}
|
25
|
-
export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}, checkAllBranchesWhen?: boolean | string[]
|
25
|
+
export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}, checkAllBranchesWhen?: boolean | string[]): Promise<{
|
26
26
|
tag: string;
|
27
27
|
extractedVersion: string;
|
28
28
|
} | null>;
|
@@ -26,7 +26,7 @@ function escapeRegExp(string) {
|
|
26
26
|
}
|
27
27
|
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
28
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;
|
29
|
-
async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, checkAllBranchesWhen
|
29
|
+
async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, checkAllBranchesWhen) {
|
30
30
|
/**
|
31
31
|
* By default, we will try and resolve the latest match for the releaseTagPattern from the current branch,
|
32
32
|
* falling back to all branches if no match is found on the current branch.
|
@@ -105,25 +105,17 @@ async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolat
|
|
105
105
|
const tagRegexp = `^${escapeRegExp(interpolatedTagPattern)
|
106
106
|
.replace('%v%', '(.+)')
|
107
107
|
.replace('%p%', '(.+)')}`;
|
108
|
-
const
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
}
|
114
|
-
else {
|
115
|
-
return !!tag.match(tagRegexp);
|
116
|
-
}
|
117
|
-
});
|
118
|
-
if (!matchingTags.length) {
|
108
|
+
const matchingSemverTags = tags.filter((tag) =>
|
109
|
+
// Do the match against SEMVER_REGEX to ensure that we skip tags that aren't valid semver versions
|
110
|
+
!!tag.match(tagRegexp) &&
|
111
|
+
tag.match(tagRegexp).some((r) => r.match(SEMVER_REGEX)));
|
112
|
+
if (!matchingSemverTags.length) {
|
119
113
|
return null;
|
120
114
|
}
|
121
|
-
const [latestMatchingTag, ...rest] =
|
122
|
-
const version =
|
123
|
-
|
124
|
-
|
125
|
-
})[0]
|
126
|
-
: rest[0];
|
115
|
+
const [latestMatchingTag, ...rest] = matchingSemverTags[0].match(tagRegexp);
|
116
|
+
const version = rest.filter((r) => {
|
117
|
+
return r.match(SEMVER_REGEX);
|
118
|
+
})[0];
|
127
119
|
return {
|
128
120
|
tag: latestMatchingTag,
|
129
121
|
extractedVersion: version,
|
@@ -15,13 +15,7 @@ const git_1 = require("./git");
|
|
15
15
|
exports.noDiffInChangelogMessage = chalk.yellow(`NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?`);
|
16
16
|
function isPrerelease(version) {
|
17
17
|
// prerelease returns an array of matching prerelease "components", or null if the version is not a prerelease
|
18
|
-
|
19
|
-
return (0, semver_1.prerelease)(version) !== null;
|
20
|
-
}
|
21
|
-
catch {
|
22
|
-
// If non-semver, prerelease will error. Prevent this from erroring the command
|
23
|
-
return false;
|
24
|
-
}
|
18
|
+
return (0, semver_1.prerelease)(version) !== null;
|
25
19
|
}
|
26
20
|
class ReleaseVersion {
|
27
21
|
constructor({ version, // short form version string with no prefixes or patterns, e.g. 1.0.0
|
@@ -198,7 +198,7 @@ class ReleaseGroupProcessor {
|
|
198
198
|
if (finalConfigForProject.currentVersionResolver === 'git-tag') {
|
199
199
|
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
200
200
|
projectName: projectGraphNode.name,
|
201
|
-
}, releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen
|
201
|
+
}, releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen);
|
202
202
|
this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
|
203
203
|
}
|
204
204
|
// Cache the current version for the project
|
@@ -4,7 +4,7 @@ exports.runOne = runOne;
|
|
4
4
|
exports.parseRunOneOptions = parseRunOneOptions;
|
5
5
|
const run_command_1 = require("../../tasks-runner/run-command");
|
6
6
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
7
|
-
const connect_to_nx_cloud_1 = require("../
|
7
|
+
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
8
8
|
const project_graph_1 = require("../../project-graph/project-graph");
|
9
9
|
const workspace_root_1 = require("../../utils/workspace-root");
|
10
10
|
const split_target_1 = require("../../utils/split-target");
|
@@ -5,7 +5,7 @@ exports.projectsToRun = projectsToRun;
|
|
5
5
|
const run_command_1 = require("../../tasks-runner/run-command");
|
6
6
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
7
7
|
const project_graph_utils_1 = require("../../utils/project-graph-utils");
|
8
|
-
const connect_to_nx_cloud_1 = require("../
|
8
|
+
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
10
10
|
const project_graph_1 = require("../../project-graph/project-graph");
|
11
11
|
const configuration_1 = require("../../config/configuration");
|
@@ -25,7 +25,6 @@ export interface RunOptions {
|
|
25
25
|
}
|
26
26
|
export interface TuiOptions {
|
27
27
|
tuiAutoExit: boolean | number;
|
28
|
-
tui: boolean;
|
29
28
|
}
|
30
29
|
export declare function withTuiOptions<T>(yargs: Argv<T>): Argv<T & TuiOptions>;
|
31
30
|
export declare function withRunOptions<T>(yargs: Argv<T>): Argv<T & RunOptions>;
|
@@ -38,11 +38,6 @@ function withTuiOptions(yargs) {
|
|
38
38
|
describe: 'Whether or not to exit the TUI automatically after all tasks finish, and after how long. If set to `true`, the TUI will exit immediately. If set to `false` the TUI will not automatically exit. If set to a number, an interruptible countdown popup will be shown for that many seconds before the TUI exits.',
|
39
39
|
type: 'string',
|
40
40
|
coerce: (v) => coerceTuiAutoExit(v),
|
41
|
-
})
|
42
|
-
.option('tui', {
|
43
|
-
describe: 'Enable or disable the Nx Terminal UI.',
|
44
|
-
type: 'boolean',
|
45
|
-
conflicts: 'outputStyle',
|
46
41
|
})
|
47
42
|
.middleware((args) => {
|
48
43
|
if (args.tuiAutoExit !== undefined) {
|
package/src/config/nx-json.d.ts
CHANGED
@@ -342,13 +342,6 @@ export interface NxReleaseConfiguration {
|
|
342
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.
|
343
343
|
*/
|
344
344
|
releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
|
345
|
-
/**
|
346
|
-
* By default, we will use semver when searching through the tags to find the latest matching tag.
|
347
|
-
*
|
348
|
-
* - Setting this to true will cause us to use semver to match the version
|
349
|
-
* - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
|
350
|
-
*/
|
351
|
-
releaseTagPatternRequireSemver?: boolean;
|
352
345
|
/**
|
353
346
|
* Enables using version plans as a specifier source for versioning and
|
354
347
|
* to determine changes for changelog generation.
|
@@ -417,13 +410,6 @@ export interface NxReleaseConfiguration {
|
|
417
410
|
* - 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.
|
418
411
|
*/
|
419
412
|
releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
|
420
|
-
/**
|
421
|
-
* By default, we will use semver when searching through the tags to find the latest matching tag.
|
422
|
-
*
|
423
|
-
* - Setting this to true will cause us to use semver to match the version
|
424
|
-
* - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
|
425
|
-
*/
|
426
|
-
releaseTagPatternRequireSemver?: boolean;
|
427
413
|
/**
|
428
414
|
* Enable and configure automatic git operations as part of the release
|
429
415
|
*/
|