nx 23.2.0-beta.0 → 23.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +3 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -10
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +5 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +12 -17
- package/dist/src/command-line/init/command-object.js +14 -4
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +40 -57
- package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
- package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +30 -32
- package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
- package/dist/src/command-line/migrate/agentic/types.js +35 -0
- package/dist/src/command-line/migrate/command-object.d.ts +6 -0
- package/dist/src/command-line/migrate/command-object.js +19 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +91 -0
- package/dist/src/command-line/migrate/execute-migration.js +474 -0
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
- package/dist/src/command-line/migrate/migrate-commits.js +130 -15
- package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
- package/dist/src/command-line/migrate/migrate-config.js +22 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +33 -19
- package/dist/src/command-line/migrate/migrate.d.ts +29 -113
- package/dist/src/command-line/migrate/migrate.js +666 -664
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -0
- package/dist/src/command-line/migrate/run/index.js +23 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +59 -0
- package/dist/src/command-line/migrate/run/util.js +148 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
- package/dist/src/command-line/migrate/run/worker.js +682 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +11 -17
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/publish.js +5 -0
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +20 -2
- package/dist/src/command-line/release/utils/release-graph.js +81 -21
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +10 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +5 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -1
- package/dist/src/daemon/client/client.js +160 -36
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +105 -8
- package/dist/src/devkit-internals.js +223 -7
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +37 -4
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
- package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +27 -2
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
- package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
- package/dist/src/tasks-runner/life-cycle.js +2 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +9 -4
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +28 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +117 -30
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +28 -35
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
- package/dist/src/tasks-runner/task-orchestrator.js +182 -18
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.js +7 -5
- package/dist/src/utils/analytics-enabled.d.ts +7 -0
- package/dist/src/utils/analytics-enabled.js +11 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +4 -58
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +48 -2
- package/dist/src/utils/git-utils.js +220 -14
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/output.d.ts +153 -0
- package/dist/src/utils/output.js +289 -5
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +268 -44
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/migrations.json +6 -0
- package/package.json +29 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -29,15 +29,20 @@ export interface Timespan {
|
|
|
29
29
|
/** `parallelism: false` tasks running during the slice (each one holds every slot). */
|
|
30
30
|
nonParallel: number;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A task and how long it ran (ms). The unit the report's task lists are built from —
|
|
34
|
+
* shared with the renderers so the producer and the formatters can't drift.
|
|
35
|
+
*/
|
|
36
|
+
export interface TaskDurationRow {
|
|
37
|
+
id: string;
|
|
38
|
+
duration: number;
|
|
39
|
+
}
|
|
32
40
|
export interface PerformanceSummary {
|
|
33
41
|
runDuration: number;
|
|
34
42
|
criticalPathDuration: number;
|
|
35
43
|
criticalPathTaskCount: number;
|
|
36
44
|
/** Longest critical-path tasks that ran (desc, capped at a few), cache hits excluded; empty when the path was fully cached. */
|
|
37
|
-
criticalPathTop:
|
|
38
|
-
id: string;
|
|
39
|
-
duration: number;
|
|
40
|
-
}>;
|
|
45
|
+
criticalPathTop: TaskDurationRow[];
|
|
41
46
|
/** Ids of tasks that failed (slowest first), for the GitHub Actions summary's failed-tasks list. Continuous tasks and tasks without a complete window are excluded. */
|
|
42
47
|
failedTasks: string[];
|
|
43
48
|
/** runDuration − criticalPathDuration. */
|
|
@@ -142,8 +142,9 @@ function flushPerformanceReport() {
|
|
|
142
142
|
// restore_terminal cooks the terminal back post-TUI, so console.log's plain \n
|
|
143
143
|
// renders fine; it also supplies the single trailing newline formatReport omits.
|
|
144
144
|
console.log((0, performance_report_1.formatReport)(summary));
|
|
145
|
-
// In GitHub Actions, also append the report
|
|
146
|
-
//
|
|
145
|
+
// In GitHub Actions, also append the report to the job summary page — the same stats
|
|
146
|
+
// as above, led by the run's outcome (a failed-tasks list, or a success line).
|
|
147
|
+
// Independent of the console.log above so neither masks the other.
|
|
147
148
|
writePerformanceReportToGitHubActions(summary);
|
|
148
149
|
}
|
|
149
150
|
catch (e) {
|
|
@@ -157,8 +158,8 @@ function flushPerformanceReport() {
|
|
|
157
158
|
/**
|
|
158
159
|
* Append the performance report to the GitHub Actions job summary page when running in
|
|
159
160
|
* Actions (`$GITHUB_STEP_SUMMARY` is set there and nowhere else). No-op otherwise. The
|
|
160
|
-
*
|
|
161
|
-
* write failure must never affect the run.
|
|
161
|
+
* Markdown is rendered below the guard, so non-CI runs don't pay to format a report
|
|
162
|
+
* nothing reads. Best-effort: a write failure must never affect the run.
|
|
162
163
|
*
|
|
163
164
|
* Skipped for a nested run (one nx command invoked by another nx task's command), so only
|
|
164
165
|
* the outermost run writes to the summary. Nx sets `NX_TASK_TARGET_PROJECT` on every task's
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { PerformanceSummaryPayload } from '../../native';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NxJsonConfiguration } from '../../config/nx-json';
|
|
3
|
+
import type { PerformanceSummary, TaskDurationRow } from './performance-analysis';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Point the remote-cache CTA at a short Nx Cloud onboarding URL for a
|
|
6
|
+
* disconnected GitHub workspace - the VCS flow where Cloud opens the nx.json PR.
|
|
7
|
+
* Non-GitHub remotes keep the get-started link (handles every provider) and skip
|
|
8
|
+
* the network entirely. Runs in CI too - terminal + job summary.
|
|
9
|
+
*
|
|
10
|
+
* Best-effort: the get-started link stays on failure/timeout. Fired at run start;
|
|
11
|
+
* the CTA needs a >30s run (MIN_RECOMMENDATION_RUN_DURATION), so the fetch
|
|
12
|
+
* always resolves first.
|
|
13
|
+
*/
|
|
14
|
+
export declare function prefetchRemoteCacheOnboardingUrl(nxJson: NxJsonConfiguration): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* A recommendation built from structured parts so the link text comes from the link
|
|
17
|
+
* definition (not a substring scanned out of the assembled report). A part is literal
|
|
18
|
+
* text, a {@link RecLink}, or a {@link RecTaskRows}, projected to each output string by
|
|
19
|
+
* {@link renderRecommendation}.
|
|
20
|
+
*
|
|
21
|
+
* String parts must be single-line — multi-line content needs its own structured part (as
|
|
22
|
+
* {@link RecTaskRows} is). TS can't enforce this: `string` is already a handled member, so
|
|
23
|
+
* a multi-line one compiles and then breaks the Markdown nested list.
|
|
8
24
|
*/
|
|
9
|
-
type RecPart = string | RecLink;
|
|
25
|
+
type RecPart = string | RecLink | RecTaskRows;
|
|
10
26
|
export type Recommendation = RecPart[];
|
|
11
27
|
/**
|
|
12
28
|
* A docs link inside a recommendation: a sentence is the visible text and the whole of
|
|
@@ -15,11 +31,15 @@ export type Recommendation = RecPart[];
|
|
|
15
31
|
* re-links the phrase from {@link PerformanceSummaryPayload.links}.
|
|
16
32
|
*/
|
|
17
33
|
interface RecLink {
|
|
18
|
-
/** Visible label: the sentence that links. */
|
|
19
34
|
visible: string;
|
|
20
|
-
/** OSC 8 click target / appended URL: the utm-tagged URL. */
|
|
21
35
|
href: string;
|
|
22
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The critical path's longest tasks as data, so each renderer formats them natively:
|
|
39
|
+
* the terminal and payload as space-aligned columns, Markdown as a nested list
|
|
40
|
+
* (HTML collapses space runs, so aligned columns don't survive rendering there).
|
|
41
|
+
*/
|
|
42
|
+
type RecTaskRows = TaskDurationRow[];
|
|
23
43
|
/**
|
|
24
44
|
* The recommendation string the napi payload ships and the Rust popup matches against.
|
|
25
45
|
* Links are URL-less (the popup re-links them from {@link PerformanceSummaryPayload.links}).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MEANINGFUL_OVERHEAD = exports.MIN_RECOMMENDATION_RUN_DURATION = void 0;
|
|
4
|
+
exports.prefetchRemoteCacheOnboardingUrl = prefetchRemoteCacheOnboardingUrl;
|
|
4
5
|
exports.recommendationToPayloadString = recommendationToPayloadString;
|
|
5
6
|
exports.buildRecommendations = buildRecommendations;
|
|
6
7
|
exports.formatReport = formatReport;
|
|
@@ -8,14 +9,72 @@ exports.formatReportMarkdown = formatReportMarkdown;
|
|
|
8
9
|
exports.buildExitSummaryPayload = buildExitSummaryPayload;
|
|
9
10
|
const native_1 = require("../../native");
|
|
10
11
|
const terminal_link_1 = require("../../utils/terminal-link");
|
|
12
|
+
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
|
13
|
+
const url_shorten_1 = require("../../nx-cloud/utilities/url-shorten");
|
|
14
|
+
const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
|
|
15
|
+
const git_utils_1 = require("../../utils/git-utils");
|
|
16
|
+
const logger_1 = require("../../utils/logger");
|
|
11
17
|
const NX_AGENTS_URL = 'https://nx.dev/ci/features/distribute-task-execution';
|
|
12
|
-
|
|
18
|
+
// Fallback for the remote-cache CTA when the short onboarding URL can't be
|
|
19
|
+
// fetched: the generic Cloud get-started page (still drives to onboarding).
|
|
20
|
+
const NX_CLOUD_GET_STARTED_URL = 'https://cloud.nx.app/get-started';
|
|
13
21
|
const NX_PERFORMANCE_URL = 'https://nx.dev/docs/concepts/ci-concepts/parallelization-distribution';
|
|
14
22
|
/** utm tag attributing report clicks back to it; the content names the CTA clicked. */
|
|
15
23
|
const utm = (content) => `?utm_source=nx-cli&utm_medium=cli&utm_campaign=performance-report&utm_content=${content}`;
|
|
16
24
|
const NX_PERFORMANCE_LINK = `${NX_PERFORMANCE_URL}${utm('parallelization')}`;
|
|
17
25
|
const NX_AGENTS_LINK = `${NX_AGENTS_URL}${utm('nx-agents')}`;
|
|
18
|
-
const NX_REMOTE_CACHE_LINK = `${
|
|
26
|
+
const NX_REMOTE_CACHE_LINK = `${NX_CLOUD_GET_STARTED_URL}${utm('remote-cache')}`;
|
|
27
|
+
// Defaults to the get-started link; a disconnected workspace gets a short Nx
|
|
28
|
+
// Cloud onboarding URL instead (see prefetchRemoteCacheOnboardingUrl).
|
|
29
|
+
let remoteCacheLink = NX_REMOTE_CACHE_LINK;
|
|
30
|
+
// Give up on the short URL after this long so a slow/hung Cloud API never
|
|
31
|
+
// lingers past the exit report. Covers two sequential round trips (features
|
|
32
|
+
// GET, onboarding POST); the 30s CTA floor leaves room. Timing out also aborts
|
|
33
|
+
// the request - Promise.race alone would leave the socket holding the event
|
|
34
|
+
// loop open, which strands programmatic callers that never process.exit.
|
|
35
|
+
const ONBOARDING_URL_TIMEOUT = 5000;
|
|
36
|
+
/**
|
|
37
|
+
* Point the remote-cache CTA at a short Nx Cloud onboarding URL for a
|
|
38
|
+
* disconnected GitHub workspace - the VCS flow where Cloud opens the nx.json PR.
|
|
39
|
+
* Non-GitHub remotes keep the get-started link (handles every provider) and skip
|
|
40
|
+
* the network entirely. Runs in CI too - terminal + job summary.
|
|
41
|
+
*
|
|
42
|
+
* Best-effort: the get-started link stays on failure/timeout. Fired at run start;
|
|
43
|
+
* the CTA needs a >30s run (MIN_RECOMMENDATION_RUN_DURATION), so the fetch
|
|
44
|
+
* always resolves first.
|
|
45
|
+
*/
|
|
46
|
+
async function prefetchRemoteCacheOnboardingUrl(nxJson) {
|
|
47
|
+
if ((0, nx_cloud_utils_1.isNxCloudDisabled)(nxJson) || (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if ((0, git_utils_1.getVcsRemoteInfo)()?.domain !== 'github.com') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const abortController = new AbortController();
|
|
54
|
+
try {
|
|
55
|
+
const url = await Promise.race([
|
|
56
|
+
(0, url_shorten_1.createNxCloudOnboardingURL)('nx-cli-perf-report', undefined, undefined, false, false, undefined, abortController.signal),
|
|
57
|
+
new Promise((resolve) => {
|
|
58
|
+
// unref so the pending timer never keeps the CLI alive on its own.
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
abortController.abort();
|
|
61
|
+
resolve(null);
|
|
62
|
+
}, ONBOARDING_URL_TIMEOUT).unref();
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
// createNxCloudOnboardingURL never throws - on an unreachable API it returns a
|
|
66
|
+
// paste-a-token URL (accessToken=undefined). Only accept a real short link.
|
|
67
|
+
if (url?.startsWith(`${(0, get_cloud_options_1.getCloudUrl)()}/connect/`)) {
|
|
68
|
+
remoteCacheLink = url;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
logger_1.logger.verbose(`Keeping the get-started remote-cache link (${url === null ? 'onboarding URL timed out' : `got: ${url}`})`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
logger_1.logger.verbose(`Keeping the get-started remote-cache link: ${e}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
19
78
|
/**
|
|
20
79
|
* Whole-phrase CTA: the whole sentence is the link. The Rust TUI popup keeps no
|
|
21
80
|
* copy of this string; it gets the phrase + href from the exit payload's `links`.
|
|
@@ -25,15 +84,49 @@ const NX_DISTRIBUTE_CTA = 'Distribute across machines with Nx Agents';
|
|
|
25
84
|
function phraseLink(phrase, taggedUrl) {
|
|
26
85
|
return { visible: phrase, href: taggedUrl };
|
|
27
86
|
}
|
|
87
|
+
// Discriminate positively — test for what each part *is*. A `!isRecTaskRows` catch-all
|
|
88
|
+
// would misclassify a future `RecPart` member as a link; TS can't catch that (it never
|
|
89
|
+
// checks a predicate body), so `recommendationLinks`' `.filter(isRecLink)` would ship
|
|
90
|
+
// `{text: undefined, href: undefined}` to the popup.
|
|
28
91
|
function isRecLink(part) {
|
|
29
|
-
return typeof part !== 'string';
|
|
92
|
+
return typeof part !== 'string' && 'href' in part;
|
|
93
|
+
}
|
|
94
|
+
function isRecTaskRows(part) {
|
|
95
|
+
return Array.isArray(part);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Project a recommendation to a string, formatting each non-text part with the caller's
|
|
99
|
+
* renderers. The three output targets (payload, terminal, Markdown) share this one dispatch.
|
|
100
|
+
* After the string and task-rows branches a part is a {@link RecLink}, so `render.link`
|
|
101
|
+
* takes it directly — and a new {@link RecPart} member that is neither would fail to satisfy
|
|
102
|
+
* that `RecLink` parameter, turning "forgot to handle it" into a compile error right here.
|
|
103
|
+
*/
|
|
104
|
+
function renderRecommendation(rec, render) {
|
|
105
|
+
return rec
|
|
106
|
+
.map((part) => {
|
|
107
|
+
if (typeof part === 'string') {
|
|
108
|
+
return part;
|
|
109
|
+
}
|
|
110
|
+
if (isRecTaskRows(part)) {
|
|
111
|
+
return render.taskRows(part);
|
|
112
|
+
}
|
|
113
|
+
return render.link(part);
|
|
114
|
+
})
|
|
115
|
+
.join('');
|
|
30
116
|
}
|
|
31
117
|
/**
|
|
32
118
|
* The recommendation string the napi payload ships and the Rust popup matches against.
|
|
33
119
|
* Links are URL-less (the popup re-links them from {@link PerformanceSummaryPayload.links}).
|
|
34
120
|
*/
|
|
35
121
|
function recommendationToPayloadString(rec) {
|
|
36
|
-
return rec
|
|
122
|
+
return renderRecommendation(rec, {
|
|
123
|
+
link: (link) => link.visible,
|
|
124
|
+
taskRows: taskRowsToText,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/** Task rows as the text block the terminal and payload embed: newline-led, space-aligned columns. */
|
|
128
|
+
function taskRowsToText(tasks) {
|
|
129
|
+
return ['', ...formatTopTaskRows(tasks)].join('\n');
|
|
37
130
|
}
|
|
38
131
|
/**
|
|
39
132
|
* The recommendation as a terminal string. With OSC 8 the phrase becomes a hyperlink
|
|
@@ -42,16 +135,12 @@ function recommendationToPayloadString(rec) {
|
|
|
42
135
|
* are off.
|
|
43
136
|
*/
|
|
44
137
|
function recommendationToTerminalString(rec, hyperlinks) {
|
|
45
|
-
return rec
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
? (0, terminal_link_1.terminalLink)(part.visible, part.href)
|
|
52
|
-
: `${part.visible} → ${part.href}`;
|
|
53
|
-
})
|
|
54
|
-
.join('');
|
|
138
|
+
return renderRecommendation(rec, {
|
|
139
|
+
link: (link) => hyperlinks
|
|
140
|
+
? (0, terminal_link_1.terminalLink)(link.visible, link.href)
|
|
141
|
+
: `${link.visible} → ${link.href}`,
|
|
142
|
+
taskRows: taskRowsToText,
|
|
143
|
+
});
|
|
55
144
|
}
|
|
56
145
|
/** The popup links (phrase + href) for every link in a recommendation list, for OSC 8 re-linking. */
|
|
57
146
|
function recommendationLinks(recommendations) {
|
|
@@ -77,7 +166,8 @@ function recoverableTime(s) {
|
|
|
77
166
|
}
|
|
78
167
|
/** Render the longest critical-path tasks as aligned columns: task (left), duration (right). */
|
|
79
168
|
function formatTopTaskRows(tasks) {
|
|
80
|
-
//
|
|
169
|
+
// Non-empty by construction: the only recommendation carrying task rows requires
|
|
170
|
+
// `criticalPathTop.length > 0` to apply, so no empty array reaches the widths below.
|
|
81
171
|
const idWidth = Math.max(...tasks.map((t) => t.id.length));
|
|
82
172
|
const durations = tasks.map((t) => (0, native_1.formatDuration)(t.duration));
|
|
83
173
|
const durWidth = Math.max(...durations.map((d) => d.length));
|
|
@@ -145,7 +235,7 @@ const RECOMMENDATIONS = [
|
|
|
145
235
|
c.cacheableCount > 0 &&
|
|
146
236
|
!c.remoteCacheEnabled &&
|
|
147
237
|
c.cacheHits / c.cacheableCount <= LOW_CACHE_HIT_RATE,
|
|
148
|
-
build: () => [phraseLink(NX_REMOTE_CACHE_CTA,
|
|
238
|
+
build: () => [phraseLink(NX_REMOTE_CACHE_CTA, remoteCacheLink), `.`],
|
|
149
239
|
},
|
|
150
240
|
{
|
|
151
241
|
// Cache skipped: drop the flag to restore unchanged tasks instantly.
|
|
@@ -172,10 +262,8 @@ const RECOMMENDATIONS = [
|
|
|
172
262
|
// only multi-line rec). Nothing ran (fully cached) → it doesn't apply.
|
|
173
263
|
isApplicable: (c) => criticalPathBound(c) && c.criticalPathTop.length > 0,
|
|
174
264
|
build: (c) => [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
...formatTopTaskRows(c.criticalPathTop),
|
|
178
|
-
].join('\n'),
|
|
265
|
+
`Speed up or split the longest tasks on the critical path:`,
|
|
266
|
+
c.criticalPathTop,
|
|
179
267
|
],
|
|
180
268
|
},
|
|
181
269
|
];
|
|
@@ -261,18 +349,17 @@ function formatReport(s) {
|
|
|
261
349
|
}
|
|
262
350
|
/**
|
|
263
351
|
* A recommendation as Markdown: every link becomes `[phrase](href)` (no OSC 8, unlike the
|
|
264
|
-
* terminal renderer) — the whole sentence reads as prose and is the link text.
|
|
265
|
-
*
|
|
266
|
-
*
|
|
352
|
+
* terminal renderer) — the whole sentence reads as prose and is the link text. Task rows
|
|
353
|
+
* become a nested list under the recommendation's bullet (space-aligned columns don't
|
|
354
|
+
* survive HTML's whitespace collapsing).
|
|
267
355
|
*/
|
|
268
356
|
function recommendationToMarkdownString(rec) {
|
|
269
|
-
return rec
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
.join('<br>');
|
|
357
|
+
return renderRecommendation(rec, {
|
|
358
|
+
link: (link) => `[${link.visible}](${link.href})`,
|
|
359
|
+
taskRows: (rows) => rows
|
|
360
|
+
.map((t) => `\n - \`${t.id}\` — ${(0, native_1.formatDuration)(t.duration)}`)
|
|
361
|
+
.join(''),
|
|
362
|
+
});
|
|
276
363
|
}
|
|
277
364
|
/**
|
|
278
365
|
* The performance report as GitHub-flavored Markdown for the Actions job summary
|
|
@@ -16,14 +16,39 @@ export declare class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
|
|
16
16
|
private readonly taskOverrides;
|
|
17
17
|
failedTasks: Task[];
|
|
18
18
|
cachedTasks: Task[];
|
|
19
|
+
stoppedTasks: Task[];
|
|
19
20
|
allCompletedTasks: Map<string, Task>;
|
|
21
|
+
private collapsedTasks;
|
|
22
|
+
/** Stopped tasks that produced output; a batch-stopped task has none. */
|
|
23
|
+
private stoppedTasksWithOutput;
|
|
20
24
|
constructor(projectNames: string[], tasks: Task[], args: {
|
|
21
25
|
targets?: string[];
|
|
22
26
|
configuration?: string;
|
|
27
|
+
verbose?: boolean;
|
|
28
|
+
outputStyle?: string;
|
|
23
29
|
}, taskOverrides: any);
|
|
24
30
|
startCommand(): void;
|
|
25
31
|
endCommand(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Tasks with a `skipped` status are never reported through `endTasks`, so
|
|
34
|
+
* they are derived by subtracting everything that did complete.
|
|
35
|
+
*/
|
|
26
36
|
private skippedTasks;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this run prints every task's output in full rather than collapsing
|
|
39
|
+
* the ones that succeeded.
|
|
40
|
+
*/
|
|
41
|
+
private get printsFullOutput();
|
|
42
|
+
/**
|
|
43
|
+
* Tells the reader that output was withheld, so a task that succeeded while
|
|
44
|
+
* printing something worth reading is not silently swallowed.
|
|
45
|
+
*/
|
|
46
|
+
private hiddenOutputHint;
|
|
47
|
+
/**
|
|
48
|
+
* Tasks that never produced output worth printing are summarized as counts,
|
|
49
|
+
* with their names available behind --verbose.
|
|
50
|
+
*/
|
|
51
|
+
private tasksNotRunSummary;
|
|
27
52
|
endTasks(taskResults: TaskResult[]): void;
|
|
28
|
-
printTaskTerminalOutput(task: Task,
|
|
53
|
+
printTaskTerminalOutput(task: Task, taskStatus: TaskStatus, terminalOutput: string): void;
|
|
29
54
|
}
|
|
@@ -20,7 +20,11 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
20
20
|
this.taskOverrides = taskOverrides;
|
|
21
21
|
this.failedTasks = [];
|
|
22
22
|
this.cachedTasks = [];
|
|
23
|
+
this.stoppedTasks = [];
|
|
23
24
|
this.allCompletedTasks = new Map();
|
|
25
|
+
this.collapsedTasks = 0;
|
|
26
|
+
/** Stopped tasks that produced output; a batch-stopped task has none. */
|
|
27
|
+
this.stoppedTasksWithOutput = 0;
|
|
24
28
|
}
|
|
25
29
|
startCommand() {
|
|
26
30
|
if (this.tasks.length === 0) {
|
|
@@ -55,13 +59,18 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
55
59
|
output_1.output.logSingleLine(`No tasks were run`);
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
// A stopped task was killed mid-flight, so the run did not complete even
|
|
63
|
+
// though nothing outright failed. `didCommandComplete` already treats it
|
|
64
|
+
// that way; reporting "Successfully ran" here would contradict it.
|
|
65
|
+
if (this.failedTasks.length === 0 && this.stoppedTasks.length === 0) {
|
|
59
66
|
output_1.output.addVerticalSeparatorWithoutNewLines('green');
|
|
60
67
|
const bodyLines = this.cachedTasks.length > 0
|
|
61
68
|
? [
|
|
62
69
|
output_1.output.dim(`Nx read the output from the cache instead of running the command for ${this.cachedTasks.length} out of ${this.tasks.length} tasks.`),
|
|
63
70
|
]
|
|
64
71
|
: [];
|
|
72
|
+
bodyLines.push(...this.tasksNotRunSummary());
|
|
73
|
+
bodyLines.push(...this.hiddenOutputHint());
|
|
65
74
|
output_1.output.success({
|
|
66
75
|
title: `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks)}`,
|
|
67
76
|
bodyLines,
|
|
@@ -74,22 +83,95 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
74
83
|
if (skippedTasks.length > 0) {
|
|
75
84
|
bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed or --nx-bail=true:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
76
85
|
}
|
|
77
|
-
|
|
86
|
+
if (this.stoppedTasks.length > 0) {
|
|
87
|
+
bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
88
|
+
}
|
|
89
|
+
if (this.failedTasks.length > 0) {
|
|
90
|
+
bodyLines.push(output_1.output.dim('Failed tasks:'), '', ...[...this.failedTasks.values()].map((task) => `${output_1.output.dim('-')} ${task.id}`));
|
|
91
|
+
}
|
|
92
|
+
bodyLines.push(...this.hiddenOutputHint());
|
|
93
|
+
const targets = (0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks);
|
|
78
94
|
output_1.output.error({
|
|
79
|
-
title:
|
|
95
|
+
title: this.failedTasks.length > 0
|
|
96
|
+
? `Running ${targets} failed`
|
|
97
|
+
: `Running ${targets} did not complete`,
|
|
80
98
|
bodyLines,
|
|
81
99
|
});
|
|
82
100
|
}
|
|
83
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Tasks with a `skipped` status are never reported through `endTasks`, so
|
|
104
|
+
* they are derived by subtracting everything that did complete.
|
|
105
|
+
*/
|
|
84
106
|
skippedTasks() {
|
|
85
107
|
return this.tasks.filter((t) => !this.allCompletedTasks.has(t.id));
|
|
86
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Whether this run prints every task's output in full rather than collapsing
|
|
111
|
+
* the ones that succeeded.
|
|
112
|
+
*/
|
|
113
|
+
get printsFullOutput() {
|
|
114
|
+
return (0, output_1.printsFullTaskOutput)(this.args);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Tells the reader that output was withheld, so a task that succeeded while
|
|
118
|
+
* printing something worth reading is not silently swallowed.
|
|
119
|
+
*/
|
|
120
|
+
hiddenOutputHint() {
|
|
121
|
+
const withheld = [];
|
|
122
|
+
if (this.collapsedTasks > 0) {
|
|
123
|
+
withheld.push(`${this.collapsedTasks} successful ${this.collapsedTasks === 1 ? 'task' : 'tasks'}`);
|
|
124
|
+
}
|
|
125
|
+
// A stopped task's partial output is what diagnoses a hang, and it is
|
|
126
|
+
// dropped by default, so say so even when nothing collapsed.
|
|
127
|
+
if (this.stoppedTasksWithOutput > 0) {
|
|
128
|
+
withheld.push(`${this.stoppedTasksWithOutput} stopped ${this.stoppedTasksWithOutput === 1 ? 'task' : 'tasks'}`);
|
|
129
|
+
}
|
|
130
|
+
if (this.printsFullOutput || withheld.length === 0) {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
const total = this.collapsedTasks + this.stoppedTasksWithOutput;
|
|
134
|
+
return [
|
|
135
|
+
'',
|
|
136
|
+
`${output_1.output.dim(`Output of ${withheld.join(' and ')} ${total === 1 && withheld.length === 1 ? 'was' : 'were'} not shown. Run with`)} --verbose ${output_1.output.dim('or')} --output-style=static ${output_1.output.dim('to see it.')}`,
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Tasks that never produced output worth printing are summarized as counts,
|
|
141
|
+
* with their names available behind --verbose.
|
|
142
|
+
*/
|
|
143
|
+
tasksNotRunSummary() {
|
|
144
|
+
const skippedTasks = this.skippedTasks();
|
|
145
|
+
const counts = [];
|
|
146
|
+
if (skippedTasks.length > 0) {
|
|
147
|
+
counts.push(`${skippedTasks.length} skipped`);
|
|
148
|
+
}
|
|
149
|
+
if (this.stoppedTasks.length > 0) {
|
|
150
|
+
counts.push(`${this.stoppedTasks.length} stopped`);
|
|
151
|
+
}
|
|
152
|
+
if (counts.length === 0) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
const lines = [output_1.output.dim(counts.join(', '))];
|
|
156
|
+
if (this.printsFullOutput) {
|
|
157
|
+
lines.push('', ...[...skippedTasks, ...this.stoppedTasks].map((task) => `${output_1.output.dim('-')} ${task.id}`));
|
|
158
|
+
}
|
|
159
|
+
return lines;
|
|
160
|
+
}
|
|
87
161
|
endTasks(taskResults) {
|
|
88
162
|
for (let t of taskResults) {
|
|
89
163
|
this.allCompletedTasks.set(t.task.id, t.task);
|
|
90
164
|
if (t.status === 'failure') {
|
|
91
165
|
this.failedTasks.push(t.task);
|
|
92
166
|
}
|
|
167
|
+
else if (t.status === 'stopped') {
|
|
168
|
+
this.stoppedTasks.push(t.task);
|
|
169
|
+
// A batch-stopped task is reported with no output at all, so counting
|
|
170
|
+
// it would have the hint promise something --verbose cannot show.
|
|
171
|
+
if (t.terminalOutput) {
|
|
172
|
+
this.stoppedTasksWithOutput++;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
93
175
|
else if (t.status === 'local-cache') {
|
|
94
176
|
this.cachedTasks.push(t.task);
|
|
95
177
|
}
|
|
@@ -101,9 +183,21 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
101
183
|
}
|
|
102
184
|
}
|
|
103
185
|
}
|
|
104
|
-
printTaskTerminalOutput(task,
|
|
186
|
+
printTaskTerminalOutput(task, taskStatus, terminalOutput) {
|
|
105
187
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
106
|
-
|
|
188
|
+
if (this.printsFullOutput || taskStatus === 'failure') {
|
|
189
|
+
// A stopped task was killed part way through; under --verbose or
|
|
190
|
+
// --output-style=static its partial output is shown, which is what
|
|
191
|
+
// diagnoses a hang. It is dropped on the default path below.
|
|
192
|
+
output_1.output.logCommandOutput(args.join(' '), taskStatus, terminalOutput);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// Named in the end of run summary instead; output not shown by default.
|
|
196
|
+
if (taskStatus === 'skipped' || taskStatus === 'stopped') {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.collapsedTasks++;
|
|
200
|
+
output_1.output.logCommandSummary(args.join(' '), taskStatus);
|
|
107
201
|
}
|
|
108
202
|
}
|
|
109
203
|
exports.StaticRunManyTerminalOutputLifeCycle = StaticRunManyTerminalOutputLifeCycle;
|
|
@@ -16,13 +16,39 @@ export declare class StaticRunOneTerminalOutputLifeCycle implements LifeCycle {
|
|
|
16
16
|
private readonly args;
|
|
17
17
|
failedTasks: Task[];
|
|
18
18
|
cachedTasks: Task[];
|
|
19
|
+
stoppedTasks: Task[];
|
|
20
|
+
allCompletedTasks: Map<string, Task>;
|
|
21
|
+
private collapsedTasks;
|
|
22
|
+
/** Stopped tasks that produced output; a batch-stopped task has none. */
|
|
23
|
+
private stoppedTasksWithOutput;
|
|
19
24
|
constructor(initiatingProject: string, projectNames: string[], tasks: Task[], args: {
|
|
20
25
|
targets?: string[];
|
|
21
26
|
configuration?: string;
|
|
22
27
|
verbose?: boolean;
|
|
28
|
+
outputStyle?: string;
|
|
23
29
|
});
|
|
30
|
+
/**
|
|
31
|
+
* Whether this run prints every task's output in full rather than collapsing
|
|
32
|
+
* the ones that succeeded.
|
|
33
|
+
*/
|
|
34
|
+
private get printsFullOutput();
|
|
35
|
+
/**
|
|
36
|
+
* Tells the reader that output was withheld, so a task that succeeded while
|
|
37
|
+
* printing something worth reading is not silently swallowed.
|
|
38
|
+
*/
|
|
39
|
+
private hiddenOutputHint;
|
|
24
40
|
startCommand(): void;
|
|
25
41
|
endCommand(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Tasks with a `skipped` status are never reported through `endTasks`, so
|
|
44
|
+
* they are derived by subtracting everything that did complete.
|
|
45
|
+
*/
|
|
46
|
+
private skippedTasks;
|
|
47
|
+
/**
|
|
48
|
+
* Tasks that never produced output worth printing are summarized as counts,
|
|
49
|
+
* with their names available behind --verbose.
|
|
50
|
+
*/
|
|
51
|
+
private tasksNotRunSummary;
|
|
26
52
|
endTasks(taskResults: TaskResult[]): void;
|
|
27
53
|
printTaskTerminalOutput(task: Task, status: TaskStatus, terminalOutput: string): void;
|
|
28
54
|
}
|