nx 17.0.2 → 17.0.4
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 +12 -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 +10 -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 +15 -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 +6 -5
- package/src/command-line/init/implementation/utils.js +59 -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.js +2 -2
- 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 +11 -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 +37 -16
- 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 +11 -34
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +503 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -88
- 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 +111 -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 +66 -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 +8 -0
- package/src/utils/package-manager.js +29 -6
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +56 -8
- 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
|
@@ -18,7 +18,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
|
18
18
|
perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
|
|
19
19
|
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
|
20
20
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
21
|
-
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)(
|
|
21
|
+
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
22
22
|
const opts = parseRunOneOptions(cwd, args, projectGraph, nxJson);
|
|
23
23
|
const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)({
|
|
24
24
|
...opts.parsedArgs,
|
|
@@ -48,9 +48,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, opts.project, extraTargetDependencies, extraOptions);
|
|
51
|
-
// fix for https://github.com/nrwl/nx/issues/1666
|
|
52
|
-
if (process.stdin['unref'])
|
|
53
|
-
process.stdin.unref();
|
|
54
51
|
process.exit(status);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -80,7 +77,7 @@ function parseRunOneOptions(cwd, parsedArgs, projectGraph, nxJson) {
|
|
|
80
77
|
let project;
|
|
81
78
|
let target;
|
|
82
79
|
let configuration;
|
|
83
|
-
if (parsedArgs['project:target:configuration']
|
|
80
|
+
if (parsedArgs['project:target:configuration']?.indexOf(':') > -1) {
|
|
84
81
|
// run case
|
|
85
82
|
[project, target, configuration] = (0, split_target_1.splitTarget)(parsedArgs['project:target:configuration'], projectGraph);
|
|
86
83
|
// this is to account for "nx npmsript:dev"
|
|
@@ -90,7 +87,7 @@ function parseRunOneOptions(cwd, parsedArgs, projectGraph, nxJson) {
|
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
89
|
else {
|
|
93
|
-
target = parsedArgs['project:target:configuration'];
|
|
90
|
+
target = parsedArgs.target ?? parsedArgs['project:target:configuration'];
|
|
94
91
|
}
|
|
95
92
|
if (parsedArgs.project) {
|
|
96
93
|
project = parsedArgs.project;
|
|
@@ -9,6 +9,8 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
|
9
9
|
const configuration_1 = require("../../config/configuration");
|
|
10
10
|
const async_iterator_1 = require("../../utils/async-iterator");
|
|
11
11
|
const executor_utils_1 = require("./executor-utils");
|
|
12
|
+
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
12
14
|
function printRunHelp(opts, schema, plugin) {
|
|
13
15
|
(0, print_help_1.printHelp)(`run ${opts.project}:${opts.target}`, schema, {
|
|
14
16
|
mode: 'run',
|
|
@@ -45,30 +47,53 @@ async function iteratorToProcessStatusCode(i) {
|
|
|
45
47
|
clearInterval(keepProcessAliveInterval);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
async function parseExecutorAndTarget({ project, target
|
|
50
|
+
async function parseExecutorAndTarget({ project, target }, root, projectsConfigurations) {
|
|
49
51
|
const proj = projectsConfigurations.projects[project];
|
|
50
52
|
const targetConfig = proj.targets?.[target];
|
|
51
53
|
if (!targetConfig) {
|
|
52
54
|
throw new Error(`Cannot find target '${target}' for project '${project}'`);
|
|
53
55
|
}
|
|
54
56
|
const [nodeModule, executor] = targetConfig.executor.split(':');
|
|
55
|
-
const { schema, implementationFactory } = (0, executor_utils_1.getExecutorInformation)(nodeModule, executor, root);
|
|
57
|
+
const { schema, implementationFactory } = (0, executor_utils_1.getExecutorInformation)(nodeModule, executor, root, projectsConfigurations.projects);
|
|
56
58
|
return { executor, implementationFactory, nodeModule, schema, targetConfig };
|
|
57
59
|
}
|
|
58
|
-
async function printTargetRunHelpInternal({ project, target
|
|
59
|
-
const { executor, nodeModule, schema } = await parseExecutorAndTarget({ project, target
|
|
60
|
+
async function printTargetRunHelpInternal({ project, target }, root, projectsConfigurations) {
|
|
61
|
+
const { executor, nodeModule, schema, targetConfig } = await parseExecutorAndTarget({ project, target }, root, projectsConfigurations);
|
|
60
62
|
printRunHelp({ project, target }, schema, {
|
|
61
63
|
plugin: nodeModule,
|
|
62
64
|
entity: executor,
|
|
63
65
|
});
|
|
64
|
-
|
|
66
|
+
if (nodeModule === 'nx' &&
|
|
67
|
+
executor === 'run-commands' &&
|
|
68
|
+
targetConfig.options.command) {
|
|
69
|
+
const command = targetConfig.options.command.split(' ')[0];
|
|
70
|
+
const helpCommand = `${command} --help`;
|
|
71
|
+
if (pseudo_terminal_1.PseudoTerminal.isSupported()) {
|
|
72
|
+
const terminal = (0, pseudo_terminal_1.getPseudoTerminal)();
|
|
73
|
+
await new Promise(() => {
|
|
74
|
+
const cp = terminal.runCommand(helpCommand);
|
|
75
|
+
cp.onExit((code) => {
|
|
76
|
+
process.exit(code);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const cp = (0, child_process_1.exec)(helpCommand);
|
|
82
|
+
cp.on('exit', (code) => {
|
|
83
|
+
process.exit(code);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
process.exit(0);
|
|
89
|
+
}
|
|
65
90
|
}
|
|
66
91
|
async function runExecutorInternal({ project, target, configuration }, overrides, root, cwd, projectsConfigurations, nxJsonConfiguration, projectGraph, taskGraph, isVerbose) {
|
|
67
92
|
validateProject(projectsConfigurations, project);
|
|
68
|
-
const { executor, implementationFactory, nodeModule, schema, targetConfig } = await parseExecutorAndTarget({ project, target, configuration }, root, projectsConfigurations
|
|
93
|
+
const { executor, implementationFactory, nodeModule, schema, targetConfig } = await parseExecutorAndTarget({ project, target, configuration }, root, projectsConfigurations);
|
|
69
94
|
configuration ??= targetConfig.defaultConfiguration;
|
|
70
95
|
const combinedOptions = (0, params_1.combineOptionsForExecutor)(overrides, configuration, targetConfig, schema, project, (0, path_1.relative)(root, cwd), isVerbose);
|
|
71
|
-
if ((0, executor_utils_1.getExecutorInformation)(nodeModule, executor, root).isNxExecutor) {
|
|
96
|
+
if ((0, executor_utils_1.getExecutorInformation)(nodeModule, executor, root, projectsConfigurations.projects).isNxExecutor) {
|
|
72
97
|
const implementation = implementationFactory();
|
|
73
98
|
const r = implementation(combinedOptions, {
|
|
74
99
|
root,
|
|
@@ -101,6 +126,7 @@ async function runExecutorInternal({ project, target, configuration }, overrides
|
|
|
101
126
|
target,
|
|
102
127
|
configuration,
|
|
103
128
|
runOptions: combinedOptions,
|
|
129
|
+
projects: projectsConfigurations.projects,
|
|
104
130
|
}, isVerbose);
|
|
105
131
|
const { eachValueFrom } = await Promise.resolve().then(() => require('../../adapter/rxjs-for-await'));
|
|
106
132
|
return eachValueFrom(observable);
|
|
@@ -142,8 +168,7 @@ function printTargetRunHelp(targetDescription, root) {
|
|
|
142
168
|
const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
|
|
143
169
|
return (0, params_1.handleErrors)(false, async () => {
|
|
144
170
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
145
|
-
|
|
146
|
-
printTargetRunHelpInternal(targetDescription, root, projectsConfigurations, nxJsonConfiguration);
|
|
171
|
+
await printTargetRunHelpInternal(targetDescription, root, projectsConfigurations);
|
|
147
172
|
});
|
|
148
173
|
}
|
|
149
174
|
exports.printTargetRunHelp = printTargetRunHelp;
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.yargsRunManyCommand = void 0;
|
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
|
6
|
+
const params_1 = require("../../utils/params");
|
|
6
7
|
exports.yargsRunManyCommand = {
|
|
7
8
|
command: 'run-many',
|
|
8
9
|
describe: 'Run target for multiple listed projects',
|
|
9
10
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withRunManyOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs)))), 'run-many'),
|
|
10
|
-
handler: async (args) =>
|
|
11
|
+
handler: async (args) => await (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
12
|
+
(await Promise.resolve().then(() => require('./run-many'))).runMany((0, shared_options_1.withOverrides)(args));
|
|
13
|
+
}),
|
|
11
14
|
};
|
|
@@ -40,9 +40,6 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = { excl
|
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
43
|
-
// fix for https://github.com/nrwl/nx/issues/1666
|
|
44
|
-
if (process.stdin['unref'])
|
|
45
|
-
process.stdin.unref();
|
|
46
43
|
process.exit(status);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
@@ -14,8 +14,11 @@ export type ShowProjectsOptions = NxShowArgs & {
|
|
|
14
14
|
type: ProjectGraphProjectNode['type'];
|
|
15
15
|
projects: string[];
|
|
16
16
|
withTarget: string[];
|
|
17
|
+
verbose: boolean;
|
|
17
18
|
};
|
|
18
19
|
export type ShowProjectOptions = NxShowArgs & {
|
|
19
20
|
projectName: string;
|
|
21
|
+
web?: boolean;
|
|
22
|
+
verbose: boolean;
|
|
20
23
|
};
|
|
21
24
|
export declare const yargsShowCommand: CommandModule<Record<string, unknown>, NxShowArgs>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.yargsShowCommand = void 0;
|
|
4
4
|
const yargs_1 = require("yargs");
|
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
|
6
|
+
const params_1 = require("../../utils/params");
|
|
6
7
|
exports.yargsShowCommand = {
|
|
7
8
|
command: 'show',
|
|
8
9
|
describe: 'Show information about the workspace (e.g., list of projects)',
|
|
@@ -46,6 +47,10 @@ const showProjectsCommand = {
|
|
|
46
47
|
type: 'string',
|
|
47
48
|
description: 'Select only projects of the given type',
|
|
48
49
|
choices: ['app', 'lib', 'e2e'],
|
|
50
|
+
})
|
|
51
|
+
.option('verbose', {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
description: 'Prints additional information about the commands (e.g., stack traces)',
|
|
49
54
|
})
|
|
50
55
|
.implies('untracked', 'affected')
|
|
51
56
|
.implies('uncommitted', 'affected')
|
|
@@ -57,7 +62,11 @@ const showProjectsCommand = {
|
|
|
57
62
|
.example('$0 show projects --affected', 'Show affected projects in the workspace')
|
|
58
63
|
.example('$0 show projects --type app --affected', 'Show affected apps in the workspace')
|
|
59
64
|
.example('$0 show projects --affected --exclude=*-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
|
|
60
|
-
handler: (args) =>
|
|
65
|
+
handler: (args) => {
|
|
66
|
+
return (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
67
|
+
return (await Promise.resolve().then(() => require('./show'))).showProjectsHandler(args);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
61
70
|
};
|
|
62
71
|
const showProjectCommand = {
|
|
63
72
|
command: 'project <projectName>',
|
|
@@ -69,6 +78,24 @@ const showProjectCommand = {
|
|
|
69
78
|
description: 'Which project should be viewed?',
|
|
70
79
|
})
|
|
71
80
|
.default('json', true)
|
|
81
|
+
.option('web', {
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
description: 'Show project details in the browser',
|
|
84
|
+
})
|
|
85
|
+
.option('verbose', {
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
description: 'Prints additional information about the commands (e.g., stack traces)',
|
|
88
|
+
})
|
|
89
|
+
.check((argv) => {
|
|
90
|
+
if (argv.web) {
|
|
91
|
+
argv.json = false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
})
|
|
72
95
|
.example('$0 show project my-app', 'View project information for my-app in JSON format'),
|
|
73
|
-
handler: (args) =>
|
|
96
|
+
handler: (args) => {
|
|
97
|
+
return (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
98
|
+
return (await Promise.resolve().then(() => require('./show'))).showProjectHandler(args);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
74
101
|
};
|
|
@@ -10,6 +10,7 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
|
10
10
|
const all_file_data_1 = require("../../utils/all-file-data");
|
|
11
11
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
12
12
|
const find_matching_projects_1 = require("../../utils/find-matching-projects");
|
|
13
|
+
const graph_1 = require("../graph/graph");
|
|
13
14
|
async function showProjectsHandler(args) {
|
|
14
15
|
let graph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
15
16
|
const nxJson = (0, nx_json_1.readNxJson)();
|
|
@@ -70,6 +71,14 @@ async function showProjectHandler(args) {
|
|
|
70
71
|
if (args.json) {
|
|
71
72
|
console.log(JSON.stringify(node.data));
|
|
72
73
|
}
|
|
74
|
+
else if (args.web) {
|
|
75
|
+
await (0, graph_1.generateGraph)({
|
|
76
|
+
view: 'project-details',
|
|
77
|
+
focus: node.name,
|
|
78
|
+
watch: true,
|
|
79
|
+
open: true,
|
|
80
|
+
}, []);
|
|
81
|
+
}
|
|
73
82
|
else {
|
|
74
83
|
const chalk = require('chalk');
|
|
75
84
|
const logIfExists = (label, key) => {
|
|
@@ -17,6 +17,7 @@ export interface RunOptions {
|
|
|
17
17
|
cloud: boolean;
|
|
18
18
|
dte: boolean;
|
|
19
19
|
batch: boolean;
|
|
20
|
+
useAgents: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare function withRunOptions<T>(yargs: Argv<T>): Argv<T & RunOptions>;
|
|
22
23
|
export declare function withTargetAndConfigurationOption(yargs: Argv, demandOption?: boolean): Argv<{
|
|
@@ -52,7 +53,9 @@ export declare function withOverrides<T extends {
|
|
|
52
53
|
}>(args: T, commandLevel?: number): T & {
|
|
53
54
|
__overrides_unparsed__: string[];
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
declare const allOutputStyles: readonly ["dynamic", "static", "stream", "stream-without-prefixes", "compact"];
|
|
57
|
+
export type OutputStyle = typeof allOutputStyles[number];
|
|
58
|
+
export declare function withOutputStyleOption(yargs: Argv, choices?: ReadonlyArray<OutputStyle>): Argv<{
|
|
56
59
|
"output-style": string;
|
|
57
60
|
}>;
|
|
58
61
|
export declare function withDepGraphOptions(yargs: Argv): Argv<{
|
|
@@ -68,6 +68,11 @@ function withRunOptions(yargs) {
|
|
|
68
68
|
.options('dte', {
|
|
69
69
|
type: 'boolean',
|
|
70
70
|
hidden: true,
|
|
71
|
+
})
|
|
72
|
+
.options('useAgents', {
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
hidden: true,
|
|
75
|
+
alias: 'agents',
|
|
71
76
|
});
|
|
72
77
|
}
|
|
73
78
|
exports.withRunOptions = withRunOptions;
|
|
@@ -174,7 +179,19 @@ function withOverrides(args, commandLevel = 1) {
|
|
|
174
179
|
};
|
|
175
180
|
}
|
|
176
181
|
exports.withOverrides = withOverrides;
|
|
177
|
-
|
|
182
|
+
const allOutputStyles = [
|
|
183
|
+
'dynamic',
|
|
184
|
+
'static',
|
|
185
|
+
'stream',
|
|
186
|
+
'stream-without-prefixes',
|
|
187
|
+
'compact',
|
|
188
|
+
];
|
|
189
|
+
function withOutputStyleOption(yargs, choices = [
|
|
190
|
+
'dynamic',
|
|
191
|
+
'static',
|
|
192
|
+
'stream',
|
|
193
|
+
'stream-without-prefixes',
|
|
194
|
+
]) {
|
|
178
195
|
return yargs.option('output-style', {
|
|
179
196
|
describe: 'Defines how Nx emits outputs tasks logs',
|
|
180
197
|
type: 'string',
|
|
@@ -234,13 +251,7 @@ function withDepGraphOptions(yargs) {
|
|
|
234
251
|
exports.withDepGraphOptions = withDepGraphOptions;
|
|
235
252
|
function withRunOneOptions(yargs) {
|
|
236
253
|
const executorShouldShowHelp = !(process.argv[2] === 'run' && process.argv[3] === '--help');
|
|
237
|
-
const res = withRunOptions(withOutputStyleOption(withConfiguration(yargs),
|
|
238
|
-
'dynamic',
|
|
239
|
-
'static',
|
|
240
|
-
'stream',
|
|
241
|
-
'stream-without-prefixes',
|
|
242
|
-
'compact',
|
|
243
|
-
]))
|
|
254
|
+
const res = withRunOptions(withOutputStyleOption(withConfiguration(yargs), allOutputStyles))
|
|
244
255
|
.parserConfiguration({
|
|
245
256
|
'strip-dashed': true,
|
|
246
257
|
'unknown-options-as-args': true,
|
|
@@ -267,7 +278,10 @@ function parseCSV(args) {
|
|
|
267
278
|
return [];
|
|
268
279
|
}
|
|
269
280
|
if (Array.isArray(args)) {
|
|
270
|
-
|
|
281
|
+
// If parseCSV is used on `type: 'array'`, the first option may be something like ['a,b,c'].
|
|
282
|
+
return args.length === 1 && args[0].includes(',')
|
|
283
|
+
? parseCSV(args[0])
|
|
284
|
+
: args;
|
|
271
285
|
}
|
|
272
286
|
const items = args.split(',');
|
|
273
287
|
return items.map((i) => i.startsWith('"') && i.endsWith('"') ? i.slice(1, -1) : i);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph of Tasks to be executed
|
|
3
|
+
*/
|
|
4
|
+
export interface CommandGraph {
|
|
5
|
+
/**
|
|
6
|
+
* Projects that do not have any dependencies and are thus ready to execute immediately
|
|
7
|
+
*/
|
|
8
|
+
roots: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Map of projects to projects which the task depends on
|
|
11
|
+
*/
|
|
12
|
+
dependencies: Record<string, string[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ProjectGraph } from '../config/project-graph';
|
|
2
|
+
import { NxArgs } from '../utils/command-line-utils';
|
|
3
|
+
import { CommandGraph } from './command-graph';
|
|
4
|
+
export declare function createCommandGraph(projectGraph: ProjectGraph, projectNames: string[], nxArgs: NxArgs): CommandGraph;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCommandGraph = void 0;
|
|
4
|
+
const task_graph_utils_1 = require("../tasks-runner/task-graph-utils");
|
|
5
|
+
const output_1 = require("../utils/output");
|
|
6
|
+
function createCommandGraph(projectGraph, projectNames, nxArgs) {
|
|
7
|
+
const dependencies = {};
|
|
8
|
+
for (const projectName of projectNames) {
|
|
9
|
+
if (projectGraph.dependencies[projectName].length >= 1) {
|
|
10
|
+
dependencies[projectName] = [
|
|
11
|
+
...new Set(projectGraph.dependencies[projectName]
|
|
12
|
+
.map((projectDep) => projectDep.target)
|
|
13
|
+
.filter((projectDep) => projectGraph.nodes[projectDep])).values(),
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
dependencies[projectName] = [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const roots = Object.keys(dependencies).filter((d) => dependencies[d].length === 0);
|
|
21
|
+
const commandGraph = {
|
|
22
|
+
dependencies,
|
|
23
|
+
roots,
|
|
24
|
+
};
|
|
25
|
+
const cycle = (0, task_graph_utils_1.findCycle)(commandGraph);
|
|
26
|
+
if (cycle) {
|
|
27
|
+
if (process.env.NX_IGNORE_CYCLES === 'true' || nxArgs.nxIgnoreCycles) {
|
|
28
|
+
output_1.output.warn({
|
|
29
|
+
title: `The command graph has a circular dependency`,
|
|
30
|
+
bodyLines: [`${cycle.join(' --> ')}`],
|
|
31
|
+
});
|
|
32
|
+
(0, task_graph_utils_1.makeAcyclic)(commandGraph);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
output_1.output.error({
|
|
36
|
+
title: `Could not execute command because the project graph has a circular dependency`,
|
|
37
|
+
bodyLines: [`${cycle.join(' --> ')}`],
|
|
38
|
+
});
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return commandGraph;
|
|
43
|
+
}
|
|
44
|
+
exports.createCommandGraph = createCommandGraph;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommandProjects = void 0;
|
|
4
|
+
const utils_1 = require("../tasks-runner/utils");
|
|
5
|
+
const create_command_graph_1 = require("./create-command-graph");
|
|
6
|
+
function getCommandProjects(projectGraph, projects, nxArgs) {
|
|
7
|
+
const commandGraph = (0, create_command_graph_1.createCommandGraph)(projectGraph, projects.map((project) => project.name), nxArgs);
|
|
8
|
+
return getSortedProjects(commandGraph);
|
|
9
|
+
}
|
|
10
|
+
exports.getCommandProjects = getCommandProjects;
|
|
11
|
+
function getSortedProjects(commandGraph, sortedProjects = []) {
|
|
12
|
+
const roots = commandGraph.roots;
|
|
13
|
+
if (!roots.length) {
|
|
14
|
+
return sortedProjects;
|
|
15
|
+
}
|
|
16
|
+
sortedProjects.push(...roots);
|
|
17
|
+
const newGraph = (0, utils_1.removeIdsFromGraph)(commandGraph, roots, commandGraph.dependencies);
|
|
18
|
+
return getSortedProjects(newGraph, sortedProjects);
|
|
19
|
+
}
|