nx 24.0.6 → 24.1.0-beta.1
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/dist/bin/init-local.js +2 -4
- package/dist/bin/nx-cloud.js +2 -1
- package/dist/bin/nx.js +12 -14
- package/dist/bin/run-executor.js +5 -0
- package/dist/src/adapter/compat.d.ts +1 -1
- package/dist/src/adapter/compat.js +1 -0
- package/dist/src/adapter/ngcli-adapter.js +7 -20
- package/dist/src/command-line/completion/scripts/bash.sh +9 -2
- package/dist/src/command-line/completion/scripts/fish.fish +10 -2
- package/dist/src/command-line/completion/scripts/zsh.zsh +8 -2
- package/dist/src/command-line/completion/scripts.js +18 -8
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -1
- package/dist/src/command-line/conformance/command-object.d.ts +3 -0
- package/dist/src/command-line/conformance/command-object.js +66 -0
- package/dist/src/command-line/generate/generate.js +14 -27
- package/dist/src/command-line/generate/generator-utils.d.ts +1 -0
- package/dist/src/command-line/generate/generator-utils.js +9 -0
- package/dist/src/command-line/graph/graph.js +1 -7
- package/dist/src/command-line/import/import.js +26 -2
- package/dist/src/command-line/import/utils/ai-output.d.ts +9 -1
- package/dist/src/command-line/import/utils/ai-output.js +20 -1
- package/dist/src/command-line/import/utils/prepare-source-repo.js +0 -3
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +2 -2
- package/dist/src/command-line/init/init-v2.js +2 -2
- package/dist/src/command-line/migrate/migrate.js +1 -4
- package/dist/src/command-line/migrate/prompt-files.js +5 -5
- package/dist/src/command-line/migrate/run/orchestrator.js +2 -3
- package/dist/src/command-line/migrate/run/worker.js +7 -5
- package/dist/src/command-line/migrate/run-migration-process.js +3 -2
- package/dist/src/command-line/nx-commands.d.ts +1 -1
- package/dist/src/command-line/nx-commands.js +82 -132
- package/dist/src/command-line/release/changelog.js +8 -39
- package/dist/src/command-line/release/command-object.d.ts +1 -0
- package/dist/src/command-line/release/command-object.js +4 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +1 -1
- package/dist/src/command-line/release/release.js +6 -4
- package/dist/src/command-line/release/utils/diff.js +0 -14
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +2 -24
- package/dist/src/command-line/report/report.js +1 -1
- package/dist/src/command-line/run/executor-utils.js +1 -1
- package/dist/src/command-line/show/show-target/utils.js +1 -1
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/commands-runner/get-command-projects.js +0 -3
- package/dist/src/config/misc-interfaces.d.ts +0 -1
- package/dist/src/config/nx-json.d.ts +117 -0
- package/dist/src/config/workspace-json-project-json.d.ts +6 -7
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +13 -20
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +11 -4
- package/dist/src/devkit-internals.js +27 -5
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +35 -13
- package/dist/src/hasher/hash-task.js +4 -4
- package/dist/src/hasher/task-hasher.js +2 -2
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.d.ts +4 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.js +117 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.md +38 -0
- package/dist/src/native/index.d.ts +6 -4
- package/dist/src/native/index.js +5 -0
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +2 -0
- package/dist/src/native/transform-objects.js +15 -0
- package/dist/src/nx-cloud/utilities/environment.js +0 -17
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +1 -2
- package/dist/src/plugins/js/lock-file/bun-parser.js +5 -5
- package/dist/src/plugins/js/lock-file/lock-file-names.d.ts +6 -0
- package/dist/src/plugins/js/lock-file/lock-file-names.js +16 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +1 -2
- package/dist/src/plugins/js/lock-file/lock-file.js +24 -31
- package/dist/src/plugins/js/lock-file/npm-parser.js +1 -2
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +50 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +5 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +75 -13
- package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.js +1 -1
- package/dist/src/plugins/js/utils/register.js +13 -6
- package/dist/src/project-graph/affected/affected-tasks.js +1 -1
- package/dist/src/project-graph/build-project-graph.js +5 -2
- package/dist/src/project-graph/nx-deps-cache.d.ts +3 -2
- package/dist/src/project-graph/nx-deps-cache.js +8 -2
- package/dist/src/project-graph/utils/project-graph-paths.d.ts +8 -0
- package/dist/src/project-graph/utils/project-graph-paths.js +170 -0
- package/dist/src/tasks-runner/batch/run-batch.js +3 -13
- package/dist/src/tasks-runner/cache.js +19 -18
- package/dist/src/tasks-runner/run-command.js +12 -10
- package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/dist/src/tasks-runner/task-orchestrator.js +14 -3
- package/dist/src/tasks-runner/utils.js +1 -12
- package/dist/src/ultracache/overrides.js +1 -1
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/code-frames.js +0 -1
- package/dist/src/utils/db-connection.js +6 -4
- package/dist/src/utils/find-workspace-root.js +2 -4
- package/dist/src/utils/git-utils.d.ts +5 -0
- package/dist/src/utils/git-utils.js +23 -1
- package/dist/src/utils/handle-import.js +6 -0
- package/dist/src/utils/installation-directory.d.ts +16 -0
- package/dist/src/utils/installation-directory.js +96 -2
- package/dist/src/utils/json.d.ts +7 -0
- package/dist/src/utils/json.js +27 -0
- package/dist/src/utils/min-release-age/behavior/pnpm.js +9 -9
- package/dist/src/utils/min-release-age/behavior/yarn.js +2 -2
- package/dist/src/utils/nx-key.js +11 -8
- package/dist/src/utils/output.d.ts +5 -0
- package/dist/src/utils/output.js +11 -4
- package/dist/src/utils/owned-private-dir.d.ts +10 -0
- package/dist/src/utils/owned-private-dir.js +28 -0
- package/dist/src/utils/plugins/output.js +0 -2
- package/dist/src/utils/require-nx-key.js +6 -4
- package/dist/src/utils/workspace-root.d.ts +12 -0
- package/dist/src/utils/workspace-root.js +56 -7
- package/migrations.json +6 -0
- package/package.json +14 -12
- package/schemas/nx-schema.json +75 -9
- package/schemas/project-schema.json +5 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Extends the shared base with import-specific types and builders.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.writeErrorLog = exports.logProgress = exports.writeAiOutput = void 0;
|
|
8
|
+
exports.NxImportError = exports.writeErrorLog = exports.logProgress = exports.writeAiOutput = void 0;
|
|
9
9
|
exports.buildImportNeedsOptionsResult = buildImportNeedsOptionsResult;
|
|
10
10
|
exports.buildImportNeedsPluginSelectionResult = buildImportNeedsPluginSelectionResult;
|
|
11
11
|
exports.buildImportSuccessResult = buildImportSuccessResult;
|
|
@@ -16,6 +16,18 @@ const ai_output_1 = require("../../ai/ai-output");
|
|
|
16
16
|
Object.defineProperty(exports, "writeAiOutput", { enumerable: true, get: function () { return ai_output_1.writeAiOutput; } });
|
|
17
17
|
Object.defineProperty(exports, "logProgress", { enumerable: true, get: function () { return ai_output_1.logProgress; } });
|
|
18
18
|
Object.defineProperty(exports, "writeErrorLog", { enumerable: true, get: function () { return ai_output_1.writeErrorLog; } });
|
|
19
|
+
/**
|
|
20
|
+
* An import failure that states its own error code, for messages that embed
|
|
21
|
+
* user paths and so cannot be classified by their text.
|
|
22
|
+
*/
|
|
23
|
+
class NxImportError extends Error {
|
|
24
|
+
constructor(message, errorCode) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.errorCode = errorCode;
|
|
27
|
+
this.name = 'NxImportError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.NxImportError = NxImportError;
|
|
19
31
|
const AVAILABLE_OPTIONS = {
|
|
20
32
|
sourceRepository: {
|
|
21
33
|
description: 'URL or path of the repository to import.',
|
|
@@ -129,6 +141,11 @@ function getImportErrorHints(errorCode) {
|
|
|
129
141
|
'Commit or stash your changes before running nx import',
|
|
130
142
|
'Run "git status" to see uncommitted changes',
|
|
131
143
|
];
|
|
144
|
+
case 'NOT_A_GIT_REPOSITORY':
|
|
145
|
+
return [
|
|
146
|
+
'nx import needs both the source and this workspace to be git repositories',
|
|
147
|
+
'Run "git init" in the directory that is not a repository and commit its files',
|
|
148
|
+
];
|
|
132
149
|
case 'CLONE_FAILED':
|
|
133
150
|
return [
|
|
134
151
|
'Check the repository URL is correct and accessible',
|
|
@@ -183,6 +200,8 @@ function getImportErrorHints(errorCode) {
|
|
|
183
200
|
}
|
|
184
201
|
}
|
|
185
202
|
function determineImportErrorCode(error) {
|
|
203
|
+
if (error instanceof NxImportError)
|
|
204
|
+
return error.errorCode;
|
|
186
205
|
const message = error instanceof Error ? error.message : String(error);
|
|
187
206
|
const lower = message.toLowerCase();
|
|
188
207
|
if (lower.includes('uncommitted'))
|
|
@@ -22,6 +22,3 @@ async function prepareSourceRepo(gitClient, ref, source, relativeDestination, te
|
|
|
22
22
|
: `Filtered git history`);
|
|
23
23
|
spinner.succeed(`${sourceRemoteUrl} has been prepared to be imported into this workspace on a temporary branch: ${tempImportBranch} in ${gitClient.root}`);
|
|
24
24
|
}
|
|
25
|
-
function wait(ms) {
|
|
26
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
27
|
-
}
|
|
@@ -12,7 +12,7 @@ async function setupStandaloneWorkspace(repoRoot, cacheableOperations, workspace
|
|
|
12
12
|
const angularJsonPath = (0, node_path_1.join)(repoRoot, 'angular.json');
|
|
13
13
|
const angularJson = (0, fileutils_1.readJsonFile)(angularJsonPath);
|
|
14
14
|
const workspaceCapabilities = getWorkspaceCapabilities(angularJson.projects);
|
|
15
|
-
createNxJson(repoRoot,
|
|
15
|
+
createNxJson(repoRoot, cacheableOperations, workspaceCapabilities, workspaceTargets);
|
|
16
16
|
(0, utils_1.addVsCodeRecommendedExtensions)(repoRoot, [
|
|
17
17
|
'nrwl.angular-console',
|
|
18
18
|
'angular.ng-template',
|
|
@@ -37,7 +37,7 @@ async function setupStandaloneWorkspace(repoRoot, cacheableOperations, workspace
|
|
|
37
37
|
}
|
|
38
38
|
(0, fs_1.unlinkSync)(angularJsonPath);
|
|
39
39
|
}
|
|
40
|
-
function createNxJson(repoRoot,
|
|
40
|
+
function createNxJson(repoRoot, cacheableOperations, { eslintProjectConfigFile, test, karmaProjectConfigFile, }, workspaceTargets) {
|
|
41
41
|
(0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations, {});
|
|
42
42
|
const nxJson = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(repoRoot, 'nx.json'));
|
|
43
43
|
nxJson.namedInputs = {
|
|
@@ -108,13 +108,13 @@ async function initHandlerImpl(options) {
|
|
|
108
108
|
meta: { type: 'start', ...baseMeta },
|
|
109
109
|
});
|
|
110
110
|
try {
|
|
111
|
-
return await runInit(options
|
|
111
|
+
return await runInit(options);
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
await recordInitError(error, baseMeta);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function runInit(options
|
|
117
|
+
async function runInit(options) {
|
|
118
118
|
// Resolving `latest` here would install a version nothing has verified.
|
|
119
119
|
const version = process.env.NX_VERSION ?? versions_1.nxVersion;
|
|
120
120
|
if (process.env.NX_VERSION) {
|
|
@@ -1237,7 +1237,6 @@ function createFetcher(pmc) {
|
|
|
1237
1237
|
if (migrationsCache[`${packageName}-${packageVersion}`]) {
|
|
1238
1238
|
return migrationsCache[`${packageName}-${packageVersion}`];
|
|
1239
1239
|
}
|
|
1240
|
-
let resolvedVersion = packageVersion;
|
|
1241
1240
|
let migrations;
|
|
1242
1241
|
function setCache(packageName, packageVersion) {
|
|
1243
1242
|
migrationsCache[packageName + '-' + packageVersion] = migrations;
|
|
@@ -1256,7 +1255,6 @@ function createFetcher(pmc) {
|
|
|
1256
1255
|
result.generators = { ...result.schematics, ...result.generators };
|
|
1257
1256
|
delete result.schematics;
|
|
1258
1257
|
}
|
|
1259
|
-
resolvedVersion = result.version;
|
|
1260
1258
|
return result;
|
|
1261
1259
|
});
|
|
1262
1260
|
setCache(packageName, packageVersion);
|
|
@@ -1589,7 +1587,7 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts, fetch) {
|
|
|
1589
1587
|
let phase = 'fetch_migrations';
|
|
1590
1588
|
try {
|
|
1591
1589
|
const rootPkgJsonPath = (0, path_1.join)(root, 'package.json');
|
|
1592
|
-
|
|
1590
|
+
const originalPackageJson = (0, fs_1.existsSync)(rootPkgJsonPath)
|
|
1593
1591
|
? (0, fileutils_1.readJsonFile)(rootPkgJsonPath)
|
|
1594
1592
|
: null;
|
|
1595
1593
|
const originalNxJson = (0, configuration_1.readNxJson)();
|
|
@@ -1744,7 +1742,6 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts, fetch) {
|
|
|
1744
1742
|
],
|
|
1745
1743
|
});
|
|
1746
1744
|
await (0, connect_to_nx_cloud_1.connectToNxCloudWithPrompt)('migrate');
|
|
1747
|
-
originalPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
1748
1745
|
}
|
|
1749
1746
|
}
|
|
1750
1747
|
catch {
|
|
@@ -26,13 +26,13 @@ function validateMigrationEntries(packageName, packageVersion, migrations) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
async function resolvePromptFiles(packageName, packageVersion, migrations,
|
|
29
|
+
async function resolvePromptFiles(packageName, packageVersion, migrations, resolveContent) {
|
|
30
30
|
const resolvedPromptFiles = {};
|
|
31
31
|
for (const [migrationName, entry] of iterateMigrationEntries(migrations)) {
|
|
32
32
|
if (!entry.prompt || resolvedPromptFiles[entry.prompt] !== undefined) {
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
|
-
assertPromptPathWithinMigrationsDir(
|
|
35
|
+
assertPromptPathWithinMigrationsDir(entry.prompt, packageName, packageVersion);
|
|
36
36
|
if (!isPortableMarkdownPath(entry.prompt)) {
|
|
37
37
|
throw new Error(`Invalid prompt path "${entry.prompt}" in package "${packageName}@${packageVersion}": prompt files must be markdown (.md) files whose path has no characters reserved on Windows (<>:"|?*).`);
|
|
38
38
|
}
|
|
@@ -47,7 +47,7 @@ async function resolvePromptFiles(packageName, packageVersion, migrations, migra
|
|
|
47
47
|
? resolvedPromptFiles
|
|
48
48
|
: undefined;
|
|
49
49
|
}
|
|
50
|
-
function assertPromptPathWithinMigrationsDir(
|
|
50
|
+
function assertPromptPathWithinMigrationsDir(promptRelPath, packageName, packageVersion) {
|
|
51
51
|
if (!(0, path_2.isContainedRelativePath)(promptRelPath)) {
|
|
52
52
|
throw new Error(`Invalid prompt path "${promptRelPath}" in package "${packageName}@${packageVersion}": prompt paths must be relative and resolve within the package's migrations directory.`);
|
|
53
53
|
}
|
|
@@ -102,7 +102,7 @@ function resolvePrompt(promptPath, migrationsDir) {
|
|
|
102
102
|
}
|
|
103
103
|
function extractPromptFilesFromTarball(packageName, packageVersion, migrations, migrationsFilePath, fullTarballPath, destDir) {
|
|
104
104
|
const migrationsDir = (0, path_1.dirname)(migrationsFilePath);
|
|
105
|
-
return resolvePromptFiles(packageName, packageVersion, migrations,
|
|
105
|
+
return resolvePromptFiles(packageName, packageVersion, migrations, async (promptRelPath) => {
|
|
106
106
|
const promptInTarball = (0, path_2.joinPathFragments)('package', migrationsDir, promptRelPath);
|
|
107
107
|
const promptDest = (0, path_1.join)(destDir, migrationsDir, promptRelPath);
|
|
108
108
|
await (0, tar_1.extractFileFromTarball)(fullTarballPath, promptInTarball, promptDest);
|
|
@@ -111,7 +111,7 @@ function extractPromptFilesFromTarball(packageName, packageVersion, migrations,
|
|
|
111
111
|
}
|
|
112
112
|
function readPromptFilesFromInstall(packageName, packageVersion, migrations, migrationsFilePath) {
|
|
113
113
|
const migrationsDir = (0, path_1.dirname)(migrationsFilePath);
|
|
114
|
-
return resolvePromptFiles(packageName, packageVersion, migrations,
|
|
114
|
+
return resolvePromptFiles(packageName, packageVersion, migrations, (promptRelPath) => (0, fs_1.readFileSync)(resolvePrompt(promptRelPath, migrationsDir), 'utf-8'));
|
|
115
115
|
}
|
|
116
116
|
function writePromptMigrationFiles(root, migrations, promptContents, targetVersion) {
|
|
117
117
|
const sourceToChosen = new Map();
|
|
@@ -1042,7 +1042,6 @@ async function runOrchestratorReconcile(input) {
|
|
|
1042
1042
|
written.steps.find((s) => s.id === target.id)?.installFailed === true) {
|
|
1043
1043
|
warnInstallLeftToUser(root, target);
|
|
1044
1044
|
}
|
|
1045
|
-
state = written;
|
|
1046
1045
|
}
|
|
1047
1046
|
finally {
|
|
1048
1047
|
scope.lease?.release();
|
|
@@ -1609,7 +1608,7 @@ function advanceAndDispense(root, dir, runId) {
|
|
|
1609
1608
|
}
|
|
1610
1609
|
switch (step.status) {
|
|
1611
1610
|
case 'pending':
|
|
1612
|
-
dispenseNextStep(root, dir, runId,
|
|
1611
|
+
dispenseNextStep(root, dir, runId, step, noProgress);
|
|
1613
1612
|
break;
|
|
1614
1613
|
case 'dispensed':
|
|
1615
1614
|
// Re-entry before the worker advanced the step; re-emit its command.
|
|
@@ -1687,7 +1686,7 @@ function trackNoProgress(dir, step) {
|
|
|
1687
1686
|
});
|
|
1688
1687
|
return streak.consecutiveCount >= NO_PROGRESS_THRESHOLD ? streak : null;
|
|
1689
1688
|
}
|
|
1690
|
-
function dispenseNextStep(root, dir, runId,
|
|
1689
|
+
function dispenseNextStep(root, dir, runId, step, noProgress) {
|
|
1691
1690
|
// Read the pre-step baselines (git and package.json reads) before the
|
|
1692
1691
|
// lock; the dispense transition and the baselines then apply to the fresh
|
|
1693
1692
|
// state in one write.
|
|
@@ -464,7 +464,7 @@ async function runRecorded(root, runId, migration, skipInstall, isVerbose, calle
|
|
|
464
464
|
awaitingKind = 'generator-validation';
|
|
465
465
|
}
|
|
466
466
|
else if (generatorAlreadyCompleted) {
|
|
467
|
-
|
|
467
|
+
await finishCompletedGenerator(dir, root, state, startedStep, migration, effectiveSkipInstall, rerunCommand, scope);
|
|
468
468
|
outcome = buildOutcome([], [], 'The generator ran in an earlier attempt; this attempt completed its install and commit.', root);
|
|
469
469
|
}
|
|
470
470
|
else {
|
|
@@ -508,7 +508,7 @@ async function runRecorded(root, runId, migration, skipInstall, isVerbose, calle
|
|
|
508
508
|
madeChanges &&
|
|
509
509
|
!validationOwed &&
|
|
510
510
|
!promptOwed) {
|
|
511
|
-
|
|
511
|
+
await commitStepChanges(dir, root, state, startedStep, migration, install, scope);
|
|
512
512
|
}
|
|
513
513
|
else {
|
|
514
514
|
await (0, broker_1.installStepTree)(dir, startedStep, 'install', install, scope);
|
|
@@ -610,7 +610,7 @@ async function finishCompletedGenerator(dir, root, state, step, migration, skipI
|
|
|
610
610
|
// answer, and the commit is kept as that version's retries did.
|
|
611
611
|
if (!state.createCommits || step.generatorMadeChanges === false) {
|
|
612
612
|
await (0, broker_1.installStepTree)(dir, step, 'install', installDeps, scope);
|
|
613
|
-
return
|
|
613
|
+
return;
|
|
614
614
|
}
|
|
615
615
|
return commitStepChanges(dir, root, state, step, migration, installDeps, scope);
|
|
616
616
|
}
|
|
@@ -641,14 +641,16 @@ async function commitStepChanges(dir, root, state, step, migration, installDeps,
|
|
|
641
641
|
}
|
|
642
642
|
const entry = (0, state_machine_1.commitResultToLedgerEntry)(commit.result, step.id, commit.absorbedStepIds);
|
|
643
643
|
// A session's parent records what it commits itself, receipt included.
|
|
644
|
-
|
|
644
|
+
if (entry && !commit.recorded) {
|
|
645
|
+
recordCommitEntry(dir, entry);
|
|
646
|
+
}
|
|
645
647
|
}
|
|
646
648
|
// The git commit itself already ran outside the lock; only this pure append is
|
|
647
649
|
// locked. A landed entry carries the resolved issues of every step it names,
|
|
648
650
|
// same as the orchestrator's fold and adopt appends: an absorbed step's
|
|
649
651
|
// resolutions would otherwise land unattached.
|
|
650
652
|
function recordCommitEntry(dir, entry) {
|
|
651
|
-
|
|
653
|
+
(0, state_lock_1.updateRunState)(dir, (fresh) => (0, state_machine_1.appendCommit)(fresh, (0, issues_1.attachIssueIdsToCommitEntry)(fresh, entry)));
|
|
652
654
|
}
|
|
653
655
|
function buildOutcome(changes, nextSteps, description, root) {
|
|
654
656
|
const outcome = {};
|
|
@@ -28,11 +28,12 @@ async function runMigrationProcess() {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
|
-
|
|
31
|
+
// Validate HEAD before the migration can change the working tree.
|
|
32
|
+
execSync('git rev-parse HEAD', {
|
|
32
33
|
cwd: workspacePath,
|
|
33
34
|
encoding: 'utf-8',
|
|
34
35
|
windowsHide: true,
|
|
35
|
-
})
|
|
36
|
+
});
|
|
36
37
|
|
|
37
38
|
// Snapshot package.json deps now so we can detect post-migration drift
|
|
38
39
|
// and run a single install, whether commits are on or off.
|
|
@@ -7,4 +7,4 @@ export declare const parserConfiguration: Partial<yargs.ParserConfigurationOptio
|
|
|
7
7
|
* from the `.argv` call, so the object and it's relative scripts can
|
|
8
8
|
* be executed correctly.
|
|
9
9
|
*/
|
|
10
|
-
export declare const commandsObject: yargs.Argv<
|
|
10
|
+
export declare const commandsObject: yargs.Argv<{}>;
|
|
@@ -5,44 +5,44 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
6
6
|
const yargs = tslib_1.__importStar(require("yargs"));
|
|
7
7
|
const analytics_1 = require("../analytics");
|
|
8
|
-
const output_1 = require("../utils/output");
|
|
9
8
|
const command_object_1 = require("./add/command-object");
|
|
10
|
-
const command_object_2 = require("./
|
|
11
|
-
const command_object_3 = require("./
|
|
12
|
-
const command_object_4 = require("./
|
|
9
|
+
const command_object_2 = require("./conformance/command-object");
|
|
10
|
+
const command_object_3 = require("./affected/command-object");
|
|
11
|
+
const command_object_4 = require("./configure-ai-agents/command-object");
|
|
12
|
+
const command_object_5 = require("./daemon/command-object");
|
|
13
13
|
const command_objects_1 = require("./deprecated/command-objects");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
14
|
+
const command_object_6 = require("./exec/command-object");
|
|
15
|
+
const command_object_7 = require("./format/command-object");
|
|
16
|
+
const command_object_8 = require("./generate/command-object");
|
|
17
|
+
const command_object_9 = require("./graph/command-object");
|
|
18
|
+
const command_object_10 = require("./import/command-object");
|
|
19
|
+
const command_object_11 = require("./init/command-object");
|
|
20
|
+
const command_object_12 = require("./list/command-object");
|
|
21
|
+
const command_object_13 = require("./mcp/command-object");
|
|
22
|
+
const command_object_14 = require("./migrate/command-object");
|
|
23
|
+
const command_object_15 = require("./new/command-object");
|
|
24
|
+
const command_object_16 = require("./nx-cloud/apply-locally/command-object");
|
|
25
|
+
const command_object_17 = require("./nx-cloud/complete-run/command-object");
|
|
26
|
+
const command_object_18 = require("./nx-cloud/connect/command-object");
|
|
27
|
+
const command_object_19 = require("./nx-cloud/download-cloud-client/command-object");
|
|
28
|
+
const command_object_20 = require("./nx-cloud/fix-ci/command-object");
|
|
29
|
+
const command_object_21 = require("./nx-cloud/login/command-object");
|
|
30
|
+
const command_object_22 = require("./nx-cloud/logout/command-object");
|
|
31
|
+
const command_object_23 = require("./nx-cloud/record/command-object");
|
|
32
|
+
const command_object_24 = require("./nx-cloud/start-agent/command-object");
|
|
33
|
+
const command_object_25 = require("./nx-cloud/start-ci-run/command-object");
|
|
34
|
+
const command_object_26 = require("./nx-cloud/start-nx-agents/command-object");
|
|
35
|
+
const command_object_27 = require("./register/command-object");
|
|
36
|
+
const command_object_28 = require("./release/command-object");
|
|
37
|
+
const command_object_29 = require("./repair/command-object");
|
|
38
|
+
const command_object_30 = require("./report/command-object");
|
|
39
|
+
const command_object_31 = require("./reset/command-object");
|
|
40
|
+
const command_object_32 = require("./run-many/command-object");
|
|
41
|
+
const command_object_33 = require("./run/command-object");
|
|
42
|
+
const command_object_34 = require("./show/command-object");
|
|
43
|
+
const command_object_35 = require("./sync/command-object");
|
|
44
|
+
const command_object_36 = require("./watch/command-object");
|
|
45
|
+
const command_object_37 = require("./completion/command-object");
|
|
46
46
|
const trigger_1 = require("./completion/trigger");
|
|
47
47
|
// Ensure that the output takes up the available width of the terminal.
|
|
48
48
|
yargs.wrap(yargs.terminalWidth());
|
|
@@ -60,55 +60,55 @@ exports.commandsObject = yargs
|
|
|
60
60
|
.parserConfiguration(exports.parserConfiguration)
|
|
61
61
|
.usage(pc.bold('Smart Monorepos · Fast Builds'))
|
|
62
62
|
.demandCommand(1, '')
|
|
63
|
-
.command(
|
|
63
|
+
.command(command_object_27.yargsRegisterCommand)
|
|
64
64
|
.command(command_object_1.yargsAddCommand)
|
|
65
|
-
.command(
|
|
66
|
-
.command(
|
|
67
|
-
.command(
|
|
68
|
-
.command(
|
|
69
|
-
.command(
|
|
70
|
-
.command(
|
|
65
|
+
.command(command_object_4.yargsConfigureAiAgentsCommand)
|
|
66
|
+
.command(command_object_3.yargsAffectedBuildCommand)
|
|
67
|
+
.command(command_object_3.yargsAffectedCommand)
|
|
68
|
+
.command(command_object_3.yargsAffectedE2ECommand)
|
|
69
|
+
.command(command_object_3.yargsAffectedLintCommand)
|
|
70
|
+
.command(command_object_3.yargsAffectedTestCommand)
|
|
71
71
|
.command(command_objects_1.yargsAffectedGraphCommand)
|
|
72
|
-
.command(
|
|
73
|
-
.command(
|
|
74
|
-
.command(
|
|
75
|
-
.command(
|
|
76
|
-
.command(
|
|
77
|
-
.command(
|
|
78
|
-
.command(
|
|
79
|
-
.command(
|
|
80
|
-
.command(
|
|
81
|
-
.command(
|
|
82
|
-
.command(
|
|
83
|
-
.command(
|
|
84
|
-
.command(
|
|
72
|
+
.command(command_object_18.yargsConnectCommand)
|
|
73
|
+
.command(command_object_5.yargsDaemonCommand)
|
|
74
|
+
.command(command_object_9.yargsGraphCommand)
|
|
75
|
+
.command(command_object_6.yargsExecCommand)
|
|
76
|
+
.command(command_object_7.yargsFormatCheckCommand)
|
|
77
|
+
.command(command_object_7.yargsFormatWriteCommand)
|
|
78
|
+
.command(command_object_8.yargsGenerateCommand)
|
|
79
|
+
.command(command_object_10.yargsImportCommand)
|
|
80
|
+
.command(command_object_11.yargsInitCommand)
|
|
81
|
+
.command(command_object_14.yargsInternalMigrateCommand)
|
|
82
|
+
.command(command_object_12.yargsListCommand)
|
|
83
|
+
.command(command_object_14.yargsMigrateCommand)
|
|
84
|
+
.command(command_object_15.yargsNewCommand)
|
|
85
85
|
.command(command_objects_1.yargsPrintAffectedCommand)
|
|
86
|
-
.command(
|
|
87
|
-
.command(
|
|
88
|
-
.command(
|
|
89
|
-
.command(
|
|
90
|
-
.command(
|
|
91
|
-
.command(
|
|
92
|
-
.command(
|
|
93
|
-
.command(
|
|
94
|
-
.command(
|
|
95
|
-
.command(
|
|
96
|
-
.command(
|
|
97
|
-
.command(
|
|
98
|
-
.command(
|
|
99
|
-
.command(
|
|
100
|
-
.command(
|
|
101
|
-
.command(
|
|
102
|
-
.command(
|
|
103
|
-
.command(
|
|
104
|
-
.command(
|
|
105
|
-
.command(
|
|
106
|
-
.command(
|
|
107
|
-
.command(
|
|
108
|
-
.command(
|
|
109
|
-
.command(
|
|
110
|
-
.command(resolveConformanceCommandObject())
|
|
111
|
-
.command(
|
|
86
|
+
.command(command_object_28.yargsReleaseCommand)
|
|
87
|
+
.command(command_object_29.yargsRepairCommand)
|
|
88
|
+
.command(command_object_30.yargsReportCommand)
|
|
89
|
+
.command(command_object_31.yargsResetCommand)
|
|
90
|
+
.command(command_object_33.yargsRunCommand)
|
|
91
|
+
.command(command_object_32.yargsRunManyCommand)
|
|
92
|
+
.command(command_object_34.yargsShowCommand)
|
|
93
|
+
.command(command_object_35.yargsSyncCommand)
|
|
94
|
+
.command(command_object_35.yargsSyncCheckCommand)
|
|
95
|
+
.command(command_object_18.yargsViewLogsCommand)
|
|
96
|
+
.command(command_object_36.yargsWatchCommand)
|
|
97
|
+
.command(command_object_33.yargsNxInfixCommand)
|
|
98
|
+
.command(command_object_21.yargsLoginCommand)
|
|
99
|
+
.command(command_object_22.yargsLogoutCommand)
|
|
100
|
+
.command(command_object_23.yargsRecordCommand)
|
|
101
|
+
.command(command_object_25.yargsStartCiRunCommand)
|
|
102
|
+
.command(command_object_26.yargsStartNxAgentsCommand)
|
|
103
|
+
.command(command_object_24.yargsStartAgentCommand)
|
|
104
|
+
.command(command_object_17.yargsStopAllAgentsCommand)
|
|
105
|
+
.command(command_object_20.yargsFixCiCommand)
|
|
106
|
+
.command(command_object_16.yargsApplyLocallyCommand)
|
|
107
|
+
.command(command_object_19.yargsDownloadCloudClientCommand)
|
|
108
|
+
.command(command_object_13.yargsMcpCommand)
|
|
109
|
+
.command(command_object_37.yargsCompletionCommand)
|
|
110
|
+
.command((0, command_object_2.resolveConformanceCommandObject)('conformance'))
|
|
111
|
+
.command((0, command_object_2.resolveConformanceCommandObject)('conformance:check'))
|
|
112
112
|
.scriptName('nx')
|
|
113
113
|
.middleware((args) => {
|
|
114
114
|
// Skip analytics during shell completion (defensive — bin/nx.ts exits
|
|
@@ -133,53 +133,3 @@ exports.commandsObject = yargs
|
|
|
133
133
|
// so that it shows up in help. The default yargs implementation of --version is not
|
|
134
134
|
// hit, as the implementation in nx.ts is hit first and calls process.exit(0).
|
|
135
135
|
.version();
|
|
136
|
-
function createMissingConformanceCommand(command) {
|
|
137
|
-
return {
|
|
138
|
-
command,
|
|
139
|
-
// Hide from --help output in the common case of not having the plugin installed
|
|
140
|
-
describe: false,
|
|
141
|
-
handler: () => {
|
|
142
|
-
output_1.output.error({
|
|
143
|
-
title: `${command} is not available`,
|
|
144
|
-
bodyLines: [
|
|
145
|
-
`In order to use the \`nx ${command}\` command you must have an active Nx key and the \`@nx/conformance\` plugin installed.`,
|
|
146
|
-
'',
|
|
147
|
-
'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
|
|
148
|
-
],
|
|
149
|
-
});
|
|
150
|
-
process.exit(1);
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function resolveConformanceCommandObject() {
|
|
155
|
-
try {
|
|
156
|
-
const { yargsConformanceCommand } = (() => {
|
|
157
|
-
try {
|
|
158
|
-
return require('@nx/powerpack-conformance');
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return require('@nx/conformance');
|
|
162
|
-
}
|
|
163
|
-
})();
|
|
164
|
-
return yargsConformanceCommand;
|
|
165
|
-
}
|
|
166
|
-
catch {
|
|
167
|
-
return createMissingConformanceCommand('conformance');
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function resolveConformanceCheckCommandObject() {
|
|
171
|
-
try {
|
|
172
|
-
const { yargsConformanceCheckCommand } = (() => {
|
|
173
|
-
try {
|
|
174
|
-
return require('@nx/powerpack-conformance');
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
return require('@nx/conformance');
|
|
178
|
-
}
|
|
179
|
-
})();
|
|
180
|
-
return yargsConformanceCheckCommand;
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
return createMissingConformanceCommand('conformance:check');
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -213,10 +213,6 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
213
213
|
resolveChanges: () => resolveWorkspaceChangelogChanges({
|
|
214
214
|
releaseGraph,
|
|
215
215
|
nxReleaseConfig,
|
|
216
|
-
args,
|
|
217
|
-
workspacePreid,
|
|
218
|
-
projectsPreid,
|
|
219
|
-
useAutomaticFromRef,
|
|
220
216
|
toSHA,
|
|
221
217
|
fromSHA,
|
|
222
218
|
}),
|
|
@@ -229,10 +225,6 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
229
225
|
* Create a cache for from SHA resolution to avoid duplicate git operations
|
|
230
226
|
*/
|
|
231
227
|
const fromSHACache = new Map();
|
|
232
|
-
// Cache the workspace from SHA if available
|
|
233
|
-
if (fromSHA) {
|
|
234
|
-
fromSHACache.set('workspace', fromSHA);
|
|
235
|
-
}
|
|
236
228
|
// Helper function to get cached from SHA or resolve and cache it
|
|
237
229
|
const getCachedFromSHA = async (cacheKey, pattern, templateValues, preid, checkAllBranchesWhen, requireSemver, strictPreid, projectRoot) => {
|
|
238
230
|
if (fromSHACache.has(cacheKey)) {
|
|
@@ -323,33 +315,14 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
323
315
|
projectName: project.name,
|
|
324
316
|
releaseGroupName: releaseGroup.name,
|
|
325
317
|
}, projectsPreid[project.name], releaseGroup.releaseTag.checkAllBranchesWhen, releaseGroup.releaseTag.requireSemver, releaseGroup.releaseTag.strictPreid, project.data.root);
|
|
326
|
-
|
|
327
|
-
let fromRef = fromSHA;
|
|
328
|
-
if (!fromRef && useAutomaticFromRef) {
|
|
329
|
-
// For automatic from ref, we already have it cached
|
|
330
|
-
fromRef = fromSHACache.get(projectCacheKey);
|
|
331
|
-
if (fromRef) {
|
|
332
|
-
commits = await filterProjectCommits({
|
|
333
|
-
fromSHA: fromRef,
|
|
334
|
-
toSHA,
|
|
335
|
-
projectPath: project.data.root,
|
|
336
|
-
});
|
|
337
|
-
fromRef = commits[0]?.shortHash;
|
|
338
|
-
if (args.verbose) {
|
|
339
|
-
console.log(`Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (!fromRef && !commits) {
|
|
318
|
+
if (!fromSHA) {
|
|
344
319
|
throw new Error(`Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTag.pattern" property in nx.json to match the structure of your repository's git tags.`);
|
|
345
320
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
}
|
|
321
|
+
const commits = await filterProjectCommits({
|
|
322
|
+
fromSHA,
|
|
323
|
+
toSHA,
|
|
324
|
+
projectPath: project.data.root,
|
|
325
|
+
});
|
|
353
326
|
const { fileMap } = await (0, file_map_utils_1.createFileMapUsingProjectGraph)(projectGraph);
|
|
354
327
|
const fileToProjectMap = (0, commit_utils_1.createFileToProjectMap)(fileMap.projectFileMap);
|
|
355
328
|
changes = (0, commit_utils_1.createChangesFromCommits)(commits, fileMap, fileToProjectMap, nxReleaseConfig.conventionalCommits);
|
|
@@ -862,7 +835,7 @@ async function promptForRemoteRelease() {
|
|
|
862
835
|
onCancel: () => false,
|
|
863
836
|
});
|
|
864
837
|
}
|
|
865
|
-
async function resolveWorkspaceChangelogChanges({ releaseGraph, nxReleaseConfig,
|
|
838
|
+
async function resolveWorkspaceChangelogChanges({ releaseGraph, nxReleaseConfig, toSHA, fromSHA, }) {
|
|
866
839
|
// NOTE: If there are multiple release groups, we'll just skip the workspace changelog anyway.
|
|
867
840
|
const versionPlansEnabledForWorkspaceChangelog = releaseGraph.releaseGroups[0]?.resolvedVersionPlans;
|
|
868
841
|
// Derive changes from version plan files
|
|
@@ -872,10 +845,6 @@ async function resolveWorkspaceChangelogChanges({ releaseGraph, nxReleaseConfig,
|
|
|
872
845
|
// Derive changes from commits
|
|
873
846
|
return resolveWorkspaceChangelogFromCommits({
|
|
874
847
|
nxReleaseConfig,
|
|
875
|
-
args,
|
|
876
|
-
workspacePreid,
|
|
877
|
-
projectsPreid,
|
|
878
|
-
useAutomaticFromRef,
|
|
879
848
|
toSHA,
|
|
880
849
|
fromSHA,
|
|
881
850
|
});
|
|
@@ -890,7 +859,7 @@ function resolveWorkspaceChangelogFromVersionPlans(releaseGraph) {
|
|
|
890
859
|
const versionPlans = firstReleaseGroup.resolvedVersionPlans;
|
|
891
860
|
return (0, version_plan_utils_1.createChangesFromGroupVersionPlans)(versionPlans);
|
|
892
861
|
}
|
|
893
|
-
async function resolveWorkspaceChangelogFromCommits({ nxReleaseConfig,
|
|
862
|
+
async function resolveWorkspaceChangelogFromCommits({ nxReleaseConfig, toSHA, fromSHA, }) {
|
|
894
863
|
// Use the cached fromSHA if available, otherwise throw an error
|
|
895
864
|
if (!fromSHA) {
|
|
896
865
|
throw new Error(`Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTag.pattern" property in nx.json to match the structure of your repository's git tags.`);
|
|
@@ -90,6 +90,10 @@ const releaseCommand = {
|
|
|
90
90
|
.option('skip-publish', {
|
|
91
91
|
type: 'boolean',
|
|
92
92
|
description: 'Skip publishing by automatically answering no to the confirmation prompt for publishing.',
|
|
93
|
+
})
|
|
94
|
+
.option('git-push', {
|
|
95
|
+
describe: 'Whether or not to automatically push the changes made by this command to the remote git repository.',
|
|
96
|
+
type: 'boolean',
|
|
93
97
|
})
|
|
94
98
|
.option('otp', {
|
|
95
99
|
type: 'number',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shouldUseLegacyVersioning = shouldUseLegacyVersioning;
|
|
4
|
-
// TODO(
|
|
4
|
+
// TODO(v25): remove - kept only so `@nx/js@21`'s library generator can load via `ensurePackage` (NXC-5163).
|
|
5
5
|
/** @deprecated Compat shim for `@nx/js@21`. */
|
|
6
6
|
function shouldUseLegacyVersioning(releaseConfig) {
|
|
7
7
|
return releaseConfig?.version?.useLegacyVersioning ?? false;
|