nx 23.2.0-beta.4 → 23.2.0-beta.6
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/nx.js +1 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
- package/dist/src/command-line/init/init-v2.js +2 -2
- package/dist/src/command-line/migrate/agentic/definitions.js +2 -2
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +15 -19
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +19 -31
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +4 -6
- package/dist/src/command-line/migrate/agentic/handoff.js +9 -8
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +10 -2
- package/dist/src/command-line/migrate/agentic/types.d.ts +17 -3
- package/dist/src/command-line/migrate/agentic/types.js +26 -0
- package/dist/src/command-line/migrate/command-object.d.ts +3 -0
- package/dist/src/command-line/migrate/command-object.js +6 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +14 -9
- package/dist/src/command-line/migrate/execute-migration.js +82 -18
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +7 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +14 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +32 -8
- package/dist/src/command-line/migrate/migrate-commits.js +77 -9
- package/dist/src/command-line/migrate/migrate-config.d.ts +11 -12
- package/dist/src/command-line/migrate/migrate-config.js +14 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
- package/dist/src/command-line/migrate/migrate.d.ts +17 -68
- package/dist/src/command-line/migrate/migrate.js +411 -229
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/run/index.d.ts +2 -0
- package/dist/src/command-line/migrate/run/index.js +5 -0
- package/dist/src/command-line/migrate/run/util.d.ts +1 -0
- package/dist/src/command-line/migrate/run/util.js +16 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +15 -0
- package/dist/src/command-line/migrate/run/worker.js +419 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +58 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +155 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +5 -0
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +1 -0
- package/dist/src/command-line/release/utils/release-graph.js +15 -3
- package/dist/src/command-line/release/version/version-actions.d.ts +8 -0
- package/dist/src/command-line/release/version/version-actions.js +8 -0
- package/dist/src/command-line/release/version.js +9 -5
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +45 -1
- package/dist/src/daemon/client/client.js +128 -32
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +22 -0
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +92 -3
- package/dist/src/devkit-internals.js +189 -5
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +5 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +9 -2
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/native/index.d.ts +10 -0
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +14 -8
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -0
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/project-graph.js +20 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
- package/dist/src/tasks-runner/run-command.js +4 -0
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/ignore.d.ts +128 -1
- package/dist/src/utils/ignore.js +182 -12
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/package.json +12 -12
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEW_MIGRATE_FLAGS = exports.NEW_MIGRATE_FLAGS_FLOOR = void 0;
|
|
4
|
+
exports.findNewMigrateFlag = findNewMigrateFlag;
|
|
5
|
+
exports.resolveNewMigrateFlagsRunTarget = resolveNewMigrateFlagsRunTarget;
|
|
6
|
+
exports.assertWorkspaceNxSupportsNewMigrateFlags = assertWorkspaceNxSupportsNewMigrateFlags;
|
|
7
|
+
const semver_1 = require("semver");
|
|
8
|
+
const logger_1 = require("../../utils/logger");
|
|
9
|
+
const output_1 = require("../../utils/output");
|
|
10
|
+
const version_utils_1 = require("./version-utils");
|
|
11
|
+
// The first stable release shipping --run-migration. Deliberately the final
|
|
12
|
+
// release rather than its first prerelease: 23.2.0 prereleases published
|
|
13
|
+
// before the feature landed do not carry it, so a prerelease floor would
|
|
14
|
+
// wrongly accept them. The cost is that a later 23.2.0 prerelease that does
|
|
15
|
+
// carry the feature is refused too, which fails toward refusal. Permanent;
|
|
16
|
+
// never bumped at release time, but it must name the release that actually
|
|
17
|
+
// ships the feature: if that slips past 23.2.0, versions in the gap pass
|
|
18
|
+
// this floor and route to a temp CLI that drops the new flags and runs the
|
|
19
|
+
// plan phase instead.
|
|
20
|
+
exports.NEW_MIGRATE_FLAGS_FLOOR = '23.2.0';
|
|
21
|
+
// yargs accepts both spellings and the raw argv is forwarded across both
|
|
22
|
+
// migrate hops, so detection must catch each one.
|
|
23
|
+
exports.NEW_MIGRATE_FLAGS = ['--run-migration', '--runMigration'];
|
|
24
|
+
/**
|
|
25
|
+
* Matches an exact token or `<flag>=<value>`. The `=` matters: a bare
|
|
26
|
+
* `startsWith` would also match `--run-migrations` (trailing s).
|
|
27
|
+
*/
|
|
28
|
+
function findNewMigrateFlag(argv) {
|
|
29
|
+
for (const arg of argv) {
|
|
30
|
+
// Everything after the -- separator is positional data, not options.
|
|
31
|
+
if (arg === '--') {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
for (const flag of exports.NEW_MIGRATE_FLAGS) {
|
|
35
|
+
if (arg === flag || arg.startsWith(`${flag}=`)) {
|
|
36
|
+
return flag;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Guard A (local side, before hop A). The current nx knows the new flags, but
|
|
44
|
+
* the temp CLI 'nx migrate' is about to install may be older and would
|
|
45
|
+
* silently drop them. Decides where a new-flag invocation runs:
|
|
46
|
+
*
|
|
47
|
+
* - No new flag in `argv`, or the temp CLI version resolves at or above the
|
|
48
|
+
* feature floor: 'temp-cli', the normal temp-installation path.
|
|
49
|
+
* - The temp CLI resolves below the floor, or resolution fails (a registry
|
|
50
|
+
* error, or a minimum-release-age violation that a temp install must not
|
|
51
|
+
* bypass): 'local-nx', provided the workspace-local nx can take the flags.
|
|
52
|
+
* The local nx qualifies when it is the exact version running this code
|
|
53
|
+
* (it parsed the flag, so it supports it regardless of the floor) or is at
|
|
54
|
+
* or above the floor. An unreadable local version throws: the hand-off's
|
|
55
|
+
* spawn normally lands on the very install this read verifies, and a
|
|
56
|
+
* layout where the version cannot be read gives no such assurance, so
|
|
57
|
+
* handing off blind could run a below-floor nx that silently drops the
|
|
58
|
+
* flag.
|
|
59
|
+
* - Neither side is capable: throw with remediation.
|
|
60
|
+
*
|
|
61
|
+
* An explicit NX_MIGRATE_CLI_VERSION pinned below the floor throws instead of
|
|
62
|
+
* silently overriding the user's pin with the local fallback.
|
|
63
|
+
*
|
|
64
|
+
* `cliVersionSpec` is NX_MIGRATE_CLI_VERSION when set, else 'latest'.
|
|
65
|
+
*/
|
|
66
|
+
async function resolveNewMigrateFlagsRunTarget(options) {
|
|
67
|
+
const flag = findNewMigrateFlag(options.argv);
|
|
68
|
+
if (!flag) {
|
|
69
|
+
return 'temp-cli';
|
|
70
|
+
}
|
|
71
|
+
// `valid()` returns null for a dist-tag like 'latest' and a normalized
|
|
72
|
+
// version for a concrete spec, which then skips the registry round-trip.
|
|
73
|
+
const concrete = (0, semver_1.valid)(options.cliVersionSpec);
|
|
74
|
+
let resolved;
|
|
75
|
+
try {
|
|
76
|
+
resolved =
|
|
77
|
+
concrete ?? (await options.resolveVersion(options.cliVersionSpec));
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
// The local-fallback check below decides what a failed resolution means.
|
|
81
|
+
logger_1.logger.verbose(`Could not resolve the nx version for '${options.cliVersionSpec}': ${e}`);
|
|
82
|
+
}
|
|
83
|
+
if (resolved !== undefined &&
|
|
84
|
+
!(0, semver_1.lt)((0, version_utils_1.normalizeVersion)(resolved), exports.NEW_MIGRATE_FLAGS_FLOOR)) {
|
|
85
|
+
return 'temp-cli';
|
|
86
|
+
}
|
|
87
|
+
if (resolved !== undefined && options.fromEnvOverride) {
|
|
88
|
+
throw new Error(`The nx version 'nx migrate' is about to install (${resolved}) does not support ${flag}. ` +
|
|
89
|
+
`This flag ships in nx ${exports.NEW_MIGRATE_FLAGS_FLOOR} or newer. ` +
|
|
90
|
+
`NX_MIGRATE_CLI_VERSION is set to '${options.cliVersionSpec}'. ` +
|
|
91
|
+
`Unset it or set it to nx ${exports.NEW_MIGRATE_FLAGS_FLOOR} or newer.`);
|
|
92
|
+
}
|
|
93
|
+
const localNxVersion = options.readLocalNxVersion();
|
|
94
|
+
if (localNxVersion !== undefined &&
|
|
95
|
+
(localNxVersion === options.ownNxVersion ||
|
|
96
|
+
!(0, semver_1.lt)((0, version_utils_1.normalizeVersion)(localNxVersion), exports.NEW_MIGRATE_FLAGS_FLOOR))) {
|
|
97
|
+
// A pinned spec reaching this point failed to resolve: a resolved pin
|
|
98
|
+
// either returned 'temp-cli' or threw above.
|
|
99
|
+
if (options.fromEnvOverride) {
|
|
100
|
+
output_1.output.warn({
|
|
101
|
+
title: `The nx version pinned by NX_MIGRATE_CLI_VERSION ('${options.cliVersionSpec}') could not be resolved. Running ${flag} with the workspace's installed nx (${localNxVersion}) instead.`,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return 'local-nx';
|
|
105
|
+
}
|
|
106
|
+
const tempSideOutcome = resolved !== undefined
|
|
107
|
+
? `resolves to ${resolved}, which does not support it`
|
|
108
|
+
: `could not be resolved`;
|
|
109
|
+
const localSideOutcome = localNxVersion !== undefined
|
|
110
|
+
? `the workspace's installed nx (${localNxVersion}) does not support it either`
|
|
111
|
+
: `the workspace's installed nx version could not be read to verify support`;
|
|
112
|
+
// The worked example assumes the steady state, where 'latest' satisfies
|
|
113
|
+
// the floor: this branch then fires only when the spec could not be
|
|
114
|
+
// resolved (default or pinned), and updating the workspace to latest
|
|
115
|
+
// genuinely fixes it. Before the floor's stable release the example
|
|
116
|
+
// cannot resolve high enough; that window is deliberately not catered
|
|
117
|
+
// for, since no stable release carries the flags then anyway.
|
|
118
|
+
throw new Error(`${flag} requires nx ${exports.NEW_MIGRATE_FLAGS_FLOOR} or newer. ` +
|
|
119
|
+
`'${options.cliVersionSpec}' (the version 'nx migrate' would install) ${tempSideOutcome}, ` +
|
|
120
|
+
`and ${localSideOutcome}. ` +
|
|
121
|
+
`Update the workspace to nx ${exports.NEW_MIGRATE_FLAGS_FLOOR} or newer first, ` +
|
|
122
|
+
`for example by running 'nx migrate nx@latest' (without ${flag}) or by updating your dependencies.`);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Guard B (temp side, before hop B). The temp CLI knows the new flags, but the
|
|
126
|
+
* workspace-local nx it is about to hand off to may be older and would silently
|
|
127
|
+
* drop them.
|
|
128
|
+
*
|
|
129
|
+
* A workspace pinned to a feature-carrying 23.2.0 prerelease is refused here
|
|
130
|
+
* too: published prereleases that predate the feature cannot be told apart by
|
|
131
|
+
* version alone. Guard A's same-version bypass does not apply on this side
|
|
132
|
+
* because the invoking nx's version is not forwarded across hop A; the
|
|
133
|
+
* refusal names the workspace update that resolves it.
|
|
134
|
+
*
|
|
135
|
+
* `readLocalNxVersion` returning undefined does not block: the hand-off then
|
|
136
|
+
* resolves nx as it always does, which may fail visibly or land on another nx
|
|
137
|
+
* the package manager locates.
|
|
138
|
+
*/
|
|
139
|
+
function assertWorkspaceNxSupportsNewMigrateFlags(options) {
|
|
140
|
+
const flag = findNewMigrateFlag(options.argv);
|
|
141
|
+
if (!flag) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const localNxVersion = options.readLocalNxVersion();
|
|
145
|
+
if (!localNxVersion) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if ((0, semver_1.lt)((0, version_utils_1.normalizeVersion)(localNxVersion), exports.NEW_MIGRATE_FLAGS_FLOOR)) {
|
|
149
|
+
// The worked example assumes the steady state (latest at or above the
|
|
150
|
+
// floor); the pre-floor stable window is deliberately not catered for.
|
|
151
|
+
throw new Error(`The workspace's installed nx (${localNxVersion}) does not support ${flag}. ` +
|
|
152
|
+
`Update the workspace to nx ${exports.NEW_MIGRATE_FLAGS_FLOOR} or newer first, ` +
|
|
153
|
+
`for example by running 'nx migrate nx@latest' (without ${flag}) or by updating your dependencies.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.yargsStartNxAgentsCommand = void 0;
|
|
4
|
+
const handle_import_1 = require("../../../utils/handle-import");
|
|
5
|
+
const shared_options_1 = require("../../yargs-utils/shared-options");
|
|
6
|
+
exports.yargsStartNxAgentsCommand = {
|
|
7
|
+
command: 'start-nx-agents [options]',
|
|
8
|
+
describe: 'Provisions Nx Agents for distributed task execution, reading configuration from `.nx/ci-config.yaml`. This command is an alias for [`nx-cloud start-nx-agents`](/docs/reference/nx-cloud-cli#nx-cloud-start-nx-agents).',
|
|
9
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
|
10
|
+
.help(false)
|
|
11
|
+
.showHelpOnFail(false)
|
|
12
|
+
.option('help', { describe: 'Show help.', type: 'boolean' }),
|
|
13
|
+
handler: async (args) => {
|
|
14
|
+
process.exit(await (await (0, handle_import_1.handleImport)('./start-nx-agents.js', __dirname)).startNxAgentsHandler(args));
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startNxAgentsHandler = startNxAgentsHandler;
|
|
4
|
+
const nx_json_1 = require("../../../config/nx-json");
|
|
5
|
+
const nx_cloud_utils_1 = require("../../../utils/nx-cloud-utils");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
function startNxAgentsHandler(args) {
|
|
8
|
+
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
9
|
+
(0, utils_1.warnNotConnectedToCloud)();
|
|
10
|
+
return Promise.resolve(0);
|
|
11
|
+
}
|
|
12
|
+
return (0, utils_1.executeNxCloudCommand)('start-nx-agents', args.verbose);
|
|
13
|
+
}
|
|
@@ -31,17 +31,18 @@ const command_object_21 = require("./nx-cloud/logout/command-object");
|
|
|
31
31
|
const command_object_22 = require("./nx-cloud/record/command-object");
|
|
32
32
|
const command_object_23 = require("./nx-cloud/start-agent/command-object");
|
|
33
33
|
const command_object_24 = require("./nx-cloud/start-ci-run/command-object");
|
|
34
|
-
const command_object_25 = require("./
|
|
35
|
-
const command_object_26 = require("./
|
|
36
|
-
const command_object_27 = require("./
|
|
37
|
-
const command_object_28 = require("./
|
|
38
|
-
const command_object_29 = require("./
|
|
39
|
-
const command_object_30 = require("./
|
|
40
|
-
const command_object_31 = require("./run/command-object");
|
|
41
|
-
const command_object_32 = require("./
|
|
42
|
-
const command_object_33 = require("./
|
|
43
|
-
const command_object_34 = require("./
|
|
44
|
-
const command_object_35 = require("./
|
|
34
|
+
const command_object_25 = require("./nx-cloud/start-nx-agents/command-object");
|
|
35
|
+
const command_object_26 = require("./register/command-object");
|
|
36
|
+
const command_object_27 = require("./release/command-object");
|
|
37
|
+
const command_object_28 = require("./repair/command-object");
|
|
38
|
+
const command_object_29 = require("./report/command-object");
|
|
39
|
+
const command_object_30 = require("./reset/command-object");
|
|
40
|
+
const command_object_31 = require("./run-many/command-object");
|
|
41
|
+
const command_object_32 = require("./run/command-object");
|
|
42
|
+
const command_object_33 = require("./show/command-object");
|
|
43
|
+
const command_object_34 = require("./sync/command-object");
|
|
44
|
+
const command_object_35 = require("./watch/command-object");
|
|
45
|
+
const command_object_36 = require("./completion/command-object");
|
|
45
46
|
const trigger_1 = require("./completion/trigger");
|
|
46
47
|
// Ensure that the output takes up the available width of the terminal.
|
|
47
48
|
yargs.wrap(yargs.terminalWidth());
|
|
@@ -59,7 +60,7 @@ exports.commandsObject = yargs
|
|
|
59
60
|
.parserConfiguration(exports.parserConfiguration)
|
|
60
61
|
.usage(pc.bold('Smart Monorepos · Fast Builds'))
|
|
61
62
|
.demandCommand(1, '')
|
|
62
|
-
.command(
|
|
63
|
+
.command(command_object_26.yargsRegisterCommand)
|
|
63
64
|
.command(command_object_1.yargsAddCommand)
|
|
64
65
|
.command(command_object_3.yargsConfigureAiAgentsCommand)
|
|
65
66
|
.command(command_object_2.yargsAffectedBuildCommand)
|
|
@@ -82,29 +83,30 @@ exports.commandsObject = yargs
|
|
|
82
83
|
.command(command_object_13.yargsMigrateCommand)
|
|
83
84
|
.command(command_object_14.yargsNewCommand)
|
|
84
85
|
.command(command_objects_1.yargsPrintAffectedCommand)
|
|
85
|
-
.command(
|
|
86
|
-
.command(
|
|
87
|
-
.command(
|
|
88
|
-
.command(
|
|
89
|
-
.command(
|
|
90
|
-
.command(
|
|
91
|
-
.command(
|
|
92
|
-
.command(
|
|
93
|
-
.command(
|
|
86
|
+
.command(command_object_27.yargsReleaseCommand)
|
|
87
|
+
.command(command_object_28.yargsRepairCommand)
|
|
88
|
+
.command(command_object_29.yargsReportCommand)
|
|
89
|
+
.command(command_object_30.yargsResetCommand)
|
|
90
|
+
.command(command_object_32.yargsRunCommand)
|
|
91
|
+
.command(command_object_31.yargsRunManyCommand)
|
|
92
|
+
.command(command_object_33.yargsShowCommand)
|
|
93
|
+
.command(command_object_34.yargsSyncCommand)
|
|
94
|
+
.command(command_object_34.yargsSyncCheckCommand)
|
|
94
95
|
.command(command_object_17.yargsViewLogsCommand)
|
|
95
|
-
.command(
|
|
96
|
-
.command(
|
|
96
|
+
.command(command_object_35.yargsWatchCommand)
|
|
97
|
+
.command(command_object_32.yargsNxInfixCommand)
|
|
97
98
|
.command(command_object_20.yargsLoginCommand)
|
|
98
99
|
.command(command_object_21.yargsLogoutCommand)
|
|
99
100
|
.command(command_object_22.yargsRecordCommand)
|
|
100
101
|
.command(command_object_24.yargsStartCiRunCommand)
|
|
102
|
+
.command(command_object_25.yargsStartNxAgentsCommand)
|
|
101
103
|
.command(command_object_23.yargsStartAgentCommand)
|
|
102
104
|
.command(command_object_16.yargsStopAllAgentsCommand)
|
|
103
105
|
.command(command_object_19.yargsFixCiCommand)
|
|
104
106
|
.command(command_object_15.yargsApplyLocallyCommand)
|
|
105
107
|
.command(command_object_18.yargsDownloadCloudClientCommand)
|
|
106
108
|
.command(command_object_12.yargsMcpCommand)
|
|
107
|
-
.command(
|
|
109
|
+
.command(command_object_36.yargsCompletionCommand)
|
|
108
110
|
.command(resolveConformanceCommandObject())
|
|
109
111
|
.command(resolveConformanceCheckCommandObject())
|
|
110
112
|
.scriptName('nx')
|
|
@@ -305,6 +305,11 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
305
305
|
const projectNodes = projects.map((name) => projectGraph.nodes[name]);
|
|
306
306
|
if (releaseGroup.projectsRelationship === 'independent') {
|
|
307
307
|
for (const project of projectNodes) {
|
|
308
|
+
if (!projectsVersionData[project.name] ||
|
|
309
|
+
(projectsVersionData[project.name].newVersion === null &&
|
|
310
|
+
!projectsVersionData[project.name].dockerVersion)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
308
313
|
let changes = null;
|
|
309
314
|
if (releaseGroup.resolvedVersionPlans) {
|
|
310
315
|
changes = (0, version_plan_utils_1.createChangesFromProjectsVersionPlans)(releaseGroup.resolvedVersionPlans, project.name);
|
|
@@ -468,7 +468,7 @@ function getAllAuthorsForCommit(commit) {
|
|
|
468
468
|
}
|
|
469
469
|
// https://www.conventionalcommits.org/en/v1.0.0/
|
|
470
470
|
// https://regex101.com/r/FSfNvA/1
|
|
471
|
-
const ConventionalCommitRegex =
|
|
471
|
+
const ConventionalCommitRegex = /^(?<type>[^\s():!]+)(?:\s*\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)$/u;
|
|
472
472
|
const CoAuthoredByRegex = /co-authored-by:\s*(?<name>.+)(<(?<email>.+)>)/gim;
|
|
473
473
|
// GitHub style PR references
|
|
474
474
|
const PullRequestRE = /\([ a-z]*(#\d+)\s*\)/gm;
|
|
@@ -91,6 +91,7 @@ export declare class ReleaseGraph {
|
|
|
91
91
|
}[]>;
|
|
92
92
|
readonly releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>;
|
|
93
93
|
private originalFilteredProjects;
|
|
94
|
+
private matchedProjectsForFilter;
|
|
94
95
|
/**
|
|
95
96
|
* Store the affected graph per commit per project
|
|
96
97
|
* to avoid recomputation of the graph on workspace
|
|
@@ -4,6 +4,7 @@ exports.ReleaseGraph = exports.validReleaseVersionPrefixes = void 0;
|
|
|
4
4
|
exports.createReleaseGraph = createReleaseGraph;
|
|
5
5
|
const affected_project_graph_1 = require("../../../project-graph/affected/affected-project-graph");
|
|
6
6
|
const file_utils_1 = require("../../../project-graph/file-utils");
|
|
7
|
+
const find_matching_projects_1 = require("../../../utils/find-matching-projects");
|
|
7
8
|
const config_1 = require("../config/config");
|
|
8
9
|
const project_logger_1 = require("../version/project-logger");
|
|
9
10
|
const resolve_current_version_1 = require("../version/resolve-current-version");
|
|
@@ -43,6 +44,7 @@ class ReleaseGraph {
|
|
|
43
44
|
this.originalDependentProjectsPerProject = new Map();
|
|
44
45
|
this.releaseGroupToFilteredProjects = new Map();
|
|
45
46
|
this.originalFilteredProjects = new Set();
|
|
47
|
+
this.matchedProjectsForFilter = new Set();
|
|
46
48
|
/**
|
|
47
49
|
* Store the affected graph per commit per project
|
|
48
50
|
* to avoid recomputation of the graph on workspace
|
|
@@ -61,6 +63,12 @@ class ReleaseGraph {
|
|
|
61
63
|
* @internal - Called by createReleaseGraph(), not meant for external use
|
|
62
64
|
*/
|
|
63
65
|
async init(options) {
|
|
66
|
+
if (this.filters.projects?.length) {
|
|
67
|
+
this.matchedProjectsForFilter = new Set((0, find_matching_projects_1.findMatchingProjects)([...this.filters.projects], options.projectGraph.nodes));
|
|
68
|
+
if (this.matchedProjectsForFilter.size === 0) {
|
|
69
|
+
throw new Error(`Your --projects filter "${this.filters.projects}" did not match any projects in the workspace`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
64
72
|
// Step 1: Setup project to release group mapping
|
|
65
73
|
this.setupProjectReleaseGroupMapping();
|
|
66
74
|
// Step 2: Apply initial filtering to determine base set of projects and groups to process
|
|
@@ -122,7 +130,7 @@ class ReleaseGraph {
|
|
|
122
130
|
const filteredProjects = new Set();
|
|
123
131
|
for (const project of releaseGroup.projects) {
|
|
124
132
|
if (this.filters.projects?.length &&
|
|
125
|
-
!this.
|
|
133
|
+
!this.matchedProjectsForFilter.has(project)) {
|
|
126
134
|
continue;
|
|
127
135
|
}
|
|
128
136
|
filteredProjects.add(project);
|
|
@@ -162,7 +170,7 @@ class ReleaseGraph {
|
|
|
162
170
|
if (filters.groups?.includes(groupName)) {
|
|
163
171
|
projectsToProcess.add(project);
|
|
164
172
|
}
|
|
165
|
-
else if (
|
|
173
|
+
else if (this.matchedProjectsForFilter.has(project)) {
|
|
166
174
|
projectsToProcess.add(project);
|
|
167
175
|
}
|
|
168
176
|
const projectGraphNode = projectGraph.nodes[project];
|
|
@@ -662,7 +670,11 @@ Valid values are: ${exports.validReleaseVersionPrefixes
|
|
|
662
670
|
head: commit.shortHash,
|
|
663
671
|
});
|
|
664
672
|
// Use the same affected detection logic as `nx affected`
|
|
665
|
-
affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles
|
|
673
|
+
affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles, undefined, undefined,
|
|
674
|
+
// Release evaluates historical commits against the current project
|
|
675
|
+
// graph. A project configuration which no longer exists must not make
|
|
676
|
+
// every surviving release project relevant to that commit.
|
|
677
|
+
false);
|
|
666
678
|
this.affectedGraphPerCommit.set(shortHash, affectedGraph);
|
|
667
679
|
return affectedGraph;
|
|
668
680
|
}
|
|
@@ -45,6 +45,14 @@ export declare abstract class VersionActions {
|
|
|
45
45
|
* If a manifest file is not applicable to the current versioning use-case, this should be set to null.
|
|
46
46
|
*/
|
|
47
47
|
abstract validManifestFilenames: string[] | null;
|
|
48
|
+
/**
|
|
49
|
+
* Whether manifests updated by this implementation should be excluded from
|
|
50
|
+
* the final Prettier pass performed by Nx Release.
|
|
51
|
+
*
|
|
52
|
+
* Custom implementations must opt in explicitly. This defaults to false so
|
|
53
|
+
* their existing formatting behavior does not change.
|
|
54
|
+
*/
|
|
55
|
+
excludeManifestsFromFormatting: boolean;
|
|
48
56
|
/**
|
|
49
57
|
* The interpolated manifest paths to update, if applicable based on the user's configuration, when new
|
|
50
58
|
* versions and dependencies are determined. If no manifest files should be updated based on the user's
|
|
@@ -84,6 +84,14 @@ class VersionActions {
|
|
|
84
84
|
this.releaseGroup = releaseGroup;
|
|
85
85
|
this.projectGraphNode = projectGraphNode;
|
|
86
86
|
this.finalConfigForProject = finalConfigForProject;
|
|
87
|
+
/**
|
|
88
|
+
* Whether manifests updated by this implementation should be excluded from
|
|
89
|
+
* the final Prettier pass performed by Nx Release.
|
|
90
|
+
*
|
|
91
|
+
* Custom implementations must opt in explicitly. This defaults to false so
|
|
92
|
+
* their existing formatting behavior does not change.
|
|
93
|
+
*/
|
|
94
|
+
this.excludeManifestsFromFormatting = false;
|
|
87
95
|
/**
|
|
88
96
|
* The interpolated manifest paths to update, if applicable based on the user's configuration, when new
|
|
89
97
|
* versions and dependencies are determined. If no manifest files should be updated based on the user's
|
|
@@ -173,11 +173,15 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
173
173
|
// Bubble up the error so that the CLI can print the error and exit, or the programmatic API can handle it
|
|
174
174
|
throw err;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
// A version actions implementation can opt its manifests out of this final
|
|
177
|
+
// pass when it already preserves their formatting while updating values.
|
|
178
|
+
const manifestsToExcludeFromFormatting = new Set(Array.from(releaseGraph.projectsToVersionActions.values()).flatMap((versionActions) => versionActions.excludeManifestsFromFormatting
|
|
179
|
+
? versionActions.manifestsToUpdate.map(({ manifestPath }) => manifestPath)
|
|
180
|
+
: []));
|
|
181
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
|
182
|
+
silent: true,
|
|
183
|
+
excludePaths: manifestsToExcludeFromFormatting,
|
|
184
|
+
});
|
|
181
185
|
printAndFlushChanges(tree, !!args.dryRun);
|
|
182
186
|
const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
|
|
183
187
|
...nxReleaseConfig.version
|
|
@@ -137,7 +137,12 @@ function cleanupCacheEntries() {
|
|
|
137
137
|
}
|
|
138
138
|
function cleanupNativeFileCache() {
|
|
139
139
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
|
140
|
-
|
|
140
|
+
// Null when the native cache root is not a real directory we own, which
|
|
141
|
+
// would mean deleting through a path another user planted.
|
|
142
|
+
const cacheDir = (0, native_file_cache_location_1.getNativeFileCacheLocationToDelete)();
|
|
143
|
+
if (cacheDir) {
|
|
144
|
+
(0, node_fs_1.rmSync)(cacheDir, { recursive: true, force: true });
|
|
145
|
+
}
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
148
|
function cleanupWorkspaceData() {
|
|
@@ -51,6 +51,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
|
|
54
|
+
await output_1.output.drain();
|
|
54
55
|
process.exit(status);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -41,6 +41,7 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = {
|
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
44
|
+
await output_1.output.drain();
|
|
44
45
|
process.exit(status);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -66,15 +66,24 @@ export type PackageJsonUpdates = {
|
|
|
66
66
|
*
|
|
67
67
|
* - `nextSteps`: workspace-wide notes surfaced to the human in the `nx migrate`
|
|
68
68
|
* post-run summary. Same audience as the legacy `string[]` return.
|
|
69
|
-
* - `agentContext`:
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
69
|
+
* - `agentContext`: agent-only by contract. With the agentic flow on it is
|
|
70
|
+
* delivered to the agent as part of its outer prompt, but only when the step
|
|
71
|
+
* it feeds actually runs: a hybrid's paired prompt, or the validation pass
|
|
72
|
+
* after a generator-only migration, which also needs file changes and no
|
|
73
|
+
* `--no-validate`. When `nx migrate` itself runs inside an outer agent it goes
|
|
74
|
+
* to stdout for that agent instead. Anything else drops it, so content meant
|
|
75
|
+
* for the human in any scenario belongs in `nextSteps`.
|
|
76
|
+
* - `skipAgentic`: set to `true` to declare that the deterministic run handled
|
|
77
|
+
* everything, so `nx migrate` skips the AI step it would otherwise run: the
|
|
78
|
+
* paired prompt of a hybrid migration, or the generic validation step of a
|
|
79
|
+
* generator-only one. Omitting it keeps the AI step, so this is opt-in.
|
|
80
|
+
* Where the waiver takes effect, `agentContext` is dropped along with the
|
|
81
|
+
* step it was meant for.
|
|
74
82
|
*/
|
|
75
83
|
export interface MigrationReturnObject {
|
|
76
84
|
nextSteps?: string[];
|
|
77
85
|
agentContext?: string[];
|
|
86
|
+
skipAgentic?: boolean;
|
|
78
87
|
}
|
|
79
88
|
export type Migration = (tree: Tree) => void | string[] | MigrationReturnObject | Promise<void | string[] | MigrationReturnObject>;
|
|
80
89
|
export interface MigrationsJsonEntry {
|
|
@@ -87,8 +96,11 @@ export interface MigrationsJsonEntry {
|
|
|
87
96
|
/**
|
|
88
97
|
* Path to a markdown doc describing the migration, relative to the
|
|
89
98
|
* `migrations.json` and resolved like `implementation`/`factory`. Always
|
|
90
|
-
* supplementary; never stands in for them. Under `--run-migrations
|
|
91
|
-
*
|
|
99
|
+
* supplementary; never stands in for them. Under `--run-migrations` it is
|
|
100
|
+
* resolved only when the agentic flow is on, and goes to the agent running
|
|
101
|
+
* the prompt or the validation pass. `--run-migration` resolves it for those
|
|
102
|
+
* same steps, and again when it hands a prompt off instead of running it, to
|
|
103
|
+
* an outer agent or to the user.
|
|
92
104
|
*/
|
|
93
105
|
documentation?: string;
|
|
94
106
|
}
|