nx 21.0.0-beta.1 → 21.0.0-beta.2
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/.eslintrc.json +5 -1
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +186 -35
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +47 -35
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +4 -1
- package/src/command-line/init/implementation/utils.js +108 -44
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +68 -38
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.js +18 -15
- package/src/command-line/release/command-object.d.ts +2 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +129 -42
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/index.d.ts +4 -0
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +251 -0
- package/src/command-line/release/version/release-group-processor.js +1040 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +95 -0
- package/src/command-line/release/version/test-utils.js +416 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +170 -0
- package/src/command-line/release/version/version-actions.js +183 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +80 -262
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/run.js +1 -1
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/config/nx-json.d.ts +153 -15
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.js +15 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-internals.d.ts +2 -1
- package/src/devkit-internals.js +4 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +3 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +7 -5
- package/src/executors/run-commands/running-tasks.js +64 -27
- package/src/executors/run-script/run-script.impl.js +3 -3
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/native/index.d.ts +93 -19
- package/src/native/native-bindings.js +6 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +2 -1
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.js +3 -1
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +25 -11
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +2 -3
- package/src/tasks-runner/cache.d.ts +20 -6
- package/src/tasks-runner/cache.js +104 -20
- package/src/tasks-runner/create-task-graph.d.ts +1 -1
- package/src/tasks-runner/create-task-graph.js +12 -11
- package/src/tasks-runner/default-tasks-runner.js +4 -13
- package/src/tasks-runner/forked-process-task-runner.d.ts +6 -3
- package/src/tasks-runner/forked-process-task-runner.js +29 -28
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +55 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +58 -0
- package/src/tasks-runner/life-cycle.d.ts +10 -3
- package/src/tasks-runner/life-cycle.js +23 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +7 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +6 -1
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +17 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +221 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
- package/src/tasks-runner/pseudo-terminal.js +37 -35
- package/src/tasks-runner/run-command.d.ts +1 -0
- package/src/tasks-runner/run-command.js +180 -23
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-orchestrator.d.ts +21 -9
- package/src/tasks-runner/task-orchestrator.js +126 -44
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +15 -11
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/handle-errors.js +15 -0
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
package/.eslintrc.json
CHANGED
@@ -131,8 +131,12 @@
|
|
131
131
|
"@nx/nx-win32-arm64-msvc",
|
132
132
|
"@nx/nx-freebsd-x64",
|
133
133
|
"@nx/powerpack-license",
|
134
|
+
"@nx/key",
|
134
135
|
// Powerpack plugin conditionally available dynamically at runtime
|
135
|
-
"@nx/powerpack-conformance"
|
136
|
+
"@nx/powerpack-conformance",
|
137
|
+
"@nx/conformance",
|
138
|
+
// Only used in test-utils at the time of writing
|
139
|
+
"@ltd/j-toml"
|
136
140
|
]
|
137
141
|
}
|
138
142
|
]
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.0.0-beta.
|
3
|
+
"version": "21.0.0-beta.2",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"@yarnpkg/lockfile": "^1.1.0",
|
39
39
|
"@yarnpkg/parsers": "3.0.2",
|
40
40
|
"@zkochan/js-yaml": "0.0.7",
|
41
|
-
"axios": "^1.
|
41
|
+
"axios": "^1.8.3",
|
42
42
|
"chalk": "^4.1.0",
|
43
43
|
"cli-cursor": "3.1.0",
|
44
44
|
"cli-spinners": "2.6.1",
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-arm64": "21.0.0-beta.
|
87
|
-
"@nx/nx-darwin-x64": "21.0.0-beta.
|
88
|
-
"@nx/nx-freebsd-x64": "21.0.0-beta.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.0.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.0.0-beta.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.0.0-beta.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.0.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.0.0-beta.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.0.0-beta.
|
86
|
+
"@nx/nx-darwin-arm64": "21.0.0-beta.2",
|
87
|
+
"@nx/nx-darwin-x64": "21.0.0-beta.2",
|
88
|
+
"@nx/nx-freebsd-x64": "21.0.0-beta.2",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.0.0-beta.2",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.0.0-beta.2",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.0.0-beta.2",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.0.0-beta.2",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.0.0-beta.2",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.0.0-beta.2",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.0.0-beta.2"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
package/release/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
2
|
* @public Programmatic API for nx release
|
3
3
|
*/
|
4
|
-
export { ReleaseClient, release, releaseChangelog, releasePublish, releaseVersion, } from '../src/command-line/release';
|
4
|
+
export { ReleaseClient, release, releaseChangelog, releasePublish, releaseVersion, VersionActions, AfterAllProjectsVersioned, } from '../src/command-line/release';
|
package/release/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.releaseVersion = exports.releasePublish = exports.releaseChangelog = exports.release = exports.ReleaseClient = void 0;
|
3
|
+
exports.VersionActions = exports.releaseVersion = exports.releasePublish = exports.releaseChangelog = exports.release = exports.ReleaseClient = void 0;
|
4
4
|
/**
|
5
5
|
* @public Programmatic API for nx release
|
6
6
|
*/
|
@@ -10,3 +10,4 @@ Object.defineProperty(exports, "release", { enumerable: true, get: function () {
|
|
10
10
|
Object.defineProperty(exports, "releaseChangelog", { enumerable: true, get: function () { return release_1.releaseChangelog; } });
|
11
11
|
Object.defineProperty(exports, "releasePublish", { enumerable: true, get: function () { return release_1.releasePublish; } });
|
12
12
|
Object.defineProperty(exports, "releaseVersion", { enumerable: true, get: function () { return release_1.releaseVersion; } });
|
13
|
+
Object.defineProperty(exports, "VersionActions", { enumerable: true, get: function () { return release_1.VersionActions; } });
|
package/schemas/nx-schema.json
CHANGED
@@ -21,6 +21,10 @@
|
|
21
21
|
"additionalProperties": false,
|
22
22
|
"deprecated": "Use `defaultBase` instead. Support for setting `defaultBase` in `affected` will be removed in Nx 20."
|
23
23
|
},
|
24
|
+
"extends": {
|
25
|
+
"type": "string",
|
26
|
+
"description": "Specifies the base config to extend."
|
27
|
+
},
|
24
28
|
"defaultBase": {
|
25
29
|
"type": "string",
|
26
30
|
"description": "Default --base used by affected logic."
|
@@ -73,6 +77,23 @@
|
|
73
77
|
"$ref": "#/definitions/plugins"
|
74
78
|
}
|
75
79
|
},
|
80
|
+
"tui": {
|
81
|
+
"type": "object",
|
82
|
+
"description": "Settings for the Nx Terminal User Interface (TUI)",
|
83
|
+
"properties": {
|
84
|
+
"enabled": {
|
85
|
+
"type": "boolean",
|
86
|
+
"description": "Whether to enable the Terminal UI whenever possible (based on the current environment and terminal).",
|
87
|
+
"default": true
|
88
|
+
},
|
89
|
+
"autoExit": {
|
90
|
+
"oneOf": [{ "type": "boolean" }, { "type": "number" }],
|
91
|
+
"description": "Whether to exit the TUI automatically after all tasks finish. If set to `true`, the TUI will exit immediately. If set to `false` the TUI will not automatically exit. If set to a number, an interruptible countdown popup will be shown for that many seconds before the TUI exits.",
|
92
|
+
"default": 3
|
93
|
+
}
|
94
|
+
},
|
95
|
+
"additionalProperties": false
|
96
|
+
},
|
76
97
|
"defaultProject": {
|
77
98
|
"type": "string",
|
78
99
|
"description": "Default project. When project isn't provided, the default project will be used."
|
@@ -169,7 +190,22 @@
|
|
169
190
|
]
|
170
191
|
},
|
171
192
|
"releaseTagPattern": {
|
172
|
-
"type": "string"
|
193
|
+
"type": "string",
|
194
|
+
"description": "Optionally override the git/release tag pattern to use for this group."
|
195
|
+
},
|
196
|
+
"releaseTagPatternCheckAllBranchesWhen": {
|
197
|
+
"oneOf": [
|
198
|
+
{
|
199
|
+
"type": "boolean"
|
200
|
+
},
|
201
|
+
{
|
202
|
+
"type": "array",
|
203
|
+
"items": {
|
204
|
+
"type": "string"
|
205
|
+
}
|
206
|
+
}
|
207
|
+
],
|
208
|
+
"description": "By default, we will try and resolve the latest match for the releaseTagPattern from the current branch, falling back to all branches if no match is found on the current branch. Setting this to true will cause us to ALWAYS check all branches for the latest match. Setting it to false will cause us to ONLY check the current branch for the latest match. Setting it to an array of strings will cause us to check all branches WHEN the current branch is one of the strings in the array. Glob patterns are supported."
|
173
209
|
},
|
174
210
|
"versionPlans": {
|
175
211
|
"oneOf": [
|
@@ -243,7 +279,22 @@
|
|
243
279
|
]
|
244
280
|
},
|
245
281
|
"releaseTagPattern": {
|
246
|
-
"type": "string"
|
282
|
+
"type": "string",
|
283
|
+
"description": "Optionally override the git/release tag pattern to use. This field is the source of truth for changelog generation and release tagging, as well as for conventional commits parsing. It supports interpolating the version as {version} and (if releasing independently or forcing project level version control system releases) the project name as {projectName} within the string. The default releaseTagPattern for fixed/unified releases is: \"v{version}\". The default releaseTagPattern for independent releases at the project level is: \"{projectName}@{version}\""
|
284
|
+
},
|
285
|
+
"releaseTagPatternCheckAllBranchesWhen": {
|
286
|
+
"oneOf": [
|
287
|
+
{
|
288
|
+
"type": "boolean"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
"type": "array",
|
292
|
+
"items": {
|
293
|
+
"type": "string"
|
294
|
+
}
|
295
|
+
}
|
296
|
+
],
|
297
|
+
"description": "By default, we will try and resolve the latest match for the releaseTagPattern from the current branch, falling back to all branches if no match is found on the current branch. Setting this to true will cause us to ALWAYS check all branches for the latest match. Setting it to false will cause us to ONLY check the current branch for the latest match. Setting it to an array of strings will cause us to check all branches WHEN the current branch is one of the strings in the array. Glob patterns are supported."
|
247
298
|
}
|
248
299
|
}
|
249
300
|
},
|
@@ -650,50 +701,150 @@
|
|
650
701
|
},
|
651
702
|
"NxReleaseVersionConfiguration": {
|
652
703
|
"type": "object",
|
653
|
-
"
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
},
|
662
|
-
"generatorOptions": {
|
663
|
-
"type": "object",
|
664
|
-
"additionalProperties": true
|
665
|
-
},
|
666
|
-
"git": {
|
667
|
-
"$ref": "#/definitions/NxReleaseGitConfiguration"
|
668
|
-
},
|
669
|
-
"preVersionCommand": {
|
670
|
-
"type": "string",
|
671
|
-
"description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
704
|
+
"$comment": "The configuration for versioning is dynamic depending on the value of the useLegacyVersioning property. Through trial and error the best in editor DX seems to come from having the if/else at the top level and explicitly include all possible properties and apply additionalProperties false in each case.",
|
705
|
+
"description": "Configuration for the versioning phase of releases.",
|
706
|
+
"if": {
|
707
|
+
"$comment": "When using the latest versioning implementation a lot of configuration has been able to move directly onto the version property.",
|
708
|
+
"properties": {
|
709
|
+
"useLegacyVersioning": {
|
710
|
+
"const": true
|
711
|
+
}
|
672
712
|
}
|
673
713
|
},
|
674
|
-
"
|
714
|
+
"then": {
|
715
|
+
"properties": {
|
716
|
+
"useLegacyVersioning": {
|
717
|
+
"type": "boolean",
|
718
|
+
"description": "Whether to use the legacy versioning strategy. This value will be true in Nx v20 and false in Nx v21. The legacy versioning implementation will be removed in Nx v22, as will this flag.",
|
719
|
+
"default": true
|
720
|
+
},
|
721
|
+
"conventionalCommits": {
|
722
|
+
"type": "boolean",
|
723
|
+
"description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
|
724
|
+
"default": false
|
725
|
+
},
|
726
|
+
"git": {
|
727
|
+
"$ref": "#/definitions/NxReleaseGitConfiguration"
|
728
|
+
},
|
729
|
+
"preVersionCommand": {
|
730
|
+
"type": "string",
|
731
|
+
"description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
732
|
+
},
|
733
|
+
"generator": {
|
734
|
+
"type": "string",
|
735
|
+
"description": "The generator implementation to use for versioning.",
|
736
|
+
"default": "@nx/js:release-version"
|
737
|
+
},
|
738
|
+
"generatorOptions": {
|
739
|
+
"type": "object",
|
740
|
+
"description": "These options will be passed to the configured \"release.version.generator\" (which will be \"@nx/js:release-version\" if not set explicitly).",
|
741
|
+
"additionalProperties": true
|
742
|
+
}
|
743
|
+
},
|
744
|
+
"additionalProperties": false
|
745
|
+
},
|
746
|
+
"else": {
|
747
|
+
"additionalProperties": false,
|
748
|
+
"properties": {
|
749
|
+
"useLegacyVersioning": {
|
750
|
+
"type": "boolean",
|
751
|
+
"description": "Whether to use the legacy versioning strategy. This value will be true in Nx v20 and false in Nx v21. The legacy versioning implementation will be removed in Nx v22, as will this flag.",
|
752
|
+
"default": true
|
753
|
+
},
|
754
|
+
"conventionalCommits": {
|
755
|
+
"type": "boolean",
|
756
|
+
"description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
|
757
|
+
"default": false
|
758
|
+
},
|
759
|
+
"git": {
|
760
|
+
"$ref": "#/definitions/NxReleaseGitConfiguration"
|
761
|
+
},
|
762
|
+
"preVersionCommand": {
|
763
|
+
"type": "string",
|
764
|
+
"description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
765
|
+
},
|
766
|
+
"specifierSource": {
|
767
|
+
"type": "string",
|
768
|
+
"enum": ["prompt", "conventional-commits", "version-plans"],
|
769
|
+
"default": "prompt",
|
770
|
+
"description": "The source to use for determining the specifier to use when versioning. 'prompt' is the default and will interactively prompt the user for an explicit/imperative specifier. 'conventional-commits' will attempt determine a specifier from commit messages conforming to the Conventional Commits specification. 'version-plans' will determine the specifier from the version plan files available on disk."
|
771
|
+
},
|
772
|
+
"manifestRootsToUpdate": {
|
773
|
+
"type": "array",
|
774
|
+
"items": {
|
775
|
+
"type": "string"
|
776
|
+
},
|
777
|
+
"description": "A list of directories containing manifest files (such as package.json) to apply updates to when versioning. By default, only the project root will be used, but you could customize this to only version a manifest in a dist directory, or even version multiple manifests in different directories, such as both source and dist."
|
778
|
+
},
|
779
|
+
"currentVersionResolver": {
|
780
|
+
"type": "string",
|
781
|
+
"enum": ["registry", "disk", "git-tag", "none"],
|
782
|
+
"description": "The resolver to use for determining the current version of a project during versioning. This is needed for versioning approaches which involve relatively modifying a current version to arrive at a new version, such as semver bumps like 'patch', 'minor' etc. Using 'none' explicitly declares that the current version is not needed to compute the new version, and should only be used with appropriate version actions implementations that support it."
|
783
|
+
},
|
784
|
+
"currentVersionResolverMetadata": {
|
785
|
+
"type": "object",
|
786
|
+
"additionalProperties": true,
|
787
|
+
"description": "Metadata to provide to the configured currentVersionResolver to help it in determining the current version. What to pass here is specific to each resolver."
|
788
|
+
},
|
789
|
+
"fallbackCurrentVersionResolver": {
|
790
|
+
"type": "string",
|
791
|
+
"enum": ["disk"],
|
792
|
+
"description": "The fallback version resolver to use when the configured currentVersionResolver fails to resolve the current version."
|
793
|
+
},
|
794
|
+
"firstRelease": {
|
795
|
+
"type": "boolean",
|
796
|
+
"description": "Whether or not this is the first release of one of more projects. This removes certain validation checks that are not possible to enforce if the project has never been released before."
|
797
|
+
},
|
798
|
+
"versionPrefix": {
|
799
|
+
"type": "string",
|
800
|
+
"enum": ["auto", "", "~", "^", "="],
|
801
|
+
"default": "auto",
|
802
|
+
"description": "The prefix to use when versioning dependencies. This can be one of the following: auto, '', '~', '^', '=', where auto means the existing prefix will be preserved."
|
803
|
+
},
|
804
|
+
"deleteVersionPlans": {
|
805
|
+
"type": "boolean",
|
806
|
+
"description": "Whether to delete the processed version plans file after versioning is complete. This is false by default because the version plans are also needed for changelog generation.",
|
807
|
+
"default": false
|
808
|
+
},
|
809
|
+
"updateDependents": {
|
810
|
+
"type": "string",
|
811
|
+
"enum": ["never", "auto"],
|
812
|
+
"default": "auto",
|
813
|
+
"description": "When versioning independent projects, this controls whether to update their dependents (i.e. the things that depend on them). 'never' means no dependents will be updated (unless they happen to be versioned directly as well). 'auto' is the default and will cause dependents to be updated (a patch version bump) when a dependency is versioned."
|
814
|
+
},
|
815
|
+
"logUnchangedProjects": {
|
816
|
+
"type": "boolean",
|
817
|
+
"description": "Whether to log projects that have not changed during versioning.",
|
818
|
+
"default": true
|
819
|
+
},
|
820
|
+
"preserveLocalDependencyProtocols": {
|
821
|
+
"type": "boolean",
|
822
|
+
"description": "Whether to preserve local dependency protocols (e.g. file references, or the `workspace:` protocol in package.json files) of local dependencies when updating them during versioning. This was false by default in legacy versioning, but is true by default now.",
|
823
|
+
"default": true
|
824
|
+
},
|
825
|
+
"versionActions": {
|
826
|
+
"type": "string",
|
827
|
+
"description": "The path to the version actions implementation to use for releasing all projects by default. This can also be overridden on the release group and project levels.",
|
828
|
+
"default": "@nx/js/src/release"
|
829
|
+
},
|
830
|
+
"versionActionsOptions": {
|
831
|
+
"type": "object",
|
832
|
+
"description": "The specific options that are defined by each version actions implementation. They will be passed to the version actions implementation when running a release.",
|
833
|
+
"additionalProperties": true
|
834
|
+
}
|
835
|
+
}
|
836
|
+
}
|
675
837
|
},
|
676
838
|
"NxReleaseGroupVersionConfiguration": {
|
677
839
|
"type": "object",
|
840
|
+
"$comment": "We need to improve this configuration definition to be more precise once legacy versioning is removed. Right now it needs to be left open and runtime validation will ensure correct behavior.",
|
678
841
|
"properties": {
|
679
|
-
"conventionalCommits": {
|
680
|
-
"type": "boolean",
|
681
|
-
"description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
|
682
|
-
"default": false
|
683
|
-
},
|
684
|
-
"generator": {
|
685
|
-
"type": "string"
|
686
|
-
},
|
687
|
-
"generatorOptions": {
|
688
|
-
"type": "object",
|
689
|
-
"additionalProperties": true
|
690
|
-
},
|
691
842
|
"groupPreVersionCommand": {
|
692
843
|
"type": "string",
|
693
844
|
"description": "A command to run after validation of nx release configuration AND after the release.version.preVersionCommand (if any), but before versioning begins for this specific group. Useful for preparing build artifacts for the group. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
694
845
|
}
|
695
846
|
},
|
696
|
-
"additionalProperties":
|
847
|
+
"additionalProperties": true
|
697
848
|
},
|
698
849
|
"NxReleaseChangelogConfiguration": {
|
699
850
|
"type": "object",
|
package/src/adapter/compat.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache"];
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache", "maxCacheSize", "tui"];
|
package/src/adapter/compat.js
CHANGED
@@ -37,6 +37,7 @@ exports.allowedProjectExtensions = [
|
|
37
37
|
// There are some props in here (root) that angular already knows about,
|
38
38
|
// but it doesn't hurt to have them in here as well to help static analysis.
|
39
39
|
exports.allowedWorkspaceExtensions = [
|
40
|
+
'$schema',
|
40
41
|
'implicitDependencies',
|
41
42
|
'affected',
|
42
43
|
'defaultBase',
|
@@ -64,6 +65,8 @@ exports.allowedWorkspaceExtensions = [
|
|
64
65
|
'neverConnectToCloud',
|
65
66
|
'sync',
|
66
67
|
'useLegacyCache',
|
68
|
+
'maxCacheSize',
|
69
|
+
'tui',
|
67
70
|
];
|
68
71
|
if (!patched) {
|
69
72
|
Module.prototype.require = function () {
|
@@ -5,7 +5,6 @@ exports.addHandler = addHandler;
|
|
5
5
|
const child_process_1 = require("child_process");
|
6
6
|
const fs_1 = require("fs");
|
7
7
|
const ora = require("ora");
|
8
|
-
const yargsParser = require("yargs-parser");
|
9
8
|
const nx_json_1 = require("../../config/nx-json");
|
10
9
|
const child_process_2 = require("../../utils/child-process");
|
11
10
|
const fileutils_1 = require("../../utils/fileutils");
|
@@ -79,27 +78,18 @@ async function installPackage(pkgName, version, nxJson) {
|
|
79
78
|
spinner.succeed();
|
80
79
|
}
|
81
80
|
async function initializePlugin(pkgName, options, nxJson) {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
'parse-positional-numbers': false,
|
86
|
-
'dot-notation': false,
|
87
|
-
'camel-case-expansion': false,
|
88
|
-
},
|
89
|
-
});
|
90
|
-
if (exports.coreNxPluginVersions.has(pkgName)) {
|
91
|
-
parsedCommandArgs.keepExistingVersions = true;
|
92
|
-
if (options.updatePackageScripts ||
|
81
|
+
let updatePackageScripts = false;
|
82
|
+
if (exports.coreNxPluginVersions.has(pkgName) &&
|
83
|
+
(options.updatePackageScripts ||
|
93
84
|
(options.updatePackageScripts === undefined &&
|
94
85
|
nxJson.useInferencePlugins !== false &&
|
95
|
-
process.env.NX_ADD_PLUGINS !== 'false')) {
|
96
|
-
|
97
|
-
}
|
86
|
+
process.env.NX_ADD_PLUGINS !== 'false'))) {
|
87
|
+
updatePackageScripts = true;
|
98
88
|
}
|
99
89
|
const spinner = ora(`Initializing ${pkgName}...`);
|
100
90
|
spinner.start();
|
101
91
|
try {
|
102
|
-
await (0, configure_plugins_1.
|
92
|
+
await (0, configure_plugins_1.runPluginInitGenerator)(pkgName, workspace_root_1.workspaceRoot, updatePackageScripts, options.verbose);
|
103
93
|
}
|
104
94
|
catch (e) {
|
105
95
|
spinner.fail();
|
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsAffectedE2ECommand = exports.yargsAffectedLintCommand = exports.yargsAffectedBuildCommand = exports.yargsAffectedTestCommand = exports.yargsAffectedCommand = void 0;
|
4
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
4
5
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
6
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
exports.yargsAffectedCommand = {
|
8
8
|
command: 'affected',
|
9
9
|
describe: 'Run target for affected projects.',
|
10
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs)))))
|
10
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs))))))
|
11
11
|
.option('all', {
|
12
12
|
type: 'boolean',
|
13
13
|
deprecated: 'Use `nx run-many` instead',
|
@@ -27,7 +27,7 @@ exports.yargsAffectedCommand = {
|
|
27
27
|
exports.yargsAffectedTestCommand = {
|
28
28
|
command: 'affected:test',
|
29
29
|
describe: false,
|
30
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
30
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs))))), 'affected'),
|
31
31
|
handler: async (args) => {
|
32
32
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
33
33
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
@@ -41,7 +41,7 @@ exports.yargsAffectedTestCommand = {
|
|
41
41
|
exports.yargsAffectedBuildCommand = {
|
42
42
|
command: 'affected:build',
|
43
43
|
describe: false,
|
44
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
44
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs))))), 'affected'),
|
45
45
|
handler: async (args) => {
|
46
46
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
47
47
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
@@ -55,7 +55,7 @@ exports.yargsAffectedBuildCommand = {
|
|
55
55
|
exports.yargsAffectedLintCommand = {
|
56
56
|
command: 'affected:lint',
|
57
57
|
describe: false,
|
58
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
58
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs))))), 'affected'),
|
59
59
|
handler: async (args) => {
|
60
60
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
61
61
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
@@ -69,7 +69,7 @@ exports.yargsAffectedLintCommand = {
|
|
69
69
|
exports.yargsAffectedE2ECommand = {
|
70
70
|
command: 'affected:e2e',
|
71
71
|
describe: false,
|
72
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
72
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs))))), 'affected'),
|
73
73
|
handler: async (args) => {
|
74
74
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
75
75
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
@@ -143,10 +143,6 @@ exports.examples = {
|
|
143
143
|
command: 'graph --focus=todos-feature-main',
|
144
144
|
description: 'Show the graph where every node is either an ancestor or a descendant of todos-feature-main',
|
145
145
|
},
|
146
|
-
{
|
147
|
-
command: 'graph --include=project-one,project-two',
|
148
|
-
description: 'Include project-one and project-two in the project graph',
|
149
|
-
},
|
150
146
|
{
|
151
147
|
command: 'graph --exclude=project-one,project-two',
|
152
148
|
description: 'Exclude project-one and project-two from the project graph',
|
@@ -5,7 +5,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
|
|
5
5
|
exports.yargsExecCommand = {
|
6
6
|
command: 'exec',
|
7
7
|
describe: 'Executes any command as if it was a target on the project.',
|
8
|
-
builder: (yargs) => (0, shared_options_1.withRunManyOptions)(yargs),
|
8
|
+
builder: (yargs) => (0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunManyOptions)(yargs)),
|
9
9
|
handler: async (args) => {
|
10
10
|
try {
|
11
11
|
await (await Promise.resolve().then(() => require('./exec'))).nxExecCommand((0, shared_options_1.withOverrides)(args));
|
@@ -6,6 +6,7 @@ const path_1 = require("path");
|
|
6
6
|
const schema_utils_1 = require("../../config/schema-utils");
|
7
7
|
const fileutils_1 = require("../../utils/fileutils");
|
8
8
|
const plugins_1 = require("../../project-graph/plugins");
|
9
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
9
10
|
function getGeneratorInformation(collectionName, generatorName, root, projects) {
|
10
11
|
try {
|
11
12
|
const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
|
@@ -37,18 +38,22 @@ function getGeneratorInformation(collectionName, generatorName, root, projects)
|
|
37
38
|
};
|
38
39
|
}
|
39
40
|
catch (e) {
|
40
|
-
throw new Error(`Unable to resolve ${collectionName}:${generatorName}.\n${e.message}`);
|
41
|
+
throw new Error(`Unable to resolve ${collectionName}:${generatorName}.\n${process.env.NX_VERBOSE_LOGGING === 'true' ? e.stack : e.message}`);
|
41
42
|
}
|
42
43
|
}
|
43
44
|
function readGeneratorsJson(collectionName, generator, root, projects) {
|
44
45
|
let generatorsFilePath;
|
45
46
|
if (collectionName.endsWith('.json')) {
|
46
47
|
generatorsFilePath = require.resolve(collectionName, {
|
47
|
-
paths: root
|
48
|
+
paths: root
|
49
|
+
? [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname]
|
50
|
+
: [...(0, installation_directory_1.getNxRequirePaths)(), __dirname],
|
48
51
|
});
|
49
52
|
}
|
50
53
|
else {
|
51
|
-
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root
|
54
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root
|
55
|
+
? [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname]
|
56
|
+
: [...(0, installation_directory_1.getNxRequirePaths)(), __dirname]);
|
52
57
|
const generatorsFile = packageJson.generators ?? packageJson.schematics;
|
53
58
|
if (!generatorsFile) {
|
54
59
|
throw new Error(`The "${collectionName}" package does not support Nx generators.`);
|
@@ -287,7 +287,7 @@ async function runPluginsInstall(plugins, pmc, destinationGitClient) {
|
|
287
287
|
let installed = true;
|
288
288
|
output_1.output.log({ title: 'Installing Plugins' });
|
289
289
|
try {
|
290
|
-
(0, configure_plugins_1.
|
290
|
+
(0, configure_plugins_1.installPluginPackages)(workspace_root_1.workspaceRoot, pmc, plugins);
|
291
291
|
await destinationGitClient.amendCommit();
|
292
292
|
}
|
293
293
|
catch (e) {
|
@@ -7,14 +7,21 @@ exports.yargsInitCommand = {
|
|
7
7
|
describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
|
8
8
|
builder: (yargs) => withInitOptions(yargs),
|
9
9
|
handler: async (args) => {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
try {
|
11
|
+
const useV2 = await isInitV2();
|
12
|
+
if (useV2) {
|
13
|
+
await require('./init-v2').initHandler(args);
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
await require('./init-v1').initHandler(args);
|
17
|
+
}
|
18
|
+
process.exit(0);
|
13
19
|
}
|
14
|
-
|
15
|
-
|
20
|
+
catch {
|
21
|
+
// Ensure the cursor is always restored just in case the user has bailed during interactive prompts
|
22
|
+
process.stdout.write('\x1b[?25h');
|
23
|
+
process.exit(1);
|
16
24
|
}
|
17
|
-
process.exit(0);
|
18
25
|
},
|
19
26
|
};
|
20
27
|
async function isInitV2() {
|
@@ -39,6 +46,11 @@ async function withInitOptions(yargs) {
|
|
39
46
|
type: 'boolean',
|
40
47
|
description: 'Initialize an Nx workspace setup in the .nx directory of the current repository.',
|
41
48
|
default: false,
|
49
|
+
})
|
50
|
+
.option('force', {
|
51
|
+
describe: 'Force the migration to continue and ignore custom webpack setup or uncommitted changes. Only for CRA projects.',
|
52
|
+
type: 'boolean',
|
53
|
+
default: false,
|
42
54
|
});
|
43
55
|
}
|
44
56
|
else {
|
@@ -1,22 +1,21 @@
|
|
1
1
|
import { PackageManagerCommands } from '../../utils/package-manager';
|
2
|
-
export declare function
|
2
|
+
export declare function installPluginPackages(repoRoot: string, pmc: PackageManagerCommands, plugins: string[]): void;
|
3
3
|
/**
|
4
4
|
* Installs a plugin by running its init generator. It will change the file system tree passed in.
|
5
5
|
* @param plugin The name of the plugin to install
|
6
6
|
* @param repoRoot repo root
|
7
|
-
* @param
|
8
|
-
* @param
|
7
|
+
* @param pmc package manager commands
|
8
|
+
* @param updatePackageScripts whether to update package scripts
|
9
|
+
* @param verbose whether to run in verbose mode
|
9
10
|
* @returns void
|
10
11
|
*/
|
11
|
-
export declare function
|
12
|
-
[k: string]: any;
|
13
|
-
}): Promise<void>;
|
12
|
+
export declare function runPluginInitGenerator(plugin: string, repoRoot?: string, updatePackageScripts?: boolean, verbose?: boolean, pmc?: PackageManagerCommands): Promise<void>;
|
14
13
|
/**
|
15
14
|
* Install plugins
|
16
15
|
* Get the implementation of the plugin's init generator and run it
|
17
16
|
* @returns a list of succeeded plugins and a map of failed plugins to errors
|
18
17
|
*/
|
19
|
-
export declare function
|
18
|
+
export declare function runPluginInitGenerators(plugins: string[], updatePackageScripts: boolean, pmc: PackageManagerCommands, repoRoot?: string, verbose?: boolean): Promise<{
|
20
19
|
succeededPlugins: string[];
|
21
20
|
failedPlugins: {
|
22
21
|
[plugin: string]: Error;
|