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
|
@@ -9,6 +9,9 @@ const output_1 = require("../../utils/output");
|
|
|
9
9
|
const pretty_time_1 = require("./pretty-time");
|
|
10
10
|
const formatting_utils_1 = require("./formatting-utils");
|
|
11
11
|
const view_logs_utils_1 = require("./view-logs-utils");
|
|
12
|
+
const LEFT_PAD = ` `;
|
|
13
|
+
const SPACER = ` `;
|
|
14
|
+
const EXTENDED_LEFT_PAD = ` `;
|
|
12
15
|
/**
|
|
13
16
|
* The following function is responsible for creating a life cycle with dynamic
|
|
14
17
|
* outputs, meaning previous outputs can be rewritten or modified as new outputs
|
|
@@ -74,7 +77,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
74
77
|
// Create vertical breathing room for cursor position under the pinned footer
|
|
75
78
|
lines.push('');
|
|
76
79
|
for (const line of lines) {
|
|
77
|
-
output_1.output.overwriteLine(
|
|
80
|
+
output_1.output.overwriteLine(line);
|
|
78
81
|
}
|
|
79
82
|
pinnedFooterNumLines = lines.length + additionalLines;
|
|
80
83
|
// clear any possible text below the cursor's position
|
|
@@ -90,7 +93,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
90
93
|
switch (status) {
|
|
91
94
|
case 'local-cache':
|
|
92
95
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
|
93
|
-
|
|
96
|
+
SPACER +
|
|
94
97
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[local cache]')}`);
|
|
95
98
|
if (isVerbose) {
|
|
96
99
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
|
@@ -98,7 +101,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
98
101
|
break;
|
|
99
102
|
case 'local-cache-kept-existing':
|
|
100
103
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
|
101
|
-
|
|
104
|
+
SPACER +
|
|
102
105
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[existing outputs match the cache, left as is]')}`);
|
|
103
106
|
if (isVerbose) {
|
|
104
107
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
|
@@ -106,7 +109,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
106
109
|
break;
|
|
107
110
|
case 'remote-cache':
|
|
108
111
|
writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
|
|
109
|
-
|
|
112
|
+
SPACER +
|
|
110
113
|
output_1.output.formatCommand(task.id)} ${output_1.output.dim('[remote cache]')}`);
|
|
111
114
|
if (isVerbose) {
|
|
112
115
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
|
@@ -115,7 +118,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
115
118
|
case 'success': {
|
|
116
119
|
const timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(tasksToProcessStartTimes[task.id]));
|
|
117
120
|
writeCompletedTaskResultLine(output_1.output.colors.green(figures.tick) +
|
|
118
|
-
|
|
121
|
+
SPACER +
|
|
119
122
|
output_1.output.formatCommand(task.id) +
|
|
120
123
|
output_1.output.dim(` (${timeTakenText})`));
|
|
121
124
|
if (isVerbose) {
|
|
@@ -124,9 +127,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
124
127
|
break;
|
|
125
128
|
}
|
|
126
129
|
case 'failure':
|
|
130
|
+
output_1.output.addNewline();
|
|
127
131
|
output_1.output.addNewline();
|
|
128
132
|
writeCompletedTaskResultLine(output_1.output.colors.red(figures.cross) +
|
|
129
|
-
|
|
133
|
+
SPACER +
|
|
130
134
|
output_1.output.formatCommand(output_1.output.colors.red(task.id)));
|
|
131
135
|
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
|
|
132
136
|
break;
|
|
@@ -143,10 +147,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
143
147
|
const runningTasks = taskRows.filter((row) => row.status === 'running');
|
|
144
148
|
const remainingTasks = totalTasks - totalCompletedTasks;
|
|
145
149
|
if (runningTasks.length > 0) {
|
|
146
|
-
additionalFooterRows.push(output_1.output.dim(
|
|
150
|
+
additionalFooterRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.cyan(figures.arrowRight)}${SPACER}Executing ${runningTasks.length}/${remainingTasks} remaining tasks${runningTasks.length > 1 ? ' in parallel' : ''}...`));
|
|
147
151
|
additionalFooterRows.push('');
|
|
148
152
|
for (const runningTask of runningTasks) {
|
|
149
|
-
additionalFooterRows.push(
|
|
153
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.dim.cyan(cli_spinners_1.dots.frames[currentFrame])}${SPACER}${output_1.output.formatCommand(runningTask.task.id)}`);
|
|
150
154
|
}
|
|
151
155
|
/**
|
|
152
156
|
* Reduce layout thrashing by ensuring that there is a relatively consistent
|
|
@@ -170,21 +174,20 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
170
174
|
additionalFooterRows.push('');
|
|
171
175
|
}
|
|
172
176
|
if (totalSuccessfulTasks > 0) {
|
|
173
|
-
additionalFooterRows.push(
|
|
177
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
|
|
174
178
|
}
|
|
175
179
|
if (totalFailedTasks > 0) {
|
|
176
|
-
additionalFooterRows.push(
|
|
180
|
+
additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
|
|
177
181
|
}
|
|
178
182
|
moveCursorToStartOfPinnedFooter();
|
|
179
183
|
if (additionalFooterRows.length > 1) {
|
|
180
184
|
const text = `Running ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
|
181
185
|
const taskOverridesRows = [];
|
|
182
186
|
if (Object.keys(overrides).length > 0) {
|
|
183
|
-
const leftPadding = `${output_1.output.X_PADDING} `;
|
|
184
187
|
taskOverridesRows.push('');
|
|
185
|
-
taskOverridesRows.push(`${
|
|
188
|
+
taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.cyan('With additional flags:')}`);
|
|
186
189
|
Object.entries(overrides)
|
|
187
|
-
.map(([flag, value]) => output_1.output.dim.cyan((0, formatting_utils_1.formatFlags)(
|
|
190
|
+
.map(([flag, value]) => output_1.output.dim.cyan((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
188
191
|
.forEach((arg) => taskOverridesRows.push(arg));
|
|
189
192
|
}
|
|
190
193
|
const pinnedFooterLines = [
|
|
@@ -221,11 +224,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
221
224
|
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
|
222
225
|
const taskOverridesRows = [];
|
|
223
226
|
if (Object.keys(overrides).length > 0) {
|
|
224
|
-
const leftPadding = `${output_1.output.X_PADDING} `;
|
|
225
227
|
taskOverridesRows.push('');
|
|
226
|
-
taskOverridesRows.push(`${
|
|
228
|
+
taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
|
227
229
|
Object.entries(overrides)
|
|
228
|
-
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(
|
|
230
|
+
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
229
231
|
.forEach((arg) => taskOverridesRows.push(arg));
|
|
230
232
|
}
|
|
231
233
|
const pinnedFooterLines = [
|
|
@@ -233,7 +235,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
233
235
|
...taskOverridesRows,
|
|
234
236
|
];
|
|
235
237
|
if (totalCachedTasks > 0) {
|
|
236
|
-
pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}
|
|
238
|
+
pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
|
237
239
|
}
|
|
238
240
|
renderPinnedFooter(pinnedFooterLines, 'green');
|
|
239
241
|
}
|
|
@@ -241,11 +243,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
241
243
|
const text = `Ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
|
242
244
|
const taskOverridesRows = [];
|
|
243
245
|
if (Object.keys(overrides).length > 0) {
|
|
244
|
-
const leftPadding = `${output_1.output.X_PADDING} `;
|
|
245
246
|
taskOverridesRows.push('');
|
|
246
|
-
taskOverridesRows.push(`${
|
|
247
|
+
taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
|
247
248
|
Object.entries(overrides)
|
|
248
|
-
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(
|
|
249
|
+
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
249
250
|
.forEach((arg) => taskOverridesRows.push(arg));
|
|
250
251
|
}
|
|
251
252
|
const numFailedToPrint = 5;
|
|
@@ -254,15 +255,16 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
254
255
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
|
255
256
|
...taskOverridesRows,
|
|
256
257
|
'',
|
|
257
|
-
output_1.output.dim(
|
|
258
|
+
output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
|
|
259
|
+
'',
|
|
260
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
|
|
258
261
|
'',
|
|
259
|
-
` ${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
|
|
260
262
|
`${failedTasksForPrinting
|
|
261
|
-
.map((t) =>
|
|
263
|
+
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
262
264
|
.join('\n ')}`,
|
|
263
265
|
];
|
|
264
266
|
if (failedTasks.size > numFailedToPrint) {
|
|
265
|
-
failureSummaryRows.push(output_1.output.dim(
|
|
267
|
+
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
|
266
268
|
}
|
|
267
269
|
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
|
268
270
|
renderPinnedFooter(failureSummaryRows, 'red');
|
|
@@ -314,8 +316,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
314
316
|
}
|
|
315
317
|
exports.createRunManyDynamicOutputRenderer = createRunManyDynamicOutputRenderer;
|
|
316
318
|
function writeCompletedTaskResultLine(line) {
|
|
317
|
-
|
|
318
|
-
output_1.output.overwriteLine(output_1.output.X_PADDING + additionalXPadding + line);
|
|
319
|
+
output_1.output.overwriteLine(LEFT_PAD + line);
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* There's not much we can do in order to "neaten up" the outputs of
|
|
@@ -326,7 +327,6 @@ function writeCompletedTaskResultLine(line) {
|
|
|
326
327
|
function writeCommandOutputBlock(commandOutput) {
|
|
327
328
|
commandOutput = commandOutput || '';
|
|
328
329
|
commandOutput = commandOutput.trimStart();
|
|
329
|
-
const additionalXPadding = ' ';
|
|
330
330
|
const lines = commandOutput.split(os_1.EOL);
|
|
331
331
|
let totalTrailingEmptyLines = 0;
|
|
332
332
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -341,5 +341,5 @@ function writeCommandOutputBlock(commandOutput) {
|
|
|
341
341
|
}
|
|
342
342
|
lines.push('');
|
|
343
343
|
// Indent the command output to make it look more "designed" in the context of the dynamic output
|
|
344
|
-
lines.forEach((l) => output_1.output.overwriteLine(`${
|
|
344
|
+
lines.forEach((l) => output_1.output.overwriteLine(`${EXTENDED_LEFT_PAD}${l}`));
|
|
345
345
|
}
|
|
@@ -9,6 +9,9 @@ const output_1 = require("../../utils/output");
|
|
|
9
9
|
const pretty_time_1 = require("./pretty-time");
|
|
10
10
|
const formatting_utils_1 = require("./formatting-utils");
|
|
11
11
|
const view_logs_utils_1 = require("./view-logs-utils");
|
|
12
|
+
const LEFT_PAD = ` `;
|
|
13
|
+
const SPACER = ` `;
|
|
14
|
+
const EXTENDED_LEFT_PAD = ` `;
|
|
12
15
|
/**
|
|
13
16
|
* The following function is responsible for creating a life cycle with dynamic
|
|
14
17
|
* outputs, meaning previous outputs can be rewritten or modified as new outputs
|
|
@@ -57,7 +60,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
57
60
|
const moveCursorToStartOfDependentTargetLines = () => {
|
|
58
61
|
readline.moveCursor(process.stdout, 0, -dependentTargetsNumLines);
|
|
59
62
|
};
|
|
60
|
-
const renderLines = (lines, dividerColor = 'cyan', renderDivider = true
|
|
63
|
+
const renderLines = (lines, dividerColor = 'cyan', renderDivider = true) => {
|
|
61
64
|
let additionalLines = 0;
|
|
62
65
|
if (renderDivider) {
|
|
63
66
|
const dividerLines = output_1.output.getVerticalSeparatorLines(dividerColor);
|
|
@@ -68,7 +71,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
68
71
|
lines.push('');
|
|
69
72
|
}
|
|
70
73
|
for (const line of lines) {
|
|
71
|
-
output_1.output.overwriteLine(
|
|
74
|
+
output_1.output.overwriteLine(line);
|
|
72
75
|
}
|
|
73
76
|
dependentTargetsNumLines = lines.length + additionalLines;
|
|
74
77
|
// clear any possible text below the cursor's position
|
|
@@ -86,7 +89,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
86
89
|
switch (state) {
|
|
87
90
|
case 'EXECUTING_DEPENDENT_TARGETS':
|
|
88
91
|
if (totalFailedTasks === 0) {
|
|
89
|
-
linesToRender.push(
|
|
92
|
+
linesToRender.push(`${LEFT_PAD}${output_1.output.colors.cyan(cli_spinners_1.dots.frames[dependentTargetsCurrentFrame])}${SPACER}${output_1.output.dim(`Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from`)} ${initiatingProject}${output_1.output.dim('...')}`);
|
|
90
93
|
if (totalSuccessfulTasks > 0) {
|
|
91
94
|
linesToRender.push('');
|
|
92
95
|
}
|
|
@@ -94,14 +97,14 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
94
97
|
break;
|
|
95
98
|
}
|
|
96
99
|
if (totalFailedTasks > 0) {
|
|
97
|
-
linesToRender.push(output_1.output.colors.red.dim(
|
|
100
|
+
linesToRender.push(output_1.output.colors.red.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)`));
|
|
98
101
|
}
|
|
99
102
|
if (totalSuccessfulTasks > 0) {
|
|
100
|
-
linesToRender.push(output_1.output.dim(
|
|
103
|
+
linesToRender.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
|
|
101
104
|
}
|
|
102
105
|
moveCursorToStartOfDependentTargetLines();
|
|
103
106
|
if (linesToRender.length > 1) {
|
|
104
|
-
renderLines(linesToRender, 'gray', renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS'
|
|
107
|
+
renderLines(linesToRender, 'gray', renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS');
|
|
105
108
|
}
|
|
106
109
|
else {
|
|
107
110
|
renderLines([]);
|
|
@@ -120,7 +123,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
120
123
|
renderDependentTargets(false);
|
|
121
124
|
if (totalDependentTasksNotFromInitiatingProject > 0) {
|
|
122
125
|
output_1.output.addNewline();
|
|
123
|
-
process.stdout.write(
|
|
126
|
+
process.stdout.write(`${LEFT_PAD}${output_1.output.dim('Hint: you can run the command with')} --verbose ${output_1.output.dim('to see the full dependent project outputs')}` + os_1.EOL);
|
|
124
127
|
output_1.output.addVerticalSeparator('gray');
|
|
125
128
|
}
|
|
126
129
|
}
|
|
@@ -132,9 +135,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
132
135
|
};
|
|
133
136
|
lifeCycle.printTaskTerminalOutput = (task, cacheStatus, terminalOutput) => {
|
|
134
137
|
if (task.target.project === initiatingProject) {
|
|
135
|
-
output_1.output.
|
|
136
|
-
output_1.output.addNewline();
|
|
137
|
-
process.stdout.write(terminalOutput);
|
|
138
|
+
output_1.output.logCommandOutput(task.id, cacheStatus, terminalOutput);
|
|
138
139
|
}
|
|
139
140
|
else {
|
|
140
141
|
tasksToTerminalOutputs[task.id] = terminalOutput;
|
|
@@ -163,9 +164,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
163
164
|
clearRenderInterval();
|
|
164
165
|
renderDependentTargets(false);
|
|
165
166
|
output_1.output.addVerticalSeparator('red');
|
|
166
|
-
output_1.output.
|
|
167
|
-
output_1.output.addNewline();
|
|
168
|
-
process.stdout.write(tasksToTerminalOutputs[t.task.id]);
|
|
167
|
+
output_1.output.logCommandOutput(t.task.id, t.status, tasksToTerminalOutputs[t.task.id]);
|
|
169
168
|
}
|
|
170
169
|
break;
|
|
171
170
|
}
|
|
@@ -180,11 +179,10 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
180
179
|
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)([initiatingProject], [targetName], tasks)}`;
|
|
181
180
|
const taskOverridesLines = [];
|
|
182
181
|
if (Object.keys(overrides).length > 0) {
|
|
183
|
-
const leftPadding = `${output_1.output.X_PADDING} `;
|
|
184
182
|
taskOverridesLines.push('');
|
|
185
|
-
taskOverridesLines.push(`${
|
|
183
|
+
taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
|
186
184
|
Object.entries(overrides)
|
|
187
|
-
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(
|
|
185
|
+
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
188
186
|
.forEach((arg) => taskOverridesLines.push(arg));
|
|
189
187
|
}
|
|
190
188
|
const pinnedFooterLines = [
|
|
@@ -192,7 +190,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
192
190
|
...taskOverridesLines,
|
|
193
191
|
];
|
|
194
192
|
if (totalCachedTasks > 0) {
|
|
195
|
-
pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}
|
|
193
|
+
pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
|
196
194
|
}
|
|
197
195
|
renderLines(pinnedFooterLines, 'green');
|
|
198
196
|
}
|
|
@@ -204,11 +202,10 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
204
202
|
}
|
|
205
203
|
const taskOverridesLines = [];
|
|
206
204
|
if (Object.keys(overrides).length > 0) {
|
|
207
|
-
const leftPadding = `${output_1.output.X_PADDING} `;
|
|
208
205
|
taskOverridesLines.push('');
|
|
209
|
-
taskOverridesLines.push(`${
|
|
206
|
+
taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
|
210
207
|
Object.entries(overrides)
|
|
211
|
-
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(
|
|
208
|
+
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
|
212
209
|
.forEach((arg) => taskOverridesLines.push(arg));
|
|
213
210
|
}
|
|
214
211
|
const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
|
|
@@ -216,8 +213,8 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
216
213
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
|
|
217
214
|
...taskOverridesLines,
|
|
218
215
|
'',
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
|
|
217
|
+
`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
|
|
221
218
|
...viewLogs,
|
|
222
219
|
], 'red');
|
|
223
220
|
}
|
|
@@ -9,9 +9,7 @@ class EmptyTerminalOutputLifeCycle {
|
|
|
9
9
|
cacheStatus === 'failure' ||
|
|
10
10
|
cacheStatus === 'skipped') {
|
|
11
11
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
12
|
-
output_1.output.
|
|
13
|
-
output_1.output.addNewline();
|
|
14
|
-
process.stdout.write(terminalOutput);
|
|
12
|
+
output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -61,9 +61,7 @@ class InvokeRunnerTerminalOutputLifeCycle {
|
|
|
61
61
|
}
|
|
62
62
|
printTaskTerminalOutput(task, cacheStatus, terminalOutput) {
|
|
63
63
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
64
|
-
output_1.output.
|
|
65
|
-
output_1.output.addNewline();
|
|
66
|
-
process.stdout.write(terminalOutput);
|
|
64
|
+
output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
exports.InvokeRunnerTerminalOutputLifeCycle = InvokeRunnerTerminalOutputLifeCycle;
|
|
@@ -27,7 +27,7 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
27
27
|
output_1.output.logSingleLine(`No projects with ${(0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks)} were run`);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const bodyLines = this.projectNames.map((affectedProject) =>
|
|
30
|
+
const bodyLines = this.projectNames.map((affectedProject) => `${output_1.output.dim('-')} ${affectedProject}`);
|
|
31
31
|
if (Object.keys(this.taskOverrides).length > 0) {
|
|
32
32
|
bodyLines.push('');
|
|
33
33
|
bodyLines.push(`${output_1.output.dim('With additional flags:')}`);
|
|
@@ -93,9 +93,7 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
93
93
|
}
|
|
94
94
|
printTaskTerminalOutput(task, cacheStatus, terminalOutput) {
|
|
95
95
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
96
|
-
output_1.output.
|
|
97
|
-
output_1.output.addNewline();
|
|
98
|
-
process.stdout.write(terminalOutput);
|
|
96
|
+
output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
99
|
exports.StaticRunManyTerminalOutputLifeCycle = StaticRunManyTerminalOutputLifeCycle;
|
|
@@ -19,6 +19,7 @@ export declare class StaticRunOneTerminalOutputLifeCycle implements LifeCycle {
|
|
|
19
19
|
constructor(initiatingProject: string, projectNames: string[], tasks: Task[], args: {
|
|
20
20
|
targets?: string[];
|
|
21
21
|
configuration?: string;
|
|
22
|
+
verbose?: boolean;
|
|
22
23
|
});
|
|
23
24
|
startCommand(): void;
|
|
24
25
|
endCommand(): void;
|
|
@@ -78,13 +78,19 @@ class StaticRunOneTerminalOutputLifeCycle {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
printTaskTerminalOutput(task, status, terminalOutput) {
|
|
81
|
-
|
|
81
|
+
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
82
|
+
if (this.args.verbose ||
|
|
83
|
+
status === 'success' ||
|
|
82
84
|
status === 'failure' ||
|
|
83
85
|
task.target.project === this.initiatingProject) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
output_1.output.logCommandOutput(args.join(' '), status, terminalOutput);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
/**
|
|
90
|
+
* Do not show the terminal output in the case where it is not the initiating project and verbose is not set,
|
|
91
|
+
* but still print the command that was run and its status (so that cache hits can still be traced).
|
|
92
|
+
*/
|
|
93
|
+
output_1.output.logCommandOutput(args.join(' '), status, '');
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
}
|
|
@@ -7,7 +7,7 @@ const output_1 = require("../../utils/output");
|
|
|
7
7
|
const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.`;
|
|
8
8
|
function viewLogsFooterRows(failedTasks) {
|
|
9
9
|
if (failedTasks >= 2 && !(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
10
|
-
return [``, output_1.output.dim(
|
|
10
|
+
return [``, output_1.output.dim(` ${VIEW_LOGS_MESSAGE}`)];
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
return [];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node IPC is specific to Node, but when spawning child processes in Rust, it won't have IPC.
|
|
3
|
+
*
|
|
4
|
+
* Thus, this is a wrapper which is spawned by Rust, which will create a Node IPC channel and pipe it to a ZeroMQ Channel
|
|
5
|
+
*
|
|
6
|
+
* Main Nx Process
|
|
7
|
+
* * Calls Rust Fork Function
|
|
8
|
+
* * `node fork.js`
|
|
9
|
+
* * Create a Rust - Node.js Agnostic Channel aka Pseudo IPC Channel
|
|
10
|
+
* * This returns RustChildProcess
|
|
11
|
+
* * RustChildProcess.onMessage(msg => ());
|
|
12
|
+
* * pseudo_ipc_channel.on_message() => tx.send(msg);
|
|
13
|
+
* * Node.js Fork Wrapper (fork.js)
|
|
14
|
+
* * fork(run-command.js) with `inherit` and `ipc`
|
|
15
|
+
* * This will create a Node IPC Channel
|
|
16
|
+
* * channel = getPseudoIpcChannel(process.env.NX_IPC_CHANNEL_ID)
|
|
17
|
+
* * forkChildProcess.on('message', writeToPseudoIpcChannel)
|
|
18
|
+
*/
|
|
19
|
+
/// <reference types="node" />
|
|
20
|
+
import { Serializable } from 'child_process';
|
|
21
|
+
export interface PseudoIPCMessage {
|
|
22
|
+
type: 'TO_CHILDREN_FROM_PARENT' | 'TO_PARENT_FROM_CHILDREN' | 'CHILD_READY';
|
|
23
|
+
id: string | undefined;
|
|
24
|
+
message: Serializable;
|
|
25
|
+
}
|
|
26
|
+
export declare class PseudoIPCServer {
|
|
27
|
+
private path;
|
|
28
|
+
private sockets;
|
|
29
|
+
private server;
|
|
30
|
+
private childMessages;
|
|
31
|
+
constructor(path: string);
|
|
32
|
+
init(): Promise<void>;
|
|
33
|
+
private childReadyMap;
|
|
34
|
+
waitForChildReady(childId: string): Promise<void>;
|
|
35
|
+
private registerChildMessages;
|
|
36
|
+
sendMessageToChildren(message: Serializable): void;
|
|
37
|
+
sendMessageToChild(id: string, message: Serializable): void;
|
|
38
|
+
onMessageFromChildren(onMessage: (message: Serializable) => void, onClose?: () => void, onError?: (err: Error) => void): void;
|
|
39
|
+
close(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class PseudoIPCClient {
|
|
42
|
+
private path;
|
|
43
|
+
private socket;
|
|
44
|
+
constructor(path: string);
|
|
45
|
+
sendMessageToParent(message: Serializable): void;
|
|
46
|
+
notifyChildIsReady(id: string): void;
|
|
47
|
+
onMessageFromParent(forkId: string, onMessage: (message: Serializable) => void, onClose?: () => void, onError?: (err: Error) => void): this;
|
|
48
|
+
close(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node IPC is specific to Node, but when spawning child processes in Rust, it won't have IPC.
|
|
4
|
+
*
|
|
5
|
+
* Thus, this is a wrapper which is spawned by Rust, which will create a Node IPC channel and pipe it to a ZeroMQ Channel
|
|
6
|
+
*
|
|
7
|
+
* Main Nx Process
|
|
8
|
+
* * Calls Rust Fork Function
|
|
9
|
+
* * `node fork.js`
|
|
10
|
+
* * Create a Rust - Node.js Agnostic Channel aka Pseudo IPC Channel
|
|
11
|
+
* * This returns RustChildProcess
|
|
12
|
+
* * RustChildProcess.onMessage(msg => ());
|
|
13
|
+
* * pseudo_ipc_channel.on_message() => tx.send(msg);
|
|
14
|
+
* * Node.js Fork Wrapper (fork.js)
|
|
15
|
+
* * fork(run-command.js) with `inherit` and `ipc`
|
|
16
|
+
* * This will create a Node IPC Channel
|
|
17
|
+
* * channel = getPseudoIpcChannel(process.env.NX_IPC_CHANNEL_ID)
|
|
18
|
+
* * forkChildProcess.on('message', writeToPseudoIpcChannel)
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PseudoIPCClient = exports.PseudoIPCServer = void 0;
|
|
22
|
+
const net_1 = require("net");
|
|
23
|
+
const consume_messages_from_socket_1 = require("../utils/consume-messages-from-socket");
|
|
24
|
+
class PseudoIPCServer {
|
|
25
|
+
constructor(path) {
|
|
26
|
+
this.path = path;
|
|
27
|
+
this.sockets = new Set();
|
|
28
|
+
this.childMessages = [];
|
|
29
|
+
this.childReadyMap = new Map();
|
|
30
|
+
}
|
|
31
|
+
init() {
|
|
32
|
+
return new Promise((res) => {
|
|
33
|
+
this.server = new net_1.Server((socket) => {
|
|
34
|
+
this.sockets.add(socket);
|
|
35
|
+
this.registerChildMessages(socket);
|
|
36
|
+
socket.on('close', () => {
|
|
37
|
+
this.sockets.delete(socket);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
this.server.listen(this.path, () => {
|
|
41
|
+
res();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async waitForChildReady(childId) {
|
|
46
|
+
return new Promise((res) => {
|
|
47
|
+
this.childReadyMap.set(childId, res);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
registerChildMessages(socket) {
|
|
51
|
+
socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(async (rawMessage) => {
|
|
52
|
+
const { type, message } = JSON.parse(rawMessage);
|
|
53
|
+
if (type === 'TO_PARENT_FROM_CHILDREN') {
|
|
54
|
+
for (const childMessage of this.childMessages) {
|
|
55
|
+
childMessage.onMessage(message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (type === 'CHILD_READY') {
|
|
59
|
+
const childId = message;
|
|
60
|
+
if (this.childReadyMap.has(childId)) {
|
|
61
|
+
this.childReadyMap.get(childId)();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
socket.on('close', () => {
|
|
66
|
+
for (const childMessage of this.childMessages) {
|
|
67
|
+
childMessage.onClose?.();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
socket.on('error', (err) => {
|
|
71
|
+
for (const childMessage of this.childMessages) {
|
|
72
|
+
childMessage.onError?.(err);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
sendMessageToChildren(message) {
|
|
77
|
+
this.sockets.forEach((socket) => {
|
|
78
|
+
socket.write(JSON.stringify({ type: 'TO_CHILDREN_FROM_PARENT', message }));
|
|
79
|
+
// send EOT to indicate that the message has been fully written
|
|
80
|
+
socket.write(String.fromCodePoint(4));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
sendMessageToChild(id, message) {
|
|
84
|
+
this.sockets.forEach((socket) => {
|
|
85
|
+
socket.write(JSON.stringify({ type: 'TO_CHILDREN_FROM_PARENT', id, message }));
|
|
86
|
+
socket.write(String.fromCodePoint(4));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
onMessageFromChildren(onMessage, onClose = () => { }, onError = (err) => { }) {
|
|
90
|
+
this.childMessages.push({
|
|
91
|
+
onMessage,
|
|
92
|
+
onClose,
|
|
93
|
+
onError,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
close() {
|
|
97
|
+
this.server?.close();
|
|
98
|
+
this.sockets.forEach((s) => s.destroy());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.PseudoIPCServer = PseudoIPCServer;
|
|
102
|
+
class PseudoIPCClient {
|
|
103
|
+
constructor(path) {
|
|
104
|
+
this.path = path;
|
|
105
|
+
this.socket = (0, net_1.connect)(this.path);
|
|
106
|
+
}
|
|
107
|
+
sendMessageToParent(message) {
|
|
108
|
+
this.socket.write(JSON.stringify({ type: 'TO_PARENT_FROM_CHILDREN', message }));
|
|
109
|
+
// send EOT to indicate that the message has been fully written
|
|
110
|
+
this.socket.write(String.fromCodePoint(4));
|
|
111
|
+
}
|
|
112
|
+
notifyChildIsReady(id) {
|
|
113
|
+
this.socket.write(JSON.stringify({
|
|
114
|
+
type: 'CHILD_READY',
|
|
115
|
+
message: id,
|
|
116
|
+
}));
|
|
117
|
+
// send EOT to indicate that the message has been fully written
|
|
118
|
+
this.socket.write(String.fromCodePoint(4));
|
|
119
|
+
}
|
|
120
|
+
onMessageFromParent(forkId, onMessage, onClose = () => { }, onError = (err) => { }) {
|
|
121
|
+
this.socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(async (rawMessage) => {
|
|
122
|
+
const { id, type, message } = JSON.parse(rawMessage);
|
|
123
|
+
if (type === 'TO_CHILDREN_FROM_PARENT') {
|
|
124
|
+
if (id && id === forkId) {
|
|
125
|
+
onMessage(message);
|
|
126
|
+
}
|
|
127
|
+
else if (id === undefined) {
|
|
128
|
+
onMessage(message);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
this.socket.on('close', onClose);
|
|
133
|
+
this.socket.on('error', onError);
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
close() {
|
|
137
|
+
this.socket?.destroy();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.PseudoIPCClient = PseudoIPCClient;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ChildProcess, RustPseudoTerminal } from '../native';
|
|
3
|
+
import { PseudoIPCServer } from './pseudo-ipc';
|
|
4
|
+
import { Serializable } from 'child_process';
|
|
5
|
+
export declare function getPseudoTerminal(skipSupportCheck?: boolean): PseudoTerminal;
|
|
6
|
+
export declare class PseudoTerminal {
|
|
7
|
+
private rustPseudoTerminal;
|
|
8
|
+
private pseudoIPCPath;
|
|
9
|
+
private pseudoIPC;
|
|
10
|
+
private initialized;
|
|
11
|
+
static isSupported(): boolean;
|
|
12
|
+
constructor(rustPseudoTerminal: RustPseudoTerminal);
|
|
13
|
+
init(): Promise<void>;
|
|
14
|
+
runCommand(command: string, { cwd, jsEnv, quiet, }?: {
|
|
15
|
+
cwd?: string;
|
|
16
|
+
jsEnv?: Record<string, string>;
|
|
17
|
+
quiet?: boolean;
|
|
18
|
+
}): PseudoTtyProcess;
|
|
19
|
+
fork(id: string, script: string, { cwd, jsEnv, quiet, }: {
|
|
20
|
+
cwd?: string;
|
|
21
|
+
jsEnv?: Record<string, string>;
|
|
22
|
+
quiet?: boolean;
|
|
23
|
+
}): Promise<PseudoTtyProcessWithSend>;
|
|
24
|
+
sendMessageToChildren(message: Serializable): void;
|
|
25
|
+
onMessageFromChildren(callback: (message: Serializable) => void): void;
|
|
26
|
+
private setupProcessListeners;
|
|
27
|
+
private shutdownPseudoIPC;
|
|
28
|
+
}
|
|
29
|
+
export declare class PseudoTtyProcess {
|
|
30
|
+
private childProcess;
|
|
31
|
+
isAlive: boolean;
|
|
32
|
+
exitCallbacks: any[];
|
|
33
|
+
constructor(childProcess: ChildProcess);
|
|
34
|
+
onExit(callback: (code: number) => void): void;
|
|
35
|
+
onOutput(callback: (message: string) => void): void;
|
|
36
|
+
kill(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare class PseudoTtyProcessWithSend extends PseudoTtyProcess {
|
|
39
|
+
private id;
|
|
40
|
+
private pseudoIpc;
|
|
41
|
+
constructor(_childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer);
|
|
42
|
+
send(message: Serializable): void;
|
|
43
|
+
}
|