nx 23.2.0-beta.7 → 23.2.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/init-local.js +3 -5
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +2 -2
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +17 -23
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
- package/dist/src/command-line/init/command-object.js +4 -2
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +5 -0
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +37 -56
- package/dist/src/command-line/migrate/agentic/definitions.js +35 -8
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +22 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +13 -10
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +3 -1
- package/dist/src/command-line/migrate/agentic/handoff.js +4 -2
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.js +20 -30
- package/dist/src/command-line/migrate/agentic/types.d.ts +19 -3
- package/dist/src/command-line/migrate/agentic/types.js +13 -4
- package/dist/src/command-line/migrate/command-object.d.ts +3 -0
- package/dist/src/command-line/migrate/command-object.js +13 -0
- package/dist/src/command-line/migrate/execute-migration.d.ts +14 -0
- package/dist/src/command-line/migrate/execute-migration.js +30 -9
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +28 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +51 -1
- package/dist/src/command-line/migrate/migrate-commits.d.ts +8 -2
- package/dist/src/command-line/migrate/migrate-commits.js +66 -19
- package/dist/src/command-line/migrate/migrate-config.d.ts +4 -2
- package/dist/src/command-line/migrate/migrate-config.js +12 -4
- package/dist/src/command-line/migrate/migrate.d.ts +13 -2
- package/dist/src/command-line/migrate/migrate.js +243 -80
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +7 -0
- package/dist/src/command-line/migrate/run/index.js +19 -1
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +58 -0
- package/dist/src/command-line/migrate/run/util.js +139 -7
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -0
- package/dist/src/command-line/migrate/run/worker.js +308 -45
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +6 -4
- package/dist/src/command-line/migrate/version-skew-guard.js +34 -14
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +16 -20
- package/dist/src/command-line/release/changelog.js +6 -17
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +16 -22
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +13 -22
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version.js +2 -2
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.js +11 -2
- package/dist/src/devkit-internals.d.ts +7 -2
- package/dist/src/devkit-internals.js +22 -6
- package/dist/src/generators/internal-utils/{format-changed-files-with-prettier-if-available.d.ts → format-changed-files.d.ts} +6 -6
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -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/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +128 -2
- package/dist/src/tasks-runner/run-command.js +17 -32
- package/dist/src/tasks-runner/task-env.js +5 -2
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/analytics-prompt.js +4 -7
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-utils.d.ts +33 -2
- package/dist/src/utils/git-utils.js +156 -8
- package/dist/src/utils/ignore.d.ts +47 -5
- package/dist/src/utils/ignore.js +93 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +21 -2
- package/dist/src/utils/package-manager.js +244 -47
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/migrations.json +6 -0
- package/package.json +17 -13
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -88
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -3,13 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.commitMigrationIfRequested = commitMigrationIfRequested;
|
|
4
4
|
exports.commitCheckpointBeforeMigrations = commitCheckpointBeforeMigrations;
|
|
5
5
|
exports.resolveCreateCommits = resolveCreateCommits;
|
|
6
|
+
exports.confirmMigrationCommitsOnDefaultBranch = confirmMigrationCommitsOnDefaultBranch;
|
|
6
7
|
exports.confirmCommitsOnDefaultBranch = confirmCommitsOnDefaultBranch;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
10
|
+
const configuration_1 = require("../../config/configuration");
|
|
11
|
+
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
9
12
|
const git_utils_1 = require("../../utils/git-utils");
|
|
10
13
|
const logger_1 = require("../../utils/logger");
|
|
11
14
|
const output_1 = require("../../utils/output");
|
|
15
|
+
const types_1 = require("./agentic/types");
|
|
12
16
|
const safe_prompt_1 = require("./safe-prompt");
|
|
17
|
+
// `git add -A` captures an orchestrated run's scratch state whenever the
|
|
18
|
+
// ignore rule that normally hides it goes missing mid-run (a checkout, a
|
|
19
|
+
// .gitignore edit, or the migration's own changes).
|
|
20
|
+
const MIGRATE_COMMIT_EXCLUDES = [types_1.MIGRATE_RUNS_RELATIVE_DIR];
|
|
13
21
|
/**
|
|
14
22
|
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
15
23
|
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
@@ -23,15 +31,16 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
23
31
|
if (!shouldCreateCommits)
|
|
24
32
|
return { status: 'disabled' };
|
|
25
33
|
await installDepsIfChanged();
|
|
26
|
-
// Generator may have only touched gitignored paths
|
|
27
|
-
// made no change
|
|
28
|
-
|
|
34
|
+
// Generator may have only touched gitignored paths or the excluded scratch
|
|
35
|
+
// dir, or the prompt half made no change: log neutrally, not as an error.
|
|
36
|
+
// The probe excludes what the commit excludes, else the commit fails empty.
|
|
37
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, MIGRATE_COMMIT_EXCLUDES)) {
|
|
29
38
|
logger_1.logger.info(pc.dim(`- No changes to commit for ${migration.name}.`));
|
|
30
39
|
return { status: 'no-changes' };
|
|
31
40
|
}
|
|
32
41
|
const commitMessage = buildCommitMessage(`${commitPrefix}${migration.name}`, pendingMigrations);
|
|
33
42
|
try {
|
|
34
|
-
const sha = (0, git_utils_1.tryCommitChanges)(commitMessage, root);
|
|
43
|
+
const sha = (0, git_utils_1.tryCommitChanges)(commitMessage, root, MIGRATE_COMMIT_EXCLUDES);
|
|
35
44
|
if (sha)
|
|
36
45
|
return { status: 'committed', sha };
|
|
37
46
|
// null = commit landed but `git rev-parse HEAD` failed (see
|
|
@@ -74,10 +83,10 @@ function buildCommitMessage(subject, pendingMigrations) {
|
|
|
74
83
|
* the working tree is already clean.
|
|
75
84
|
*/
|
|
76
85
|
function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
77
|
-
if (!(0, git_utils_1.hasUncommittedChanges)(root))
|
|
86
|
+
if (!(0, git_utils_1.hasUncommittedChanges)(root, MIGRATE_COMMIT_EXCLUDES))
|
|
78
87
|
return;
|
|
79
88
|
try {
|
|
80
|
-
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root);
|
|
89
|
+
const sha = (0, git_utils_1.tryCommitChanges)(`${commitPrefix}checkpoint before running migrations`, root, MIGRATE_COMMIT_EXCLUDES);
|
|
81
90
|
if (sha) {
|
|
82
91
|
logger_1.logger.info(pc.dim(`- Checkpoint commit created: ${sha}`));
|
|
83
92
|
return;
|
|
@@ -108,7 +117,11 @@ function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
|
108
117
|
* pointing at git.
|
|
109
118
|
*/
|
|
110
119
|
function resolveCreateCommits(args) {
|
|
111
|
-
const { createCommits,
|
|
120
|
+
const { createCommits, mode, isGitRepo, commitPrefixIsCustom } = args;
|
|
121
|
+
// The orchestrator forces the agentic defaults without the `--agentic` flag,
|
|
122
|
+
// so its warnings must not name a flag the user never passed.
|
|
123
|
+
const orchestrated = mode === 'orchestrated';
|
|
124
|
+
const agenticKind = orchestrated ? 'enabled' : mode;
|
|
112
125
|
if (createCommits === true && !isGitRepo) {
|
|
113
126
|
return {
|
|
114
127
|
effective: false,
|
|
@@ -121,7 +134,9 @@ function resolveCreateCommits(args) {
|
|
|
121
134
|
return {
|
|
122
135
|
effective: false,
|
|
123
136
|
agenticHasDiffContext: false,
|
|
124
|
-
warning:
|
|
137
|
+
warning: (orchestrated
|
|
138
|
+
? "--no-create-commits was passed, but orchestrated migrate runs create per-migration commits by default. Without them, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review."
|
|
139
|
+
: "--no-create-commits was passed alongside --agentic. Without per-migration commits, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review.") +
|
|
125
140
|
(commitPrefixIsCustom
|
|
126
141
|
? ' Note: the custom --commit-prefix value will have no effect because commits are disabled.'
|
|
127
142
|
: ''),
|
|
@@ -133,7 +148,9 @@ function resolveCreateCommits(args) {
|
|
|
133
148
|
return {
|
|
134
149
|
effective: false,
|
|
135
150
|
agenticHasDiffContext: false,
|
|
136
|
-
warning:
|
|
151
|
+
warning: (orchestrated
|
|
152
|
+
? 'Orchestrated migrate runs create per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.'
|
|
153
|
+
: '`--agentic` enables per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.') +
|
|
137
154
|
(commitPrefixIsCustom
|
|
138
155
|
? ' The custom --commit-prefix value will have no effect.'
|
|
139
156
|
: ''),
|
|
@@ -149,22 +166,52 @@ function resolveCreateCommits(args) {
|
|
|
149
166
|
: undefined,
|
|
150
167
|
};
|
|
151
168
|
}
|
|
169
|
+
// The branch to hold `getBaseRef`'s value against. It may name a remote-tracking
|
|
170
|
+
// ref whose local counterpart drops the remote (the CI-workflow generator writes
|
|
171
|
+
// `origin/<branch>`), yet a local branch can be named `up/feature` while `up` is
|
|
172
|
+
// a remote, so an exact match wins before any stripping and the longest matching
|
|
173
|
+
// remote wins after. `origin` counts even undeclared: the generator assumes it.
|
|
174
|
+
function defaultBranchToCompare(baseRef, currentBranch, root) {
|
|
175
|
+
if (currentBranch === baseRef) {
|
|
176
|
+
return baseRef;
|
|
177
|
+
}
|
|
178
|
+
const remote = [...(0, git_utils_1.getGitRemoteNames)(root), 'origin']
|
|
179
|
+
.filter((name) => baseRef.startsWith(`${name}/`))
|
|
180
|
+
.sort((a, b) => b.length - a.length)[0];
|
|
181
|
+
return remote ? baseRef.slice(remote.length + 1) : baseRef;
|
|
182
|
+
}
|
|
152
183
|
/**
|
|
184
|
+
* Asks before a run starts committing on the workspace's default branch, and
|
|
185
|
+
* reports the decision when the answer is no. Returns whether to proceed.
|
|
186
|
+
*
|
|
153
187
|
* Callers gate this on commits being effective and on prompting being
|
|
154
|
-
* possible, so non-interactive runs (CI, `--no-interactive`) never reach here
|
|
188
|
+
* possible, so non-interactive runs (CI, `--no-interactive`) never reach here;
|
|
189
|
+
* `confirmCommitsOnDefaultBranch` has no guard of its own and would block on a
|
|
190
|
+
* prompt nobody can answer.
|
|
155
191
|
*/
|
|
192
|
+
async function confirmMigrationCommitsOnDefaultBranch(root, whatWouldRun) {
|
|
193
|
+
const currentBranch = (0, git_utils_1.getGitCurrentBranch)(root);
|
|
194
|
+
const proceed = await confirmCommitsOnDefaultBranch({
|
|
195
|
+
currentBranch,
|
|
196
|
+
defaultBranch: defaultBranchToCompare((0, command_line_utils_1.getBaseRef)((0, configuration_1.readNxJson)(root)), currentBranch, root),
|
|
197
|
+
});
|
|
198
|
+
if (!proceed) {
|
|
199
|
+
output_1.output.log({
|
|
200
|
+
title: `Skipped ${whatWouldRun} to avoid committing to the default branch '${currentBranch}'.`,
|
|
201
|
+
bodyLines: [
|
|
202
|
+
'Switch to a different branch and re-run, or re-run and confirm to proceed.',
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return proceed;
|
|
207
|
+
}
|
|
156
208
|
async function confirmCommitsOnDefaultBranch(args) {
|
|
157
209
|
const { currentBranch, defaultBranch } = args;
|
|
158
210
|
if (!currentBranch || !defaultBranch || currentBranch !== defaultBranch) {
|
|
159
211
|
return true;
|
|
160
212
|
}
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
message: `You're on the default branch '${currentBranch}'. nx migrate will create a commit for each migration on this branch. Continue?`,
|
|
166
|
-
initial: false,
|
|
167
|
-
},
|
|
168
|
-
]);
|
|
169
|
-
return proceed;
|
|
213
|
+
return (0, safe_prompt_1.migrateConfirm)({
|
|
214
|
+
message: `You're on the default branch '${currentBranch}'. nx migrate will create a commit for each migration on this branch. Continue?`,
|
|
215
|
+
initial: false,
|
|
216
|
+
});
|
|
170
217
|
}
|
|
@@ -8,8 +8,10 @@ import { type MigrateArgs } from './command-object';
|
|
|
8
8
|
* Phase-aware so each option is only filled where it is consumed, and so a
|
|
9
9
|
* config value never trips the mutually-exclusive-flag guards in
|
|
10
10
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
11
|
-
* phase only
|
|
12
|
-
* running the whole migrations file or a single migration.
|
|
11
|
+
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
12
|
+
* running the whole migrations file or a standalone single migration. A
|
|
13
|
+
* `--run-id` invocation takes none of them: a recorded run takes its commit
|
|
14
|
+
* config from run.json and is driven by the outer agent.
|
|
13
15
|
*
|
|
14
16
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
15
17
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -13,8 +13,10 @@ const MULTI_MAJOR_MODE_ENV = 'NX_MULTI_MAJOR_MODE';
|
|
|
13
13
|
* Phase-aware so each option is only filled where it is consumed, and so a
|
|
14
14
|
* config value never trips the mutually-exclusive-flag guards in
|
|
15
15
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
16
|
-
* phase only
|
|
17
|
-
* running the whole migrations file or a single migration.
|
|
16
|
+
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
17
|
+
* running the whole migrations file or a standalone single migration. A
|
|
18
|
+
* `--run-id` invocation takes none of them: a recorded run takes its commit
|
|
19
|
+
* config from run.json and is driven by the outer agent.
|
|
18
20
|
*
|
|
19
21
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
20
22
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -28,8 +30,14 @@ function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
|
28
30
|
// `--run-migrations` with no value is normalized to '' by yargs, so a defined
|
|
29
31
|
// (even empty-string) value means we're in the run-migrations phase.
|
|
30
32
|
const isRunMigrations = merged.runMigrations !== undefined;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
// A bare `--run-id` (orchestrated reconcile) must never take the
|
|
34
|
+
// generate-options overlay, which would leak `include` etc. from nx.json.
|
|
35
|
+
const isSingleMigration = merged.runMigration !== undefined || merged.runId !== undefined;
|
|
36
|
+
// Both overlays are for an invocation that decides these options for
|
|
37
|
+
// itself, which a `--run-id` invocation never does: the recorded worker and
|
|
38
|
+
// the reconcile both read the commit config from run.json, and overlaying
|
|
39
|
+
// `agentic` would trip the `--agentic`/`--run-id` parse conflict.
|
|
40
|
+
if ((isRunMigrations || isSingleMigration) && merged.runId === undefined) {
|
|
33
41
|
if (merged.createCommits === undefined &&
|
|
34
42
|
migrateConfig.createCommits !== undefined) {
|
|
35
43
|
assertType(migrateConfig.createCommits, 'boolean', 'createCommits');
|
|
@@ -10,6 +10,7 @@ import type { ResolvedAgentic } from './agentic/types';
|
|
|
10
10
|
import { isHybridMigration, isPromptOnlyMigration, type PlannedMigration } from './migration-shape';
|
|
11
11
|
import { filterDowngradedUpdates } from './update-filters';
|
|
12
12
|
import { normalizeVersion } from './version-utils';
|
|
13
|
+
import { type StepAction } from './step-actions';
|
|
13
14
|
export * from './execute-migration';
|
|
14
15
|
export { normalizeVersion };
|
|
15
16
|
export interface ResolvedMigrationConfiguration extends MigrationsJson {
|
|
@@ -64,6 +65,8 @@ export declare class Migrator {
|
|
|
64
65
|
private readonly packageUpdates;
|
|
65
66
|
private readonly collectedVersions;
|
|
66
67
|
private readonly promptAnswers;
|
|
68
|
+
private readonly pendingPackageJsonUpdates;
|
|
69
|
+
private readonly appliedPackageJsonUpdates;
|
|
67
70
|
private readonly nxInstallation;
|
|
68
71
|
private minVersionWithSkippedUpdates;
|
|
69
72
|
constructor(opts: MigratorOptions);
|
|
@@ -86,6 +89,8 @@ export declare class Migrator {
|
|
|
86
89
|
}>;
|
|
87
90
|
private createMigrateJson;
|
|
88
91
|
private buildPackageJsonUpdates;
|
|
92
|
+
private applyPackageJsonUpdate;
|
|
93
|
+
private applyPendingPackageJsonUpdates;
|
|
89
94
|
private resolveVersionForCascade;
|
|
90
95
|
private populatePackageJsonUpdatesAndGetPackagesToCheck;
|
|
91
96
|
private getPackageJsonUpdatesFromMigrationConfig;
|
|
@@ -170,11 +175,17 @@ type RunMigrations = {
|
|
|
170
175
|
type RunSingleMigration = {
|
|
171
176
|
type: 'runSingleMigration';
|
|
172
177
|
runMigration: string;
|
|
178
|
+
runId?: string;
|
|
173
179
|
agentic: AgenticArg;
|
|
174
180
|
validate?: boolean;
|
|
175
181
|
interactive?: boolean;
|
|
176
182
|
};
|
|
177
|
-
|
|
183
|
+
type OrchestratorReconcile = {
|
|
184
|
+
type: 'orchestratorReconcile';
|
|
185
|
+
runId: string;
|
|
186
|
+
stepAction?: StepAction;
|
|
187
|
+
};
|
|
188
|
+
export declare function parseMigrationsOptions(options: MigrateArgs, fetch?: MigratorOptions['fetch']): Promise<GenerateMigrations | RunMigrations | RunSingleMigration | OrchestratorReconcile>;
|
|
178
189
|
export declare function createFetcher(pmc: PackageManagerCommands): ((pkg: string, version: string) => Promise<ResolvedMigrationConfiguration>) & {
|
|
179
190
|
stats?: MigrateFetchStats;
|
|
180
191
|
};
|
|
@@ -193,7 +204,7 @@ export declare function executeMigrations(root: string, migrations: PlannedMigra
|
|
|
193
204
|
waivedAgenticStepsCount: number;
|
|
194
205
|
retainedAtSuccess: string[];
|
|
195
206
|
}>;
|
|
196
|
-
export declare function
|
|
207
|
+
export declare function isRunPhaseInvocation(args: Pick<MigrateArgs, 'runMigration' | 'runId' | 'stepAction'>): boolean;
|
|
197
208
|
export declare function migrate(root: string, args: {
|
|
198
209
|
[k: string]: any;
|
|
199
210
|
}, rawArgs: string[]): Promise<number>;
|