nx 17.0.3 → 17.0.5
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/LICENSE +1 -1
- package/README.md +9 -4
- package/bin/init-local.js +10 -60
- package/bin/nx-cloud.js +6 -0
- package/bin/nx.js +1 -9
- package/bin/post-install.js +5 -1
- package/bin/run-executor.js +1 -1
- package/migrations.json +18 -0
- package/package.json +21 -18
- package/plugins/package-json.js +1 -1
- package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
- package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
- package/release/index.d.ts +4 -0
- package/release/index.js +11 -0
- package/schemas/nx-schema.json +203 -19
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.js +28 -18
- package/src/adapter/compat.d.ts +2 -2
- package/src/adapter/compat.js +6 -1
- package/src/adapter/ngcli-adapter.d.ts +16 -4
- package/src/adapter/ngcli-adapter.js +85 -28
- package/src/command-line/add/add.d.ts +2 -0
- package/src/command-line/add/add.js +169 -0
- package/src/command-line/add/command-object.d.ts +7 -0
- package/src/command-line/add/command-object.js +24 -0
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/affected/command-object.d.ts +4 -4
- package/src/command-line/affected/command-object.js +53 -26
- package/src/command-line/affected/print-affected.js +10 -1
- package/src/command-line/connect/command-object.d.ts +1 -2
- package/src/command-line/connect/command-object.js +3 -7
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
- package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
- package/src/command-line/connect/view-logs.js +5 -21
- package/src/command-line/examples.js +18 -0
- package/src/command-line/exec/command-object.js +2 -1
- package/src/command-line/exec/exec.d.ts +1 -1
- package/src/command-line/exec/exec.js +78 -35
- package/src/command-line/format/format.js +13 -4
- package/src/command-line/generate/generate.js +9 -9
- package/src/command-line/generate/generator-utils.d.ts +3 -2
- package/src/command-line/generate/generator-utils.js +5 -5
- package/src/command-line/graph/graph.d.ts +1 -1
- package/src/command-line/graph/graph.js +82 -37
- package/src/command-line/init/command-object.js +70 -43
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +11 -2
- package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +9 -6
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +14 -4
- package/src/command-line/init/implementation/angular/index.js +4 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/types.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +4 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
- package/src/command-line/init/implementation/utils.d.ts +5 -5
- package/src/command-line/init/implementation/utils.js +46 -44
- package/src/command-line/init/{init.js → init-v1.js} +5 -13
- package/src/command-line/init/init-v2.d.ts +7 -0
- package/src/command-line/init/init-v2.js +201 -0
- package/src/command-line/list/list.js +6 -5
- package/src/command-line/migrate/command-object.js +19 -4
- package/src/command-line/migrate/migrate.js +21 -17
- package/src/command-line/new/new.js +1 -1
- package/src/command-line/nx-commands.js +4 -1
- package/src/command-line/release/changelog.d.ts +22 -1
- package/src/command-line/release/changelog.js +459 -257
- package/src/command-line/release/command-object.d.ts +29 -7
- package/src/command-line/release/command-object.js +120 -20
- package/src/command-line/release/config/config.d.ts +26 -21
- package/src/command-line/release/config/config.js +416 -59
- package/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/src/command-line/release/config/conventional-commits.js +98 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
- package/src/command-line/release/config/filter-release-groups.js +38 -1
- package/src/command-line/release/index.d.ts +16 -0
- package/src/command-line/release/index.js +23 -0
- package/src/command-line/release/publish.d.ts +7 -3
- package/src/command-line/release/publish.js +89 -37
- package/src/command-line/release/release.d.ts +4 -0
- package/src/command-line/release/release.js +176 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
- package/src/command-line/release/utils/exec-command.d.ts +1 -0
- package/src/command-line/release/utils/exec-command.js +34 -0
- package/src/command-line/release/utils/git.d.ts +34 -1
- package/src/command-line/release/utils/git.js +238 -34
- package/src/command-line/release/utils/github.d.ts +5 -5
- package/src/command-line/release/utils/github.js +155 -8
- package/src/command-line/release/utils/markdown.js +6 -1
- package/src/command-line/release/utils/print-changes.d.ts +1 -1
- package/src/command-line/release/utils/print-changes.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
- package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +30 -1
- package/src/command-line/release/utils/shared.d.ts +39 -0
- package/src/command-line/release/utils/shared.js +213 -0
- package/src/command-line/release/version.d.ts +37 -3
- package/src/command-line/release/version.js +312 -117
- package/src/command-line/repair/repair.js +13 -9
- package/src/command-line/report/report.d.ts +3 -0
- package/src/command-line/report/report.js +22 -5
- package/src/command-line/run/command-object.d.ts +4 -0
- package/src/command-line/run/command-object.js +18 -2
- package/src/command-line/run/executor-utils.d.ts +2 -1
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +3 -6
- package/src/command-line/run/run.js +34 -9
- package/src/command-line/run-many/command-object.js +4 -1
- package/src/command-line/run-many/run-many.js +0 -3
- package/src/command-line/show/command-object.d.ts +3 -0
- package/src/command-line/show/command-object.js +29 -2
- package/src/command-line/show/show.js +9 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
- package/src/command-line/yargs-utils/shared-options.js +23 -9
- package/src/commands-runner/command-graph.d.ts +13 -0
- package/src/commands-runner/command-graph.js +2 -0
- package/src/commands-runner/create-command-graph.d.ts +4 -0
- package/src/commands-runner/create-command-graph.js +44 -0
- package/src/commands-runner/get-command-projects.d.ts +3 -0
- package/src/commands-runner/get-command-projects.js +19 -0
- package/src/config/nx-json.d.ts +160 -25
- package/src/config/project-graph.d.ts +3 -3
- package/src/config/workspace-json-project-json.d.ts +23 -1
- package/src/config/workspaces.d.ts +1 -1
- package/src/config/workspaces.js +4 -6
- package/src/core/graph/3rdpartylicenses.txt +144 -74
- package/src/core/graph/environment.js +1 -1
- package/src/core/graph/index.html +4 -6
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +3 -3
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -1
- package/src/daemon/client/client.js +27 -8
- package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
- package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
- package/src/daemon/daemon-project-graph-error.d.ts +8 -0
- package/src/daemon/daemon-project-graph-error.js +13 -0
- package/src/daemon/server/handle-hash-tasks.js +12 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
- package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
- package/src/daemon/server/shutdown-utils.js +2 -4
- package/src/daemon/server/watcher.js +0 -3
- package/src/daemon/socket-utils.d.ts +2 -1
- package/src/daemon/socket-utils.js +15 -4
- package/src/daemon/tmp-dir.d.ts +1 -0
- package/src/daemon/tmp-dir.js +4 -4
- package/src/devkit-exports.d.ts +2 -2
- package/src/devkit-exports.js +3 -2
- package/src/devkit-internals.d.ts +3 -0
- package/src/devkit-internals.js +7 -1
- package/src/executors/noop/schema.json +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
- package/src/executors/run-commands/run-commands.impl.js +152 -48
- package/src/executors/run-commands/schema.json +11 -1
- package/src/executors/run-script/run-script.impl.js +43 -11
- package/src/executors/utils/convert-nx-executor.js +1 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
- package/src/generators/tree.d.ts +1 -0
- package/src/generators/utils/glob.js +2 -2
- package/src/generators/utils/project-configuration.js +28 -9
- package/src/hasher/create-task-hasher.d.ts +4 -0
- package/src/hasher/create-task-hasher.js +16 -0
- package/src/hasher/hash-task.js +9 -3
- package/src/hasher/native-task-hasher-impl.d.ts +19 -0
- package/src/hasher/native-task-hasher-impl.js +37 -0
- package/src/hasher/node-task-hasher-impl.d.ts +49 -0
- package/src/hasher/node-task-hasher-impl.js +431 -0
- package/src/hasher/task-hasher.d.ts +33 -21
- package/src/hasher/task-hasher.js +30 -428
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
- package/src/migrations/update-15-1-0/set-project-names.js +2 -1
- package/src/migrations/update-15-8-2/update-nxw.js +2 -6
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +21 -0
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
- package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
- package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
- package/src/migrations/update-17-3-0/update-nxw.js +7 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
- package/src/native/index.d.ts +65 -15
- package/src/native/index.js +6 -2
- package/src/native/transform-objects.js +2 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
- package/src/nx-cloud/update-manager.js +2 -1
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/index.js +3 -3
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.js +15 -3
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
- package/src/plugins/js/utils/register.d.ts +1 -1
- package/src/plugins/js/utils/register.js +28 -8
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
- package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +4 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
- package/src/plugins/project-json/build-nodes/project-json.js +6 -44
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
- package/src/project-graph/affected/locators/workspace-projects.js +16 -29
- package/src/project-graph/build-project-graph.d.ts +20 -1
- package/src/project-graph/build-project-graph.js +91 -33
- package/src/project-graph/file-map-utils.d.ts +9 -5
- package/src/project-graph/file-map-utils.js +16 -63
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +44 -2
- package/src/project-graph/nx-deps-cache.js +1 -1
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph-builder.js +1 -1
- package/src/project-graph/project-graph.d.ts +32 -1
- package/src/project-graph/project-graph.js +147 -23
- package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
- package/src/project-graph/utils/build-all-workspace-files.js +15 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
- package/src/project-graph/utils/normalize-project-nodes.js +7 -33
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +509 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
- package/src/tasks-runner/batch/run-batch.js +3 -3
- package/src/tasks-runner/cache.js +6 -3
- package/src/tasks-runner/create-task-graph.js +1 -1
- package/src/tasks-runner/fork.d.ts +1 -0
- package/src/tasks-runner/fork.js +23 -0
- package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
- package/src/tasks-runner/forked-process-task-runner.js +112 -21
- package/src/tasks-runner/init-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
- package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
- package/src/tasks-runner/pseudo-ipc.js +140 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
- package/src/tasks-runner/pseudo-terminal.js +159 -0
- package/src/tasks-runner/run-command.d.ts +1 -1
- package/src/tasks-runner/run-command.js +13 -19
- package/src/tasks-runner/task-env.js +1 -2
- package/src/tasks-runner/task-graph-utils.d.ts +7 -3
- package/src/tasks-runner/task-graph-utils.js +15 -15
- package/src/tasks-runner/task-orchestrator.js +68 -12
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +16 -7
- package/src/tasks-runner/utils.js +30 -16
- package/src/utils/ab-testing.d.ts +36 -2
- package/src/utils/ab-testing.js +34 -16
- package/src/utils/assert-workspace-validity.js +1 -1
- package/src/utils/cache-directory.d.ts +1 -0
- package/src/utils/cache-directory.js +5 -1
- package/src/utils/child-process.d.ts +15 -1
- package/src/utils/child-process.js +91 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/exit-codes.d.ts +6 -0
- package/src/utils/exit-codes.js +20 -0
- package/src/utils/fileutils.d.ts +1 -0
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -0
- package/src/utils/ignore.js +8 -1
- package/src/utils/json-diff.d.ts +1 -0
- package/src/utils/json-diff.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/nx-cloud-utils.d.ts +1 -1
- package/src/utils/nx-cloud-utils.js +9 -4
- package/src/utils/nx-plugin.d.ts +32 -15
- package/src/utils/nx-plugin.deprecated.d.ts +10 -5
- package/src/utils/nx-plugin.deprecated.js +23 -0
- package/src/utils/nx-plugin.js +71 -80
- package/src/utils/output.d.ts +4 -2
- package/src/utils/output.js +44 -9
- package/src/utils/package-json.d.ts +4 -4
- package/src/utils/package-json.js +18 -12
- package/src/utils/package-manager.d.ts +7 -0
- package/src/utils/package-manager.js +24 -4
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +37 -4
- package/src/utils/plugins/core-plugins.js +8 -0
- package/src/utils/plugins/installed-plugins.d.ts +2 -1
- package/src/utils/plugins/installed-plugins.js +2 -2
- package/src/utils/plugins/local-plugins.js +1 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
- package/src/utils/plugins/plugin-capabilities.js +7 -7
- package/src/utils/typescript.js +1 -1
- package/src/utils/update-nxw.d.ts +2 -0
- package/src/utils/update-nxw.js +12 -0
- package/src/utils/workspace-configuration-check.js +1 -1
- package/src/utils/workspace-context.d.ts +6 -4
- package/src/utils/workspace-context.js +19 -9
- package/src/core/graph/polyfills.js +0 -1
- /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
package/src/utils/params.js
CHANGED
|
@@ -13,6 +13,20 @@ async function handleErrors(isVerbose, fn) {
|
|
|
13
13
|
if (err.constructor.name === 'UnsuccessfulWorkflowExecution') {
|
|
14
14
|
logger_1.logger.error('The generator workflow failed. See above.');
|
|
15
15
|
}
|
|
16
|
+
else if (err.name === 'ProjectGraphError') {
|
|
17
|
+
const projectGraphError = err;
|
|
18
|
+
let title = projectGraphError.message;
|
|
19
|
+
if (isVerbose) {
|
|
20
|
+
title += ' See errors below.';
|
|
21
|
+
}
|
|
22
|
+
const bodyLines = isVerbose
|
|
23
|
+
? [projectGraphError.stack]
|
|
24
|
+
: ['Pass --verbose to see the stacktraces.'];
|
|
25
|
+
output_1.output.error({
|
|
26
|
+
title,
|
|
27
|
+
bodyLines: bodyLines,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
16
30
|
else {
|
|
17
31
|
const lines = (err.message ? err.message : err.toString()).split('\n');
|
|
18
32
|
const bodyLines = lines.slice(1);
|
|
@@ -188,20 +202,33 @@ function validateObject(opts, schema, definitions) {
|
|
|
188
202
|
throw new SchemaError(`Required property '${p}' is missing`);
|
|
189
203
|
}
|
|
190
204
|
});
|
|
191
|
-
if (schema.additionalProperties
|
|
205
|
+
if (schema.additionalProperties !== undefined &&
|
|
206
|
+
schema.additionalProperties !== true) {
|
|
192
207
|
Object.keys(opts).find((p) => {
|
|
193
|
-
if (Object.keys(schema.properties).indexOf(p) === -1
|
|
208
|
+
if (Object.keys(schema.properties ?? {}).indexOf(p) === -1 &&
|
|
209
|
+
(!schema.patternProperties ||
|
|
210
|
+
!Object.keys(schema.patternProperties).some((pattern) => new RegExp(pattern).test(p)))) {
|
|
194
211
|
if (p === '_') {
|
|
195
212
|
throw new SchemaError(`Schema does not support positional arguments. Argument '${opts[p]}' found`);
|
|
196
213
|
}
|
|
197
|
-
else {
|
|
214
|
+
else if (schema.additionalProperties === false) {
|
|
198
215
|
throw new SchemaError(`'${p}' is not found in schema`);
|
|
199
216
|
}
|
|
217
|
+
else if (typeof schema.additionalProperties === 'object') {
|
|
218
|
+
validateProperty(p, opts[p], schema.additionalProperties, definitions);
|
|
219
|
+
}
|
|
200
220
|
}
|
|
201
221
|
});
|
|
202
222
|
}
|
|
203
223
|
Object.keys(opts).forEach((p) => {
|
|
204
224
|
validateProperty(p, opts[p], (schema.properties ?? {})[p], definitions);
|
|
225
|
+
if (schema.patternProperties) {
|
|
226
|
+
Object.keys(schema.patternProperties).forEach((pattern) => {
|
|
227
|
+
if (new RegExp(pattern).test(p)) {
|
|
228
|
+
validateProperty(p, opts[p], schema.patternProperties[pattern], definitions);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
205
232
|
});
|
|
206
233
|
}
|
|
207
234
|
exports.validateObject = validateObject;
|
|
@@ -399,7 +426,7 @@ function resolveDefinition(ref, definitions) {
|
|
|
399
426
|
return definitions[definition];
|
|
400
427
|
}
|
|
401
428
|
function applyVerbosity(options, schema, isVerbose) {
|
|
402
|
-
if ((schema.additionalProperties || 'verbose' in schema.properties) &&
|
|
429
|
+
if ((schema.additionalProperties === true || 'verbose' in schema.properties) &&
|
|
403
430
|
isVerbose) {
|
|
404
431
|
options['verbose'] = true;
|
|
405
432
|
}
|
|
@@ -472,6 +499,12 @@ function convertSmartDefaultsIntoNamedParams(opts, schema, defaultProjectName, r
|
|
|
472
499
|
relativeCwd) {
|
|
473
500
|
opts[k] = relativeCwd.replace(/\\/g, '/');
|
|
474
501
|
}
|
|
502
|
+
else if (opts[k] === undefined &&
|
|
503
|
+
v.$default !== undefined &&
|
|
504
|
+
v.$default.$source === 'workingDirectory' &&
|
|
505
|
+
relativeCwd) {
|
|
506
|
+
opts[k] = relativeCwd.replace(/\\/g, '/');
|
|
507
|
+
}
|
|
475
508
|
});
|
|
476
509
|
const leftOverPositionalArgs = [];
|
|
477
510
|
for (let i = 0; i < argv.length; ++i) {
|
|
@@ -53,6 +53,10 @@ function fetchCorePlugins() {
|
|
|
53
53
|
name: '@nx/node',
|
|
54
54
|
capabilities: 'executors,generators',
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
name: '@nx/nuxt',
|
|
58
|
+
capabilities: 'generators',
|
|
59
|
+
},
|
|
56
60
|
{
|
|
57
61
|
name: 'nx',
|
|
58
62
|
capabilities: 'executors',
|
|
@@ -69,6 +73,10 @@ function fetchCorePlugins() {
|
|
|
69
73
|
name: '@nx/react-native',
|
|
70
74
|
capabilities: 'executors,generators',
|
|
71
75
|
},
|
|
76
|
+
{
|
|
77
|
+
name: '@nx/remix',
|
|
78
|
+
capabilities: 'executors,generators',
|
|
79
|
+
},
|
|
72
80
|
{
|
|
73
81
|
name: '@nx/rollup',
|
|
74
82
|
capabilities: 'executors,generators',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PluginCapabilities } from './models';
|
|
2
2
|
import { PackageJson } from '../package-json';
|
|
3
|
+
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
|
3
4
|
export declare function findInstalledPlugins(): PackageJson[];
|
|
4
|
-
export declare function getInstalledPluginsAndCapabilities(workspaceRoot: string): Promise<Map<string, PluginCapabilities>>;
|
|
5
|
+
export declare function getInstalledPluginsAndCapabilities(workspaceRoot: string, projects: Record<string, ProjectConfiguration>): Promise<Map<string, PluginCapabilities>>;
|
|
5
6
|
export declare function listInstalledPlugins(installedPlugins: Map<string, PluginCapabilities>): void;
|
|
@@ -59,12 +59,12 @@ function getDependenciesFromNxJson() {
|
|
|
59
59
|
}
|
|
60
60
|
return ['nx', ...Object.keys(installation.plugins || {})];
|
|
61
61
|
}
|
|
62
|
-
async function getInstalledPluginsAndCapabilities(workspaceRoot) {
|
|
62
|
+
async function getInstalledPluginsAndCapabilities(workspaceRoot, projects) {
|
|
63
63
|
const plugins = findInstalledPlugins().map((p) => p.name);
|
|
64
64
|
const result = new Map();
|
|
65
65
|
for (const plugin of Array.from(plugins).sort()) {
|
|
66
66
|
try {
|
|
67
|
-
const capabilities = await (0, plugin_capabilities_1.getPluginCapabilities)(workspaceRoot, plugin);
|
|
67
|
+
const capabilities = await (0, plugin_capabilities_1.getPluginCapabilities)(workspaceRoot, plugin, projects);
|
|
68
68
|
if (capabilities &&
|
|
69
69
|
(capabilities.executors ||
|
|
70
70
|
capabilities.generators ||
|
|
@@ -16,7 +16,7 @@ async function getLocalWorkspacePlugins(projectsConfiguration, nxJson) {
|
|
|
16
16
|
if ((0, fs_1.existsSync)(packageJsonPath)) {
|
|
17
17
|
const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
18
18
|
const includeRuntimeCapabilities = nxJson?.plugins?.some((p) => (typeof p === 'string' ? p : p.plugin).startsWith(packageJson.name));
|
|
19
|
-
const capabilities = await (0, plugin_capabilities_1.getPluginCapabilities)(workspace_root_1.workspaceRoot, packageJson.name, includeRuntimeCapabilities);
|
|
19
|
+
const capabilities = await (0, plugin_capabilities_1.getPluginCapabilities)(workspace_root_1.workspaceRoot, packageJson.name, projectsConfiguration.projects, includeRuntimeCapabilities);
|
|
20
20
|
if (capabilities &&
|
|
21
21
|
(Object.keys(capabilities.executors ?? {}).length ||
|
|
22
22
|
Object.keys(capabilities.generators ?? {}).length ||
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { PluginCapabilities } from './models';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
|
3
|
+
export declare function getPluginCapabilities(workspaceRoot: string, pluginName: string, projects: Record<string, ProjectConfiguration>, includeRuntimeCapabilities?: boolean): Promise<PluginCapabilities | null>;
|
|
4
|
+
export declare function listPluginCapabilities(pluginName: string, projects: Record<string, ProjectConfiguration>): Promise<void>;
|
|
@@ -22,11 +22,11 @@ function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
async function getPluginCapabilities(workspaceRoot, pluginName, includeRuntimeCapabilities = false) {
|
|
25
|
+
async function getPluginCapabilities(workspaceRoot, pluginName, projects, includeRuntimeCapabilities = false) {
|
|
26
26
|
try {
|
|
27
|
-
const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(pluginName, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
|
27
|
+
const { json: packageJson, path: packageJsonPath } = await (0, nx_plugin_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
|
28
28
|
const pluginModule = includeRuntimeCapabilities
|
|
29
|
-
? await tryGetModule(packageJson, workspaceRoot)
|
|
29
|
+
? await tryGetModule(packageJson, workspaceRoot, projects)
|
|
30
30
|
: {};
|
|
31
31
|
return {
|
|
32
32
|
name: pluginName,
|
|
@@ -56,14 +56,14 @@ async function getPluginCapabilities(workspaceRoot, pluginName, includeRuntimeCa
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
exports.getPluginCapabilities = getPluginCapabilities;
|
|
59
|
-
async function tryGetModule(packageJson, workspaceRoot) {
|
|
59
|
+
async function tryGetModule(packageJson, workspaceRoot, projects) {
|
|
60
60
|
try {
|
|
61
61
|
return (packageJson.generators ??
|
|
62
62
|
packageJson.executors ??
|
|
63
63
|
packageJson['nx-migrations'] ??
|
|
64
64
|
packageJson['schematics'] ??
|
|
65
65
|
packageJson['builders'])
|
|
66
|
-
? (await (0, nx_plugin_1.loadNxPluginAsync)(packageJson.name, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot)).plugin
|
|
66
|
+
? (await (0, nx_plugin_1.loadNxPluginAsync)(packageJson.name, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), projects, workspaceRoot)).plugin
|
|
67
67
|
: {
|
|
68
68
|
name: packageJson.name,
|
|
69
69
|
};
|
|
@@ -72,8 +72,8 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
async function listPluginCapabilities(pluginName) {
|
|
76
|
-
const plugin = await getPluginCapabilities(workspace_root_1.workspaceRoot, pluginName);
|
|
75
|
+
async function listPluginCapabilities(pluginName, projects) {
|
|
76
|
+
const plugin = await getPluginCapabilities(workspace_root_1.workspaceRoot, pluginName, projects);
|
|
77
77
|
if (!plugin) {
|
|
78
78
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
79
79
|
output_1.output.note({
|
package/src/utils/typescript.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// TODO(
|
|
2
|
+
// TODO(v19): Nx Devkit 15 depends on this file. Remove this when we no longer support Nx Devkit 15
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("../plugins/js/utils/typescript"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateNxw = void 0;
|
|
4
|
+
const add_nx_scripts_1 = require("../command-line/init/implementation/dot-nx/add-nx-scripts");
|
|
5
|
+
const path_1 = require("../utils/path");
|
|
6
|
+
function updateNxw(tree) {
|
|
7
|
+
const wrapperPath = (0, path_1.normalizePath)((0, add_nx_scripts_1.nxWrapperPath)());
|
|
8
|
+
if (tree.exists(wrapperPath)) {
|
|
9
|
+
tree.write(wrapperPath, (0, add_nx_scripts_1.getNxWrapperContents)());
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.updateNxw = updateNxw;
|
|
@@ -6,7 +6,7 @@ const fs_1 = require("fs");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const output_1 = require("./output");
|
|
8
8
|
const fileutils_1 = require("../utils/fileutils");
|
|
9
|
-
//TODO: vsavkin remove after Nx
|
|
9
|
+
//TODO: vsavkin remove after Nx 19
|
|
10
10
|
function workspaceConfigurationCheck() {
|
|
11
11
|
if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'workspace.json'))) {
|
|
12
12
|
output_1.output.warn({
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NxWorkspaceFilesExternals } from '../native';
|
|
2
2
|
export declare function setupWorkspaceContext(workspaceRoot: string): void;
|
|
3
|
-
export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string,
|
|
4
|
-
export declare function globWithWorkspaceContext(workspaceRoot: string, globs: string[]): string[];
|
|
5
|
-
export declare function
|
|
3
|
+
export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, projectRootMap: Record<string, string>): import("../native").NxWorkspaceFiles;
|
|
4
|
+
export declare function globWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): string[];
|
|
5
|
+
export declare function hashWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): string;
|
|
6
6
|
export declare function updateFilesInContext(updatedFiles: string[], deletedFiles: string[]): Record<string, string>;
|
|
7
7
|
export declare function getAllFileDataInContext(workspaceRoot: string): import("../native").FileData[];
|
|
8
|
+
export declare function getFilesInDirectoryUsingContext(workspaceRoot: string, dir: string): string[];
|
|
9
|
+
export declare function updateProjectFiles(projectRootMappings: Record<string, string>, rustReferences: NxWorkspaceFilesExternals, updatedFiles: Record<string, string>, deletedFiles: string[]): import("../native").UpdatedWorkspaceFiles;
|
|
8
10
|
export declare function resetWorkspaceContext(): void;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resetWorkspaceContext = exports.getAllFileDataInContext = exports.updateFilesInContext = exports.
|
|
3
|
+
exports.resetWorkspaceContext = exports.updateProjectFiles = exports.getFilesInDirectoryUsingContext = exports.getAllFileDataInContext = exports.updateFilesInContext = exports.hashWithWorkspaceContext = exports.globWithWorkspaceContext = exports.getNxWorkspaceFilesFromContext = exports.setupWorkspaceContext = void 0;
|
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
|
5
|
+
const cache_directory_1 = require("./cache-directory");
|
|
5
6
|
let workspaceContext;
|
|
6
7
|
function setupWorkspaceContext(workspaceRoot) {
|
|
7
8
|
const { WorkspaceContext } = require('../native');
|
|
8
9
|
perf_hooks_1.performance.mark('workspace-context');
|
|
9
|
-
workspaceContext = new WorkspaceContext(workspaceRoot);
|
|
10
|
+
workspaceContext = new WorkspaceContext(workspaceRoot, (0, cache_directory_1.cacheDirectoryForWorkspace)(workspaceRoot));
|
|
10
11
|
perf_hooks_1.performance.mark('workspace-context:end');
|
|
11
12
|
perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
|
|
12
13
|
}
|
|
13
14
|
exports.setupWorkspaceContext = setupWorkspaceContext;
|
|
14
|
-
function getNxWorkspaceFilesFromContext(workspaceRoot,
|
|
15
|
+
function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
|
|
15
16
|
ensureContextAvailable(workspaceRoot);
|
|
16
|
-
return workspaceContext.getWorkspaceFiles(
|
|
17
|
+
return workspaceContext.getWorkspaceFiles(projectRootMap);
|
|
17
18
|
}
|
|
18
19
|
exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
|
|
19
|
-
function globWithWorkspaceContext(workspaceRoot, globs) {
|
|
20
|
+
function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
20
21
|
ensureContextAvailable(workspaceRoot);
|
|
21
|
-
return workspaceContext.glob(globs);
|
|
22
|
+
return workspaceContext.glob(globs, exclude);
|
|
22
23
|
}
|
|
23
24
|
exports.globWithWorkspaceContext = globWithWorkspaceContext;
|
|
24
|
-
function
|
|
25
|
+
function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
25
26
|
ensureContextAvailable(workspaceRoot);
|
|
26
|
-
return workspaceContext.
|
|
27
|
+
return workspaceContext.hashFilesMatchingGlob(globs, exclude);
|
|
27
28
|
}
|
|
28
|
-
exports.
|
|
29
|
+
exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
|
|
29
30
|
function updateFilesInContext(updatedFiles, deletedFiles) {
|
|
30
31
|
return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
|
|
31
32
|
}
|
|
@@ -35,6 +36,15 @@ function getAllFileDataInContext(workspaceRoot) {
|
|
|
35
36
|
return workspaceContext.allFileData();
|
|
36
37
|
}
|
|
37
38
|
exports.getAllFileDataInContext = getAllFileDataInContext;
|
|
39
|
+
function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
|
40
|
+
ensureContextAvailable(workspaceRoot);
|
|
41
|
+
return workspaceContext.getFilesInDirectory(dir);
|
|
42
|
+
}
|
|
43
|
+
exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
|
|
44
|
+
function updateProjectFiles(projectRootMappings, rustReferences, updatedFiles, deletedFiles) {
|
|
45
|
+
return workspaceContext?.updateProjectFiles(projectRootMappings, rustReferences.projectFiles, rustReferences.globalFiles, updatedFiles, deletedFiles);
|
|
46
|
+
}
|
|
47
|
+
exports.updateProjectFiles = updateProjectFiles;
|
|
38
48
|
function ensureContextAvailable(workspaceRoot) {
|
|
39
49
|
if (!workspaceContext || workspaceContext?.workspaceRoot !== workspaceRoot) {
|
|
40
50
|
setupWorkspaceContext(workspaceRoot);
|