nx 23.0.0-beta.2 → 23.0.0-beta.21
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 +11 -20
- package/dist/bin/nx.d.ts +1 -0
- package/dist/bin/nx.js +28 -2
- package/dist/plugins/package-json.js +4 -2
- package/dist/src/adapter/ngcli-adapter.d.ts +2 -1
- package/dist/src/adapter/ngcli-adapter.js +25 -2
- package/dist/src/ai/clone-ai-config-repo.js +20 -3
- package/dist/src/analytics/analytics.js +10 -1
- package/dist/src/command-line/add/completion.d.ts +1 -0
- package/dist/src/command-line/add/completion.js +15 -0
- package/dist/src/command-line/affected/completion.d.ts +1 -0
- package/dist/src/command-line/affected/completion.js +15 -0
- package/dist/src/command-line/completion/argv-layout.d.ts +6 -0
- package/dist/src/command-line/completion/argv-layout.js +19 -0
- package/dist/src/command-line/completion/command-completions.d.ts +19 -0
- package/dist/src/command-line/completion/command-completions.js +120 -0
- package/dist/src/command-line/completion/command-handlers.d.ts +30 -0
- package/dist/src/command-line/completion/command-handlers.js +69 -0
- package/dist/src/command-line/completion/command-object.d.ts +10 -0
- package/dist/src/command-line/completion/command-object.js +95 -0
- package/dist/src/command-line/completion/completion-providers.d.ts +21 -0
- package/dist/src/command-line/completion/completion-providers.js +194 -0
- package/dist/src/command-line/completion/infix-targets.d.ts +1 -0
- package/dist/src/command-line/completion/infix-targets.js +48 -0
- package/dist/src/command-line/completion/metadata.d.ts +22 -0
- package/dist/src/command-line/completion/metadata.js +71 -0
- package/dist/src/command-line/completion/registrations.d.ts +9 -0
- package/dist/src/command-line/completion/registrations.js +16 -0
- package/dist/src/command-line/completion/scripts/bash.sh +51 -0
- package/dist/src/command-line/completion/scripts/fish.fish +47 -0
- package/dist/src/command-line/completion/scripts/powershell.ps1 +52 -0
- package/dist/src/command-line/completion/scripts/zsh.zsh +69 -0
- package/dist/src/command-line/completion/scripts.d.ts +18 -0
- package/dist/src/command-line/completion/scripts.js +140 -0
- package/dist/src/command-line/completion/trigger.d.ts +3 -0
- package/dist/src/command-line/completion/trigger.js +21 -0
- package/dist/src/command-line/completion/value-completions.d.ts +3 -0
- package/dist/src/command-line/completion/value-completions.js +21 -0
- package/dist/src/command-line/examples.js +1 -1
- package/dist/src/command-line/format/format.js +15 -5
- package/dist/src/command-line/generate/completion.d.ts +1 -0
- package/dist/src/command-line/generate/completion.js +9 -0
- package/dist/src/command-line/graph/completion.d.ts +1 -0
- package/dist/src/command-line/graph/completion.js +13 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +14 -18
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -0
- package/dist/src/command-line/init/implementation/utils.d.ts +7 -1
- package/dist/src/command-line/init/implementation/utils.js +51 -14
- package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/capture-generator-output.js +100 -0
- package/dist/src/command-line/migrate/agentic/cli-args.d.ts +12 -0
- package/dist/src/command-line/migrate/agentic/cli-args.js +38 -0
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +6 -0
- package/dist/src/command-line/migrate/agentic/definitions.js +98 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/detect-installed.js +68 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +87 -0
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +63 -0
- package/dist/src/command-line/migrate/agentic/handoff.js +183 -0
- package/dist/src/command-line/migrate/agentic/inception.d.ts +9 -0
- package/dist/src/command-line/migrate/agentic/inception.js +15 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +22 -0
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +50 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +51 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +65 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +44 -0
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +52 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +26 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +18 -0
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +130 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +46 -0
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +88 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +51 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +121 -0
- package/dist/src/command-line/migrate/agentic/runner.d.ts +33 -0
- package/dist/src/command-line/migrate/agentic/runner.js +442 -0
- package/dist/src/command-line/migrate/agentic/select.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/select.js +150 -0
- package/dist/src/command-line/migrate/agentic/types.d.ts +102 -0
- package/dist/src/command-line/migrate/agentic/types.js +2 -0
- package/dist/src/command-line/migrate/command-object.d.ts +1 -0
- package/dist/src/command-line/migrate/command-object.js +32 -7
- package/dist/src/command-line/migrate/migrate-commits.d.ts +50 -0
- package/dist/src/command-line/migrate/migrate-commits.js +102 -0
- package/dist/src/command-line/migrate/migrate-output.d.ts +180 -0
- package/dist/src/command-line/migrate/migrate-output.js +258 -0
- package/dist/src/command-line/migrate/migrate.d.ts +122 -12
- package/dist/src/command-line/migrate/migrate.js +1036 -217
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/migration-shape.js +13 -0
- package/dist/src/command-line/migrate/multi-major.d.ts +30 -0
- package/dist/src/command-line/migrate/multi-major.js +185 -0
- package/dist/src/command-line/migrate/prompt-files.d.ts +31 -0
- package/dist/src/command-line/migrate/prompt-files.js +141 -0
- package/dist/src/command-line/migrate/run-migration-process.js +28 -6
- package/dist/src/command-line/migrate/safe-prompt.d.ts +28 -0
- package/dist/src/command-line/migrate/safe-prompt.js +49 -0
- package/dist/src/command-line/migrate/update-filters.d.ts +11 -0
- package/dist/src/command-line/migrate/update-filters.js +44 -0
- package/dist/src/command-line/migrate/version-utils.d.ts +6 -0
- package/dist/src/command-line/migrate/version-utils.js +59 -0
- package/dist/src/command-line/nx-commands.js +9 -0
- package/dist/src/command-line/release/config/config.d.ts +3 -6
- package/dist/src/command-line/release/config/config.js +77 -45
- package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
- package/dist/src/command-line/release/utils/release-graph.js +2 -3
- package/dist/src/command-line/release/utils/repository-git-tags.js +1 -1
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +7 -19
- package/dist/src/command-line/release/version/resolve-current-version.js +1 -1
- package/dist/src/command-line/release/version/version-actions.js +3 -7
- package/dist/src/command-line/report/report.js +2 -2
- package/dist/src/command-line/run/completion.d.ts +1 -0
- package/dist/src/command-line/run/completion.js +7 -0
- package/dist/src/command-line/run-many/completion.d.ts +1 -0
- package/dist/src/command-line/run-many/completion.js +13 -0
- package/dist/src/command-line/show/completion.d.ts +1 -0
- package/dist/src/command-line/show/completion.js +27 -0
- package/dist/src/command-line/show/show-target/info.d.ts +1 -0
- package/dist/src/command-line/show/show-target/info.js +100 -19
- package/dist/src/command-line/watch/command-object.js +24 -4
- package/dist/src/command-line/watch/completion.d.ts +1 -0
- package/dist/src/command-line/watch/completion.js +10 -0
- package/dist/src/command-line/watch/watch.d.ts +7 -0
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +25 -2
- package/dist/src/config/nx-json.d.ts +43 -56
- package/dist/src/config/schema-utils.d.ts +21 -0
- package/dist/src/config/schema-utils.js +92 -18
- package/dist/src/config/task-graph.d.ts +4 -107
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.css +2 -3
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +1 -1
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +1 -1
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +9 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +76 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +45 -11
- package/dist/src/daemon/server/server.js +4 -43
- package/dist/src/daemon/server/start.d.ts +1 -1
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/devkit-exports.d.ts +2 -2
- package/dist/src/devkit-internals.d.ts +5 -1
- package/dist/src/devkit-internals.js +17 -1
- package/dist/src/executors/run-commands/running-tasks.d.ts +7 -0
- package/dist/src/executors/run-commands/running-tasks.js +178 -105
- package/dist/src/executors/run-script/run-script.impl.js +3 -10
- package/dist/src/executors/utils/convert-nx-executor.js +1 -1
- package/dist/src/hasher/hash-plan-inspector.d.ts +1 -1
- package/dist/src/hasher/task-hasher.js +6 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +6 -2
- package/dist/src/migrations/update-17-0-0/move-cache-directory.md +31 -0
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +20 -4
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +27 -0
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +24 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +49 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +54 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +28 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +22 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +11 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.d.ts +35 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.js +139 -0
- package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.md +66 -0
- package/dist/src/native/index.d.ts +79 -2
- package/dist/src/native/native-bindings.js +3 -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/plugins/js/lock-file/npm-parser.js +37 -19
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +51 -4
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +12 -4
- package/dist/src/plugins/js/utils/packages.js +1 -1
- package/dist/src/plugins/js/utils/register.d.ts +103 -14
- package/dist/src/plugins/js/utils/register.js +434 -39
- package/dist/src/plugins/js/utils/typescript.d.ts +7 -0
- package/dist/src/plugins/js/utils/typescript.js +39 -0
- package/dist/src/plugins/package-json/create-nodes.d.ts +3 -2
- package/dist/src/plugins/package-json/create-nodes.js +7 -5
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +2 -1
- package/dist/src/project-graph/build-project-graph.d.ts +5 -0
- package/dist/src/project-graph/build-project-graph.js +6 -2
- package/dist/src/project-graph/file-map-utils.d.ts +5 -0
- package/dist/src/project-graph/file-map-utils.js +10 -1
- package/dist/src/project-graph/plugins/get-plugins.d.ts +7 -2
- package/dist/src/project-graph/plugins/get-plugins.js +8 -5
- package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -0
- package/dist/src/project-graph/plugins/resolve-plugin.d.ts +7 -4
- package/dist/src/project-graph/plugins/resolve-plugin.js +152 -33
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +4 -2
- package/dist/src/project-graph/plugins/transpiler.d.ts +12 -0
- package/dist/src/project-graph/plugins/transpiler.js +37 -0
- package/dist/src/project-graph/plugins/utils.js +13 -7
- package/dist/src/project-graph/project-graph.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +95 -4
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +515 -68
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +13 -5
- package/dist/src/project-graph/utils/project-configuration-utils.js +14 -6
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +1 -1
- package/dist/src/tasks-runner/create-task-graph.d.ts +4 -4
- package/dist/src/tasks-runner/create-task-graph.js +1 -1
- package/dist/src/tasks-runner/default-tasks-runner.d.ts +0 -2
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +11 -6
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -15
- package/dist/src/tasks-runner/init-tasks-runner.js +0 -63
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -8
- package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +6 -6
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -2
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -5
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +11 -2
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +8 -11
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
- package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -5
- package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -7
- package/dist/src/tasks-runner/task-env.d.ts +1 -1
- package/dist/src/tasks-runner/task-env.js +6 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +11 -1
- package/dist/src/tasks-runner/task-orchestrator.js +112 -38
- package/dist/src/tasks-runner/tasks-schedule.js +3 -3
- package/dist/src/tasks-runner/utils.d.ts +7 -8
- package/dist/src/tasks-runner/utils.js +23 -27
- package/dist/src/utils/child-process.js +2 -2
- package/dist/src/utils/compile-cache.d.ts +24 -0
- package/dist/src/utils/compile-cache.js +49 -0
- package/dist/src/utils/enable-compile-cache.d.ts +1 -0
- package/dist/src/utils/enable-compile-cache.js +7 -0
- package/dist/src/utils/fileutils.d.ts +0 -8
- package/dist/src/utils/fileutils.js +0 -40
- package/dist/src/utils/git-utils.d.ts +15 -0
- package/dist/src/utils/git-utils.js +138 -0
- package/dist/src/utils/handle-import.d.ts +4 -1
- package/dist/src/utils/handle-import.js +56 -2
- package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
- package/dist/src/utils/has-nx-js-plugin.js +24 -0
- package/dist/src/utils/installed-nx-version.d.ts +14 -4
- package/dist/src/utils/installed-nx-version.js +54 -7
- package/dist/src/utils/logger.d.ts +12 -1
- package/dist/src/utils/logger.js +57 -36
- package/dist/src/utils/nx-key.d.ts +0 -1
- package/dist/src/utils/nx-key.js +20 -23
- package/dist/src/utils/nx-package-group.d.ts +8 -0
- package/dist/src/utils/nx-package-group.js +15 -0
- package/dist/src/utils/output.d.ts +3 -2
- package/dist/src/utils/output.js +29 -28
- package/dist/src/utils/package-json.d.ts +14 -1
- package/dist/src/utils/package-json.js +20 -21
- package/dist/src/utils/perf-logging.js +3 -1
- package/dist/src/utils/plugin-cache-utils.d.ts +13 -4
- package/dist/src/utils/plugin-cache-utils.js +23 -13
- package/dist/src/utils/plugins/local-plugins.d.ts +18 -0
- package/dist/src/utils/plugins/local-plugins.js +30 -0
- package/dist/src/utils/tar.d.ts +8 -0
- package/dist/src/utils/tar.js +44 -0
- package/migrations.json +16 -0
- package/package.json +28 -28
- package/schemas/nx-schema.json +114 -80
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -7
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -155
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -16
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -121
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initTasksRunner = void 0;
|
|
4
|
-
var init_tasks_runner_1 = require("./tasks-runner/init-tasks-runner");
|
|
5
|
-
Object.defineProperty(exports, "initTasksRunner", { enumerable: true, get: function () { return init_tasks_runner_1.initTasksRunner; } });
|
|
@@ -18,8 +18,12 @@ async function removeRunCommandsOutputPath(tree) {
|
|
|
18
18
|
}
|
|
19
19
|
if (tree.exists('nx.json')) {
|
|
20
20
|
(0, json_1.updateJson)(tree, 'nx.json', (json) => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const td = json.targetDefaults;
|
|
22
|
+
if (td) {
|
|
23
|
+
const entries = Array.isArray(td) ? td : Object.values(td);
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
updateTargetBlock(entry);
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
return json;
|
|
25
29
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#### Sample Code Changes
|
|
2
|
+
|
|
3
|
+
Add `.nx/cache` to the `.gitignore` file.
|
|
4
|
+
|
|
5
|
+
##### Before
|
|
6
|
+
|
|
7
|
+
```text title=".gitignore"
|
|
8
|
+
node_modules
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
##### After
|
|
12
|
+
|
|
13
|
+
```text title=".gitignore" {2}
|
|
14
|
+
node_modules
|
|
15
|
+
.nx/cache
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Add `.nx/cache` to the `.prettierignore` file.
|
|
19
|
+
|
|
20
|
+
##### Before
|
|
21
|
+
|
|
22
|
+
```ts title=".prettierignore"
|
|
23
|
+
/dist
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
##### After
|
|
27
|
+
|
|
28
|
+
```ts title=".prettierignore" {2}
|
|
29
|
+
/dist
|
|
30
|
+
.nx/cache
|
|
31
|
+
```
|
|
@@ -57,10 +57,26 @@ async function migrate(tree) {
|
|
|
57
57
|
delete options.cacheDirectory;
|
|
58
58
|
}
|
|
59
59
|
if (Array.isArray(options.cacheableOperations)) {
|
|
60
|
-
nxJson.targetDefaults
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
if (Array.isArray(nxJson.targetDefaults)) {
|
|
61
|
+
for (const target of options.cacheableOperations) {
|
|
62
|
+
const idx = nxJson.targetDefaults.findIndex((e) => e.target === target &&
|
|
63
|
+
e.executor === undefined &&
|
|
64
|
+
e.projects === undefined &&
|
|
65
|
+
e.plugin === undefined);
|
|
66
|
+
if (idx >= 0) {
|
|
67
|
+
nxJson.targetDefaults[idx].cache ??= true;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
nxJson.targetDefaults.push({ target, cache: true });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
nxJson.targetDefaults ??= {};
|
|
76
|
+
for (const target of options.cacheableOperations) {
|
|
77
|
+
nxJson.targetDefaults[target] ??= {};
|
|
78
|
+
nxJson.targetDefaults[target].cache ??= true;
|
|
79
|
+
}
|
|
64
80
|
}
|
|
65
81
|
delete options.cacheableOperations;
|
|
66
82
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#### Move useDaemonProcess
|
|
2
|
+
|
|
3
|
+
Move the `useDaemonProcess` to the root of `nx.json`
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
##### Before
|
|
8
|
+
|
|
9
|
+
```json title="nx.json"
|
|
10
|
+
{
|
|
11
|
+
"tasksRunnerOptions": {
|
|
12
|
+
"default": {
|
|
13
|
+
"options": {
|
|
14
|
+
"useDaemonProcess": false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
##### After
|
|
22
|
+
|
|
23
|
+
```json title="nx.json"
|
|
24
|
+
{
|
|
25
|
+
"useDaemonProcess": false
|
|
26
|
+
}
|
|
27
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#### Use Legacy Cache
|
|
2
|
+
|
|
3
|
+
Set `useLegacyCache` to true for migrating workspaces
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
Add `useLegacyCache` to `nx.json` unless `enableDbCache` was set to true.
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```json title="nx.json"
|
|
12
|
+
{
|
|
13
|
+
"targetDefaults": {}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
##### After
|
|
18
|
+
|
|
19
|
+
```json title="nx.json"
|
|
20
|
+
{
|
|
21
|
+
"targetDefaults": {},
|
|
22
|
+
"useLegacyCache": true
|
|
23
|
+
}
|
|
24
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#### Nx Release Changelog Config Changes
|
|
2
|
+
|
|
3
|
+
In Nx v21, the `mapAuthorsToGitHubUsernames` changelog "renderOption" for the default changelog renderer was renamed to `applyUsernameToAuthors` to reflect the fact that it is no longer specific to GitHub. Most people were not setting this option directly, but if you were, it will be automatically migrated by this migration.
|
|
4
|
+
|
|
5
|
+
The migration will also update release groups changelog configuration, if applicable.
|
|
6
|
+
|
|
7
|
+
#### Sample Code Changes
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```json title="nx.json"
|
|
12
|
+
{
|
|
13
|
+
"release": {
|
|
14
|
+
"changelog": {
|
|
15
|
+
"workspaceChangelog": {
|
|
16
|
+
"renderOptions": {
|
|
17
|
+
"mapAuthorsToGitHubUsernames": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"projectChangelogs": {
|
|
21
|
+
"renderOptions": {
|
|
22
|
+
"mapAuthorsToGitHubUsernames": false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
##### After
|
|
31
|
+
|
|
32
|
+
```json title="nx.json"
|
|
33
|
+
{
|
|
34
|
+
"release": {
|
|
35
|
+
"changelog": {
|
|
36
|
+
"workspaceChangelog": {
|
|
37
|
+
"renderOptions": {
|
|
38
|
+
"applyUsernameToAuthors": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"projectChangelogs": {
|
|
42
|
+
"renderOptions": {
|
|
43
|
+
"applyUsernameToAuthors": false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#### Nx Release Version Config Changes
|
|
2
|
+
|
|
3
|
+
In Nx v21, the implementation details of versioning were rewritten to massively enhance flexibility and lay the groundwork for future features.
|
|
4
|
+
|
|
5
|
+
As part of this, some elements of the release configuration were updated. During the lifecycle of Nx v21, you can still opt into the old versioning by setting `release.version.useLegacyVersioning` to `true`, in which case the release configuration should remain unchanged.
|
|
6
|
+
|
|
7
|
+
In Nx v22, the legacy versioning implementation will be removed entirely and the configuration will have to be updated to match what this migration does for you.
|
|
8
|
+
|
|
9
|
+
#### Sample Code Changes
|
|
10
|
+
|
|
11
|
+
"generatorOptions" is longer exists and most non-ecosystem specific options have moved to the top level of "version" and are therefore fully documented on the JSON schema as a core option.
|
|
12
|
+
|
|
13
|
+
"packageRoot: string" has been replaced by the more flexible concept of "manifestRootsToUpdate: string[]", allowing for multiple manifest files (such as `package.json` in the JS/TS ecosystem)
|
|
14
|
+
to be updated in a single versioning run.
|
|
15
|
+
|
|
16
|
+
Ecosystem specific options, such as "skipLockFileUpdate", which is specific to the JS/TS ecosystem, are available via the new "versionActionsOptions" object, which is so named because of the new `VersionActions` abstraction introduced in Nx v21,
|
|
17
|
+
which allows for different ecosystems and use-cases to be supported via very minimal implementation effort.
|
|
18
|
+
|
|
19
|
+
"preserveLocalDependencyProtocols" changed from `false` by default to `true` by default in Nx v21, so it can simply be removed from the configuration when set to true.
|
|
20
|
+
|
|
21
|
+
The migration will also update release groups version configuration, as well as project.json and package.json version configuration, if applicable.
|
|
22
|
+
|
|
23
|
+
##### Before
|
|
24
|
+
|
|
25
|
+
```json title="nx.json"
|
|
26
|
+
{
|
|
27
|
+
"release": {
|
|
28
|
+
"version": {
|
|
29
|
+
"generatorOptions": {
|
|
30
|
+
"packageRoot": "build/packages/{projectName}",
|
|
31
|
+
"currentVersionResolver": "registry",
|
|
32
|
+
"skipLockFileUpdate": true,
|
|
33
|
+
"preserveLocalDependencyProtocols": true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
##### After
|
|
41
|
+
|
|
42
|
+
```json title="nx.json"
|
|
43
|
+
{
|
|
44
|
+
"release": {
|
|
45
|
+
"version": {
|
|
46
|
+
"manifestRootsToUpdate": ["build/packages/{projectName}"],
|
|
47
|
+
"currentVersionResolver": "registry",
|
|
48
|
+
"versionActionsOptions": {
|
|
49
|
+
"skipLockFileUpdate": true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#### Remove Custom Tasks Runners
|
|
2
|
+
|
|
3
|
+
Removes `tasksRunnerOptions` entries from `nx.json` that contain custom tasks runners. In Nx 21, custom tasks runners are no longer functional. See /deprecated/custom-tasks-runner for more information.
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
Removes custom task runner configuration from `nx.json`.
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```json title="nx.json"
|
|
12
|
+
{
|
|
13
|
+
"targetDefaults": {},
|
|
14
|
+
"tasksRunnerOptions": {
|
|
15
|
+
"default": {
|
|
16
|
+
"runner": "custom-task-runner"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
##### After
|
|
23
|
+
|
|
24
|
+
```json title="nx.json"
|
|
25
|
+
{
|
|
26
|
+
"targetDefaults": {}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#### Use Legacy Cache
|
|
2
|
+
|
|
3
|
+
Removes `useLegacyCache` from `nx.json` as it is no longer functional in Nx 21
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
##### Before
|
|
8
|
+
|
|
9
|
+
```json title="nx.json"
|
|
10
|
+
{
|
|
11
|
+
"targetDefaults": {},
|
|
12
|
+
"useLegacyCache": true
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
##### After
|
|
17
|
+
|
|
18
|
+
```json title="nx.json"
|
|
19
|
+
{
|
|
20
|
+
"targetDefaults": {}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#### Add Self-Healing Directory to Git Ignore
|
|
2
|
+
|
|
3
|
+
Add gitignore entry for the `.nx/self-healing` directory, which stores local fix context generated by Nx's self-healing CI feature.
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
Adds the following entry to the `.gitignore` file.
|
|
8
|
+
|
|
9
|
+
```text title=".gitignore"
|
|
10
|
+
.nx/self-healing
|
|
11
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = addMigrateRunsToGitIgnore;
|
|
4
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
5
|
+
const ignore_1 = require("../../utils/ignore");
|
|
6
|
+
async function addMigrateRunsToGitIgnore(tree) {
|
|
7
|
+
if (!tree.exists('.gitignore')) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
// Lerna users that don't use nx.json may not expect .nx directory changes
|
|
11
|
+
if (tree.exists('lerna.json') && !tree.exists('nx.json')) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
(0, ignore_1.addEntryToGitIgnore)(tree, '.gitignore', '.nx/migrate-runs');
|
|
15
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Tree } from '../../generators/tree';
|
|
2
|
+
/**
|
|
3
|
+
* The deprecated releaseTag* flat properties were removed in Nx 23. Re-run the
|
|
4
|
+
* v22 consolidation for any workspaces that still have the legacy keys (e.g.,
|
|
5
|
+
* configs added manually after the v22 migration ran). Runs automatically as
|
|
6
|
+
* part of `nx migrate` and is also triggered by `nx repair` when the runtime
|
|
7
|
+
* detects legacy keys still present in `nx.json`.
|
|
8
|
+
*/
|
|
9
|
+
export default function (tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const consolidate_release_tag_config_1 = tslib_1.__importDefault(require("../update-22-0-0/consolidate-release-tag-config"));
|
|
6
|
+
/**
|
|
7
|
+
* The deprecated releaseTag* flat properties were removed in Nx 23. Re-run the
|
|
8
|
+
* v22 consolidation for any workspaces that still have the legacy keys (e.g.,
|
|
9
|
+
* configs added manually after the v22 migration ran). Runs automatically as
|
|
10
|
+
* part of `nx migrate` and is also triggered by `nx repair` when the runtime
|
|
11
|
+
* detects legacy keys still present in `nx.json`.
|
|
12
|
+
*/
|
|
13
|
+
// TODO(v24): remove this migration (along with its registration in
|
|
14
|
+
// migrations.json) and the LEGACY_RELEASE_TAG_PATTERN_PROPERTIES_DETECTED
|
|
15
|
+
// runtime error path in packages/nx/src/command-line/release/config/config.ts.
|
|
16
|
+
async function default_1(tree) {
|
|
17
|
+
return (0, consolidate_release_tag_config_1.default)(tree);
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Tree } from '../../generators/tree';
|
|
2
|
+
import type { TargetDefaultEntry, TargetDefaultsRecord } from '../../config/nx-json';
|
|
3
|
+
import type { ProjectGraph } from '../../config/project-graph';
|
|
4
|
+
/**
|
|
5
|
+
* Converts the legacy record-shape `targetDefaults` in nx.json to the new
|
|
6
|
+
* array shape introduced in Nx 23. No-op when `targetDefaults` is absent
|
|
7
|
+
* or already an array.
|
|
8
|
+
*
|
|
9
|
+
* This is a pure shape conversion: every legacy key produces at least one
|
|
10
|
+
* array entry, nothing is ever dropped. A key that looks unused at
|
|
11
|
+
* migration time may still be a live default — the target can be added
|
|
12
|
+
* later, and the project graph at migration time can be incomplete.
|
|
13
|
+
*
|
|
14
|
+
* A project graph is built internally (and only when needed) to
|
|
15
|
+
* disambiguate `:`-style keys; see {@link convertTargetDefaultsRecordToArray}.
|
|
16
|
+
*/
|
|
17
|
+
export default function convertTargetDefaultsToArray(tree: Tree): Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Pure conversion from the legacy record shape to the array shape.
|
|
20
|
+
*
|
|
21
|
+
* Kept separate from the migration entry point — and accepting the graph
|
|
22
|
+
* as an explicit argument — so the disambiguation logic can be unit tested
|
|
23
|
+
* directly with synthetic graphs. The migration runner never hands a
|
|
24
|
+
* migration a project graph, so this seam is what keeps that behaviour
|
|
25
|
+
* testable without standing up a real workspace.
|
|
26
|
+
*
|
|
27
|
+
* Disambiguation per key:
|
|
28
|
+
* - A glob, or a plain key with no `:`, is unambiguously a target name.
|
|
29
|
+
* - A `:` key is ambiguous (target name vs `pkg:executor` id). When the
|
|
30
|
+
* graph shows it used as a target name, an executor, or both, the
|
|
31
|
+
* matching entry/entries are emitted. With no graph signal, it falls
|
|
32
|
+
* back to the syntactic heuristic (`:` → executor). Either way an entry
|
|
33
|
+
* is always emitted.
|
|
34
|
+
*/
|
|
35
|
+
export declare function convertTargetDefaultsRecordToArray(legacy: TargetDefaultsRecord, graph?: ProjectGraph): TargetDefaultEntry[];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = convertTargetDefaultsToArray;
|
|
4
|
+
exports.convertTargetDefaultsRecordToArray = convertTargetDefaultsRecordToArray;
|
|
5
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
6
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
7
|
+
const project_graph_1 = require("../../project-graph/project-graph");
|
|
8
|
+
const globs_1 = require("../../utils/globs");
|
|
9
|
+
/**
|
|
10
|
+
* Converts the legacy record-shape `targetDefaults` in nx.json to the new
|
|
11
|
+
* array shape introduced in Nx 23. No-op when `targetDefaults` is absent
|
|
12
|
+
* or already an array.
|
|
13
|
+
*
|
|
14
|
+
* This is a pure shape conversion: every legacy key produces at least one
|
|
15
|
+
* array entry, nothing is ever dropped. A key that looks unused at
|
|
16
|
+
* migration time may still be a live default — the target can be added
|
|
17
|
+
* later, and the project graph at migration time can be incomplete.
|
|
18
|
+
*
|
|
19
|
+
* A project graph is built internally (and only when needed) to
|
|
20
|
+
* disambiguate `:`-style keys; see {@link convertTargetDefaultsRecordToArray}.
|
|
21
|
+
*/
|
|
22
|
+
async function convertTargetDefaultsToArray(tree) {
|
|
23
|
+
if (!tree.exists('nx.json')) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
|
27
|
+
if (!nxJson)
|
|
28
|
+
return [];
|
|
29
|
+
const { targetDefaults } = nxJson;
|
|
30
|
+
if (!targetDefaults)
|
|
31
|
+
return [];
|
|
32
|
+
if (Array.isArray(targetDefaults))
|
|
33
|
+
return [];
|
|
34
|
+
const legacy = targetDefaults;
|
|
35
|
+
const nextSteps = [];
|
|
36
|
+
// The graph is only consulted to disambiguate `:`-style keys (target name
|
|
37
|
+
// vs `pkg:executor` id). Skip building it entirely when there are none.
|
|
38
|
+
const graph = Object.keys(legacy).some(isExecutorAmbiguousKey)
|
|
39
|
+
? await tryCreateProjectGraph(nextSteps)
|
|
40
|
+
: undefined;
|
|
41
|
+
nxJson.targetDefaults = convertTargetDefaultsRecordToArray(legacy, graph);
|
|
42
|
+
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
|
43
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
|
44
|
+
return nextSteps;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pure conversion from the legacy record shape to the array shape.
|
|
48
|
+
*
|
|
49
|
+
* Kept separate from the migration entry point — and accepting the graph
|
|
50
|
+
* as an explicit argument — so the disambiguation logic can be unit tested
|
|
51
|
+
* directly with synthetic graphs. The migration runner never hands a
|
|
52
|
+
* migration a project graph, so this seam is what keeps that behaviour
|
|
53
|
+
* testable without standing up a real workspace.
|
|
54
|
+
*
|
|
55
|
+
* Disambiguation per key:
|
|
56
|
+
* - A glob, or a plain key with no `:`, is unambiguously a target name.
|
|
57
|
+
* - A `:` key is ambiguous (target name vs `pkg:executor` id). When the
|
|
58
|
+
* graph shows it used as a target name, an executor, or both, the
|
|
59
|
+
* matching entry/entries are emitted. With no graph signal, it falls
|
|
60
|
+
* back to the syntactic heuristic (`:` → executor). Either way an entry
|
|
61
|
+
* is always emitted.
|
|
62
|
+
*/
|
|
63
|
+
function convertTargetDefaultsRecordToArray(legacy, graph) {
|
|
64
|
+
const entries = [];
|
|
65
|
+
for (const key of Object.keys(legacy)) {
|
|
66
|
+
const value = legacy[key] ?? {};
|
|
67
|
+
entries.push(...legacyKeyToEntries(key, value, graph));
|
|
68
|
+
}
|
|
69
|
+
return entries;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A legacy record key is ambiguous between a target name and an executor
|
|
73
|
+
* id only when it contains `:` and is not a glob (executor ids are
|
|
74
|
+
* `pkg:name`; globs would also contain `*` / `{` / etc., which
|
|
75
|
+
* `isGlobPattern` catches). These are the only keys the graph helps with.
|
|
76
|
+
*/
|
|
77
|
+
function isExecutorAmbiguousKey(key) {
|
|
78
|
+
return key.includes(':') && !(0, globs_1.isGlobPattern)(key);
|
|
79
|
+
}
|
|
80
|
+
function legacyKeyToEntries(key, value, graph) {
|
|
81
|
+
// Globs and plain (no `:`) keys are unambiguously target names.
|
|
82
|
+
if (!isExecutorAmbiguousKey(key)) {
|
|
83
|
+
return [{ target: key, ...value }];
|
|
84
|
+
}
|
|
85
|
+
// A `:` key could be a target name or a `pkg:executor` id. Use the graph
|
|
86
|
+
// to disambiguate when it has something to say.
|
|
87
|
+
if (graph) {
|
|
88
|
+
const { matchesTargetName, matchesExecutor } = classifyKeyAgainstGraph(key, graph);
|
|
89
|
+
if (matchesTargetName && matchesExecutor) {
|
|
90
|
+
return [
|
|
91
|
+
{ target: key, ...value },
|
|
92
|
+
{ executor: key, ...value },
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
if (matchesTargetName)
|
|
96
|
+
return [{ target: key, ...value }];
|
|
97
|
+
if (matchesExecutor)
|
|
98
|
+
return [{ executor: key, ...value }];
|
|
99
|
+
// Graph had no signal for this key — fall through to the syntactic
|
|
100
|
+
// heuristic rather than dropping the entry.
|
|
101
|
+
}
|
|
102
|
+
// Syntactic fallback: a `:` key that is not a glob is an executor id.
|
|
103
|
+
return [{ executor: key, ...value }];
|
|
104
|
+
}
|
|
105
|
+
function classifyKeyAgainstGraph(key, graph) {
|
|
106
|
+
let matchesTargetName = false;
|
|
107
|
+
let matchesExecutor = false;
|
|
108
|
+
for (const node of Object.values(graph.nodes ?? {})) {
|
|
109
|
+
const targets = node?.data?.targets;
|
|
110
|
+
if (!targets)
|
|
111
|
+
continue;
|
|
112
|
+
for (const [name, target] of Object.entries(targets)) {
|
|
113
|
+
if (!matchesTargetName && name === key)
|
|
114
|
+
matchesTargetName = true;
|
|
115
|
+
if (!matchesExecutor && target?.executor === key)
|
|
116
|
+
matchesExecutor = true;
|
|
117
|
+
if (matchesTargetName && matchesExecutor) {
|
|
118
|
+
return { matchesTargetName, matchesExecutor };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return { matchesTargetName, matchesExecutor };
|
|
123
|
+
}
|
|
124
|
+
async function tryCreateProjectGraph(nextSteps) {
|
|
125
|
+
// Build fresh — earlier migrations in this run may have mutated files
|
|
126
|
+
// the cached graph was computed from, so a cache hit could classify
|
|
127
|
+
// record keys against a stale workspace.
|
|
128
|
+
try {
|
|
129
|
+
return await (0, project_graph_1.createProjectGraphAsync)();
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
nextSteps.push('convert-target-defaults-to-array: project graph could not be built; ' +
|
|
133
|
+
'falling back to syntactic disambiguation for `:` keys in nx.json `targetDefaults`. ' +
|
|
134
|
+
'If a key happens to match both a target name and an executor in your workspace, ' +
|
|
135
|
+
'review the migration result and add the missing entry by hand. ' +
|
|
136
|
+
`Underlying error: ${err instanceof Error ? err.message : String(err)}`);
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#### Convert `targetDefaults` to Array Shape
|
|
2
|
+
|
|
3
|
+
In Nx v23, the `targetDefaults` entry in `nx.json` moves from the legacy record (object-keyed) shape to a new array shape. The array shape lets a single default match by `target`, `executor`, `plugin`, or `projects` — combinations that the record key could not express on its own.
|
|
4
|
+
|
|
5
|
+
This migration is a pure shape conversion: every legacy key produces at least one array entry, and nothing is ever dropped. The order of entries in the resulting array matches the insertion order of the original record keys.
|
|
6
|
+
|
|
7
|
+
#### Key Disambiguation
|
|
8
|
+
|
|
9
|
+
The legacy record key could mean either a target name (`build`) or a `pkg:executor` id (`@nx/vite:build`). The new array shape requires that distinction up front, so the migration disambiguates each key as follows:
|
|
10
|
+
|
|
11
|
+
- A glob pattern (e.g. `e2e-ci--*`) or a plain key without `:` is always treated as a `target` name.
|
|
12
|
+
- A `:` key is ambiguous. The migration builds the project graph and emits:
|
|
13
|
+
- `{ target: <key> }` if the key matches only a target name in the graph,
|
|
14
|
+
- `{ executor: <key> }` if it matches only an executor,
|
|
15
|
+
- **both** entries if it matches both (the graph cannot tell you which one you meant — keeping both preserves behavior).
|
|
16
|
+
- If the project graph cannot be built, or has no signal for a `:` key, the migration falls back to the syntactic heuristic: `:` keys become `executor` entries. A note is added to the migration's next steps so you can review.
|
|
17
|
+
|
|
18
|
+
#### Sample Code Changes
|
|
19
|
+
|
|
20
|
+
##### Before
|
|
21
|
+
|
|
22
|
+
```json title="nx.json"
|
|
23
|
+
{
|
|
24
|
+
"targetDefaults": {
|
|
25
|
+
"build": {
|
|
26
|
+
"cache": true,
|
|
27
|
+
"dependsOn": ["^build"]
|
|
28
|
+
},
|
|
29
|
+
"test": {
|
|
30
|
+
"inputs": ["default", "^production"]
|
|
31
|
+
},
|
|
32
|
+
"e2e-ci--*": {
|
|
33
|
+
"dependsOn": ["^build"]
|
|
34
|
+
},
|
|
35
|
+
"@nx/vite:build": {
|
|
36
|
+
"cache": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
##### After
|
|
43
|
+
|
|
44
|
+
```json title="nx.json"
|
|
45
|
+
{
|
|
46
|
+
"targetDefaults": [
|
|
47
|
+
{
|
|
48
|
+
"target": "build",
|
|
49
|
+
"cache": true,
|
|
50
|
+
"dependsOn": ["^build"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"target": "test",
|
|
54
|
+
"inputs": ["default", "^production"]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"target": "e2e-ci--*",
|
|
58
|
+
"dependsOn": ["^build"]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"executor": "@nx/vite:build",
|
|
62
|
+
"cache": true
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|