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
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.format = format;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const node_child_process_1 = require("node:child_process");
|
|
6
5
|
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
-
const semver_1 = require("semver");
|
|
8
6
|
const configuration_1 = require("../../config/configuration");
|
|
9
7
|
const typescript_1 = require("../../plugins/js/utils/typescript");
|
|
10
8
|
const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
|
|
@@ -13,59 +11,81 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
|
13
11
|
const chunkify_1 = require("../../utils/chunkify");
|
|
14
12
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
15
13
|
const fileutils_1 = require("../../utils/fileutils");
|
|
16
|
-
const
|
|
14
|
+
const formatters_1 = require("../../utils/formatters");
|
|
15
|
+
const oxfmt_1 = require("../../utils/formatters/oxfmt");
|
|
16
|
+
const prettier_1 = require("../../utils/formatters/prettier");
|
|
17
17
|
const ignore_1 = require("../../utils/ignore");
|
|
18
18
|
const object_sort_1 = require("../../utils/object-sort");
|
|
19
19
|
const output_1 = require("../../utils/output");
|
|
20
|
-
const package_json_1 = require("../../utils/package-json");
|
|
21
20
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
21
|
+
/**
|
|
22
|
+
* A table, not a `switch`: this lookup sits inside a `try` whose `catch`
|
|
23
|
+
* reports "configured but not installed", and a `never` arm would throw into
|
|
24
|
+
* that catch and be misreported. A missing member is a compile error here.
|
|
25
|
+
*/
|
|
26
|
+
const resolveFormatterBin = {
|
|
27
|
+
oxfmt: oxfmt_1.getOxfmtBinPath,
|
|
28
|
+
prettier: prettier_1.getPrettierPath,
|
|
29
|
+
};
|
|
22
30
|
async function format(command, args) {
|
|
23
|
-
|
|
31
|
+
const formatterType = (0, formatters_1.detectFormatter)(workspace_root_1.workspaceRoot);
|
|
32
|
+
if (!formatterType) {
|
|
33
|
+
output_1.output.warn({
|
|
34
|
+
title: 'No formatter configured.',
|
|
35
|
+
bodyLines: ['Install oxfmt or prettier to enable formatting.'],
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Detection reads configuration only, so a workspace can be configured for a
|
|
40
|
+
// formatter that is not installed - a fresh clone, `--omit=dev` CI, a pruned
|
|
41
|
+
// node_modules. Resolving now turns a raw MODULE_NOT_FOUND into something
|
|
42
|
+
// actionable.
|
|
24
43
|
try {
|
|
25
|
-
|
|
44
|
+
resolveFormatterBin[formatterType]();
|
|
26
45
|
}
|
|
27
46
|
catch {
|
|
28
47
|
output_1.output.error({
|
|
29
|
-
title:
|
|
48
|
+
title: `${formatterType} is configured for this workspace but is not installed.`,
|
|
30
49
|
bodyLines: [
|
|
31
|
-
`
|
|
50
|
+
`Install "${formatterType}" and try again, or remove its configuration to disable "nx format:${command}".`,
|
|
32
51
|
],
|
|
33
52
|
});
|
|
34
53
|
process.exit(1);
|
|
35
54
|
}
|
|
36
55
|
const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const escaped = process.platform !== 'win32' ? p.replace(/\$/g, '\\\$') : p;
|
|
44
|
-
return `"${escaped}"`;
|
|
56
|
+
// Patterns are kept raw here. Prettier is invoked through a shell so it
|
|
57
|
+
// quotes them at the call site; oxfmt is invoked with execFile and needs
|
|
58
|
+
// the unquoted paths.
|
|
59
|
+
const patterns = await getPatterns(formatterType, {
|
|
60
|
+
...args,
|
|
61
|
+
...nxArgs,
|
|
45
62
|
});
|
|
46
|
-
// Chunkify the patterns array to prevent crashing the windows terminal
|
|
47
|
-
|
|
63
|
+
// Chunkify the patterns array to prevent crashing the windows terminal.
|
|
64
|
+
// The prettier path quotes each pattern on its way to the shell, so size the
|
|
65
|
+
// chunks against that; oxfmt goes through execFile and gets them raw.
|
|
66
|
+
const chunkList = (0, chunkify_1.chunkify)(patterns, undefined, formatterType === 'prettier'
|
|
67
|
+
? (pattern) => (0, prettier_1.quoteForShell)(pattern).length
|
|
68
|
+
: undefined);
|
|
48
69
|
switch (command) {
|
|
49
70
|
case 'write':
|
|
50
71
|
if (nxArgs.sortRootTsconfigPaths) {
|
|
51
72
|
sortTsConfig();
|
|
52
73
|
}
|
|
53
74
|
addRootConfigFiles(chunkList, nxArgs);
|
|
54
|
-
chunkList.forEach((chunk) => write(
|
|
75
|
+
chunkList.forEach((chunk) => write(formatterType, chunk));
|
|
55
76
|
break;
|
|
56
77
|
case 'check': {
|
|
57
78
|
const filesWithDifferentFormatting = [];
|
|
58
79
|
for (const chunk of chunkList) {
|
|
59
|
-
const files = await check(chunk);
|
|
80
|
+
const files = await check(formatterType, chunk);
|
|
60
81
|
filesWithDifferentFormatting.push(...files);
|
|
61
82
|
}
|
|
62
83
|
if (filesWithDifferentFormatting.length > 0) {
|
|
63
84
|
if (nxArgs.verbose) {
|
|
64
85
|
output_1.output.error({
|
|
65
|
-
title: 'The following files are not formatted correctly
|
|
86
|
+
title: 'The following files are not formatted correctly',
|
|
66
87
|
bodyLines: [
|
|
67
88
|
'- Run "nx format:write" and commit the resulting diff to fix these files.',
|
|
68
|
-
'- Please note, Prettier does not support a native way to diff the output of its check logic (https://github.com/prettier/prettier/issues/6885).',
|
|
69
89
|
'',
|
|
70
90
|
...filesWithDifferentFormatting,
|
|
71
91
|
],
|
|
@@ -80,7 +100,7 @@ async function format(command, args) {
|
|
|
80
100
|
}
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
|
-
async function getPatterns(
|
|
103
|
+
async function getPatterns(formatterType, args) {
|
|
84
104
|
const allFilesPattern = ['.'];
|
|
85
105
|
if (args.all) {
|
|
86
106
|
return allFilesPattern;
|
|
@@ -91,16 +111,16 @@ async function getPatterns(prettier, args) {
|
|
|
91
111
|
return getPatternsFromProjects(args.projects, graph);
|
|
92
112
|
}
|
|
93
113
|
const p = (0, command_line_utils_1.parseFiles)(args);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// Prettier supports ".swcrc" as a file instead of an extension
|
|
98
|
-
// So we add ".swcrc" as a supported extension manually
|
|
99
|
-
// which allows it to be considered for calculating "patterns"
|
|
100
|
-
.concat('.swcrc'));
|
|
101
|
-
const patterns = p.files
|
|
114
|
+
// Deleted files still show up in the changed-file set, and neither
|
|
115
|
+
// formatter should be handed a path that is no longer there.
|
|
116
|
+
let patterns = p.files
|
|
102
117
|
.map((f) => path.relative(workspace_root_1.workspaceRoot, f))
|
|
103
|
-
.filter((f) => (0, fileutils_1.fileExists)(f)
|
|
118
|
+
.filter((f) => (0, fileutils_1.fileExists)(f));
|
|
119
|
+
if (formatterType === 'prettier') {
|
|
120
|
+
// oxfmt needs no equivalent filter - it silently skips file types it
|
|
121
|
+
// does not handle, and its base args keep an all-skipped run green.
|
|
122
|
+
patterns = await (0, prettier_1.filterToPrettierSupportedFiles)(patterns);
|
|
123
|
+
}
|
|
104
124
|
// exclude patterns in .nxignore or .gitignore
|
|
105
125
|
const nonIgnoredPatterns = (0, ignore_1.getIgnoreObject)().filter(patterns);
|
|
106
126
|
if (args.libsAndApps) {
|
|
@@ -130,13 +150,10 @@ function addRootConfigFiles(chunkList, nxArgs) {
|
|
|
130
150
|
}
|
|
131
151
|
const chunk = [];
|
|
132
152
|
const addToChunkIfNeeded = (file) => {
|
|
133
|
-
if (chunkList.every((c) => !c.includes(
|
|
153
|
+
if (chunkList.every((c) => !c.includes(file))) {
|
|
134
154
|
chunk.push(file);
|
|
135
155
|
}
|
|
136
156
|
};
|
|
137
|
-
// if (workspaceJsonPath) {
|
|
138
|
-
// addToChunkIfNeeded(workspaceJsonPath);
|
|
139
|
-
// }
|
|
140
157
|
['nx.json', (0, typescript_1.getRootTsConfigFileName)()]
|
|
141
158
|
.filter(Boolean)
|
|
142
159
|
.forEach(addToChunkIfNeeded);
|
|
@@ -147,49 +164,43 @@ function addRootConfigFiles(chunkList, nxArgs) {
|
|
|
147
164
|
function getPatternsFromProjects(projects, projectGraph) {
|
|
148
165
|
return (0, command_line_utils_1.getProjectRoots)(projects, projectGraph);
|
|
149
166
|
}
|
|
150
|
-
function write(
|
|
151
|
-
if (patterns.length
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
windowsHide: true,
|
|
168
|
-
});
|
|
167
|
+
function write(formatterType, patterns) {
|
|
168
|
+
if (patterns.length === 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
switch (formatterType) {
|
|
172
|
+
case 'oxfmt':
|
|
173
|
+
(0, oxfmt_1.writeWithOxfmt)(patterns);
|
|
174
|
+
break;
|
|
175
|
+
case 'prettier':
|
|
176
|
+
(0, prettier_1.writeWithPrettier)(patterns);
|
|
177
|
+
break;
|
|
178
|
+
default: {
|
|
179
|
+
// Without this, an unhandled formatter makes `nx format:write` exit 0
|
|
180
|
+
// having formatted nothing, while `check()` throws - the two halves of
|
|
181
|
+
// the same command disagreeing.
|
|
182
|
+
const unhandled = formatterType;
|
|
183
|
+
throw new Error(`Unhandled formatter: ${unhandled}`);
|
|
169
184
|
}
|
|
170
185
|
}
|
|
171
186
|
}
|
|
172
|
-
async function check(patterns) {
|
|
187
|
+
async function check(formatterType, patterns) {
|
|
173
188
|
if (patterns.length === 0) {
|
|
174
189
|
return [];
|
|
175
190
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
resolve([]);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
191
|
+
switch (formatterType) {
|
|
192
|
+
case 'oxfmt':
|
|
193
|
+
return (0, oxfmt_1.checkWithOxfmt)(patterns);
|
|
194
|
+
case 'prettier':
|
|
195
|
+
return (0, prettier_1.checkWithPrettier)(patterns);
|
|
196
|
+
default: {
|
|
197
|
+
// `strict: false` does not make a missing case an error on its own, but
|
|
198
|
+
// it does reject this assignment - so adding a formatter fails to compile
|
|
199
|
+
// here instead of returning undefined into a caller that spreads it.
|
|
200
|
+
const unhandled = formatterType;
|
|
201
|
+
throw new Error(`Unhandled formatter: ${unhandled}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
193
204
|
}
|
|
194
205
|
function sortTsConfig() {
|
|
195
206
|
try {
|
|
@@ -203,31 +214,3 @@ function sortTsConfig() {
|
|
|
203
214
|
// catch noop
|
|
204
215
|
}
|
|
205
216
|
}
|
|
206
|
-
let prettierPath;
|
|
207
|
-
function getPrettierPath() {
|
|
208
|
-
if (prettierPath) {
|
|
209
|
-
return prettierPath;
|
|
210
|
-
}
|
|
211
|
-
const { packageJson, path: packageJsonPath } = (0, package_json_1.readModulePackageJson)('prettier');
|
|
212
|
-
const bin = packageJson.bin;
|
|
213
|
-
const binPath = typeof bin === 'string' ? bin : bin?.['prettier'];
|
|
214
|
-
if (!binPath) {
|
|
215
|
-
throw new Error(`Could not find prettier binary in ${packageJsonPath}`);
|
|
216
|
-
}
|
|
217
|
-
prettierPath = path.resolve(path.dirname(packageJsonPath), binPath);
|
|
218
|
-
return prettierPath;
|
|
219
|
-
}
|
|
220
|
-
let useListDifferent;
|
|
221
|
-
/**
|
|
222
|
-
* Determines if --list-different should be used with --write.
|
|
223
|
-
* Prettier 4+ and 3.6.x with experimental CLI don't support combining these flags.
|
|
224
|
-
*/
|
|
225
|
-
function shouldUseListDifferent(prettierVersion) {
|
|
226
|
-
if (useListDifferent !== undefined) {
|
|
227
|
-
return useListDifferent;
|
|
228
|
-
}
|
|
229
|
-
const prettierMajor = (0, semver_1.major)(prettierVersion);
|
|
230
|
-
const isExperimentalCli = process.env.PRETTIER_EXPERIMENTAL_CLI === '1';
|
|
231
|
-
useListDifferent = prettierMajor < 4 && !isExperimentalCli;
|
|
232
|
-
return useListDifferent;
|
|
233
|
-
}
|
|
@@ -6,7 +6,7 @@ exports.printGenHelp = printGenHelp;
|
|
|
6
6
|
exports.generate = generate;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
9
|
-
const
|
|
9
|
+
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const configuration_1 = require("../../config/configuration");
|
|
12
12
|
const tree_1 = require("../../generators/tree");
|
|
@@ -91,42 +91,42 @@ async function promptForCollection(generatorName, interactive, projectsConfigura
|
|
|
91
91
|
throwInvalidInvocation(Array.from(choicesMap));
|
|
92
92
|
}
|
|
93
93
|
else if (interactive && choices.length > 1) {
|
|
94
|
-
const noneOfTheAbove =
|
|
94
|
+
const noneOfTheAbove = `None of the above`;
|
|
95
|
+
// Blank line before the last entry. The newline has to trail the choice
|
|
96
|
+
// *before* the gap: a leading one would land between the following
|
|
97
|
+
// choice's radio marker and its text, splitting that row in two.
|
|
98
|
+
const beforeGap = choices.length - 1;
|
|
95
99
|
choices.push(noneOfTheAbove);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
},
|
|
100
|
+
const generator = await (0, prompt_helpers_1.selectPrompt)({
|
|
101
|
+
message: `Which generator would you like to use?`,
|
|
102
|
+
// Local-plugin entries carry a separate display label; the rest are
|
|
103
|
+
// plain collection names. Only the label takes the newline, so the
|
|
104
|
+
// value still resolves as a collection name.
|
|
105
|
+
choices: choices.map((c, i) => {
|
|
106
|
+
const choice = typeof c === 'string'
|
|
107
|
+
? { value: c, label: c }
|
|
108
|
+
: { value: c.value, label: c.message };
|
|
109
|
+
return i === beforeGap && !choice.label.endsWith('\n')
|
|
110
|
+
? { ...choice, label: `${choice.label}\n` }
|
|
111
|
+
: choice;
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
if (generator !== noneOfTheAbove) {
|
|
115
|
+
return generator;
|
|
116
|
+
}
|
|
117
|
+
const customCollection = await (0, prompt_helpers_1.textPrompt)({
|
|
118
|
+
message: `Which collection would you like to use?`,
|
|
119
|
+
validate: (value) => {
|
|
120
|
+
try {
|
|
121
|
+
(0, generator_utils_1.getGeneratorInformation)(value, generatorName, workspace_root_1.workspaceRoot, projectsConfiguration.projects);
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return `Could not find ${value}:${generatorName}`;
|
|
126
|
+
}
|
|
125
127
|
},
|
|
126
|
-
|
|
127
|
-
return customCollection
|
|
128
|
-
? `${customCollection}:${generatorName}`
|
|
129
|
-
: generator;
|
|
128
|
+
});
|
|
129
|
+
return `${customCollection}:${generatorName}`;
|
|
130
130
|
}
|
|
131
131
|
else if (deprecatedChoices.size > 0) {
|
|
132
132
|
throw new Error([
|
|
@@ -50,6 +50,7 @@ export declare function generateGraph(args: {
|
|
|
50
50
|
exclude?: string[];
|
|
51
51
|
affected?: boolean;
|
|
52
52
|
}, affectedProjects: string[]): Promise<void>;
|
|
53
|
+
export declare function getExpandedTaskInputs(depGraphClientResponse: ProjectGraphClientResponse, expandedTaskInputsCache: Map<string, Record<string, string[]>>, taskId: string): Promise<Record<string, string[]>>;
|
|
53
54
|
/**
|
|
54
55
|
* The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
|
55
56
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateGraph = generateGraph;
|
|
4
|
+
exports.getExpandedTaskInputs = getExpandedTaskInputs;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const crypto_1 = require("crypto");
|
|
6
7
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -9,7 +10,6 @@ const daemon_socket_messenger_1 = require("../../daemon/client/daemon-socket-mes
|
|
|
9
10
|
const http = tslib_1.__importStar(require("node:http"));
|
|
10
11
|
const minimatch_1 = require("minimatch");
|
|
11
12
|
const node_url_1 = require("node:url");
|
|
12
|
-
const open_1 = tslib_1.__importDefault(require("open"));
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
14
|
const net = tslib_1.__importStar(require("node:net"));
|
|
15
15
|
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
@@ -34,6 +34,7 @@ const create_task_hasher_1 = require("../../hasher/create-task-hasher");
|
|
|
34
34
|
const task_env_1 = require("../../tasks-runner/task-env");
|
|
35
35
|
const error_types_1 = require("../../project-graph/error-types");
|
|
36
36
|
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
|
37
|
+
const split_target_1 = require("../../utils/split-target");
|
|
37
38
|
// maps file extention to MIME types
|
|
38
39
|
const mimeType = {
|
|
39
40
|
'.ico': 'image/x-icon',
|
|
@@ -349,7 +350,11 @@ async function generateGraph(args, affectedProjects) {
|
|
|
349
350
|
title: `Project graph started at ${url.toString()}`,
|
|
350
351
|
});
|
|
351
352
|
if (args.open) {
|
|
352
|
-
(
|
|
353
|
+
new Function('return import("open")')()
|
|
354
|
+
.then((m) => m.default(url.toString()))
|
|
355
|
+
.catch(() => {
|
|
356
|
+
// Ignore errors when opening browser (e.g. no browser available)
|
|
357
|
+
});
|
|
353
358
|
}
|
|
354
359
|
return new Promise((res) => {
|
|
355
360
|
app.once('close', res);
|
|
@@ -438,7 +443,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
438
443
|
node_perf_hooks_1.performance.mark('task input generation:start');
|
|
439
444
|
const taskId = parsedUrl.searchParams.get('taskId');
|
|
440
445
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
441
|
-
const inputs = await getExpandedTaskInputs(taskId);
|
|
446
|
+
const inputs = await getExpandedTaskInputs(currentProjectGraphClientResponse, expandedTaskInputsCache, taskId);
|
|
442
447
|
node_perf_hooks_1.performance.mark('task input generation:end');
|
|
443
448
|
res.end(JSON.stringify({ [taskId]: inputs }));
|
|
444
449
|
node_perf_hooks_1.performance.measure('task input generation', 'task input generation:start', 'task input generation:end');
|
|
@@ -823,19 +828,23 @@ async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, c
|
|
|
823
828
|
};
|
|
824
829
|
}
|
|
825
830
|
}
|
|
826
|
-
async function getExpandedTaskInputs(taskId) {
|
|
831
|
+
async function getExpandedTaskInputs(depGraphClientResponse, expandedTaskInputsCache, taskId) {
|
|
827
832
|
// Check cache first
|
|
828
833
|
if (expandedTaskInputsCache.has(taskId)) {
|
|
829
834
|
return expandedTaskInputsCache.get(taskId);
|
|
830
835
|
}
|
|
831
836
|
// Use the optimized version that only creates the specific task graph needed
|
|
832
|
-
|
|
837
|
+
// Use colon-aware splitting so that target names containing colons
|
|
838
|
+
// (e.g. "test:integration") are parsed correctly instead of being
|
|
839
|
+
// mistaken for a target + configuration pair.
|
|
840
|
+
const projectNodes = Object.fromEntries(depGraphClientResponse.projects.map((p) => [p.name, p]));
|
|
841
|
+
const [projectName, targetName, configuration] = (0, split_target_1.splitTargetFromNodes)(taskId, projectNodes, { silent: true });
|
|
833
842
|
const taskGraphResponse = await createTaskGraphForTargetsAndProjects([targetName], [projectName], configuration);
|
|
834
843
|
const allWorkspaceFiles = await (0, all_file_data_1.allFileData)();
|
|
835
844
|
const inputs = taskGraphResponse.plans?.[taskId];
|
|
836
845
|
let result = {};
|
|
837
846
|
if (inputs) {
|
|
838
|
-
result = expandInputs(inputs,
|
|
847
|
+
result = expandInputs(inputs, depGraphClientResponse.projects.find((p) => p.name === projectName), allWorkspaceFiles, depGraphClientResponse);
|
|
839
848
|
}
|
|
840
849
|
// Cache the result
|
|
841
850
|
expandedTaskInputsCache.set(taskId, result);
|
|
@@ -8,7 +8,7 @@ const pc = tslib_1.__importStar(require("picocolors"));
|
|
|
8
8
|
const git_utils_1 = require("../../utils/git-utils");
|
|
9
9
|
const promises_1 = require("node:fs/promises");
|
|
10
10
|
const tmp_1 = require("tmp");
|
|
11
|
-
const
|
|
11
|
+
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
12
12
|
const output_1 = require("../../utils/output");
|
|
13
13
|
const createSpinner = require('ora');
|
|
14
14
|
const init_v2_1 = require("../init/init-v2");
|
|
@@ -23,10 +23,10 @@ const prepare_source_repo_1 = require("./utils/prepare-source-repo");
|
|
|
23
23
|
const merge_remote_source_1 = require("./utils/merge-remote-source");
|
|
24
24
|
const minimatch_1 = require("minimatch");
|
|
25
25
|
const configure_plugins_1 = require("../init/configure-plugins");
|
|
26
|
+
const format_1 = require("../init/implementation/format");
|
|
26
27
|
const check_compatible_with_plugins_1 = require("../init/implementation/check-compatible-with-plugins");
|
|
27
28
|
const native_1 = require("../../native");
|
|
28
29
|
const ai_output_1 = require("./utils/ai-output");
|
|
29
|
-
const init_v2_2 = require("../init/init-v2");
|
|
30
30
|
const importRemoteName = '__tmp_nx_import__';
|
|
31
31
|
async function importHandler(options) {
|
|
32
32
|
process.env.NX_RUNNING_NX_IMPORT = 'true';
|
|
@@ -77,14 +77,10 @@ async function importHandler(options) {
|
|
|
77
77
|
}
|
|
78
78
|
const tempImportDirectory = (0, path_1.join)(tmp_1.tmpdir, 'nx-import');
|
|
79
79
|
if (!sourceRepository) {
|
|
80
|
-
sourceRepository =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
message: 'What is the URL of the repository you want to import? (This can be a local git repository or a git remote URL)',
|
|
85
|
-
required: true,
|
|
86
|
-
},
|
|
87
|
-
])).sourceRepository;
|
|
80
|
+
sourceRepository = await (0, prompt_helpers_1.textPrompt)({
|
|
81
|
+
message: 'What is the URL of the repository you want to import? (This can be a local git repository or a git remote URL)',
|
|
82
|
+
validate: (value) => (value ? undefined : 'A repository is required'),
|
|
83
|
+
});
|
|
88
84
|
}
|
|
89
85
|
try {
|
|
90
86
|
const maybeLocalDirectory = await (0, promises_1.stat)(sourceRepository);
|
|
@@ -132,19 +128,10 @@ async function importHandler(options) {
|
|
|
132
128
|
throw new Error('The --ref option is required when running in agent mode.');
|
|
133
129
|
}
|
|
134
130
|
const branchChoices = await sourceGitClient.listBranches();
|
|
135
|
-
ref =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
message: `Which branch do you want to import?`,
|
|
140
|
-
choices: branchChoices,
|
|
141
|
-
/**
|
|
142
|
-
* Limit the number of choices so that it fits on screen
|
|
143
|
-
*/
|
|
144
|
-
limit: process.stdout.rows - 3,
|
|
145
|
-
required: true,
|
|
146
|
-
},
|
|
147
|
-
])).ref;
|
|
131
|
+
ref = await (0, prompt_helpers_1.selectPrompt)({
|
|
132
|
+
message: `Which branch do you want to import?`,
|
|
133
|
+
choices: branchChoices,
|
|
134
|
+
});
|
|
148
135
|
}
|
|
149
136
|
if (!source) {
|
|
150
137
|
if (aiMode) {
|
|
@@ -152,28 +139,20 @@ async function importHandler(options) {
|
|
|
152
139
|
source = '.';
|
|
153
140
|
}
|
|
154
141
|
else {
|
|
155
|
-
source =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
name: 'source',
|
|
159
|
-
message: `Which directory do you want to import into this workspace? (leave blank to import the entire repository)`,
|
|
160
|
-
},
|
|
161
|
-
])).source;
|
|
142
|
+
source = await (0, prompt_helpers_1.textPrompt)({
|
|
143
|
+
message: `Which directory do you want to import into this workspace? (leave blank to import the entire repository)`,
|
|
144
|
+
});
|
|
162
145
|
}
|
|
163
146
|
}
|
|
164
147
|
if (!destination) {
|
|
165
148
|
if (aiMode) {
|
|
166
149
|
throw new Error('The --destination option is required when running in agent mode.');
|
|
167
150
|
}
|
|
168
|
-
destination =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
required: true,
|
|
174
|
-
initial: source ? source : undefined,
|
|
175
|
-
},
|
|
176
|
-
])).destination;
|
|
151
|
+
destination = await (0, prompt_helpers_1.textPrompt)({
|
|
152
|
+
message: 'Where in this workspace should the code be imported into?',
|
|
153
|
+
initialValue: source ? source : undefined,
|
|
154
|
+
validate: (value) => (value ? undefined : 'A destination is required'),
|
|
155
|
+
});
|
|
177
156
|
}
|
|
178
157
|
const absSource = (0, path_1.join)(sourceTempRepoPath, source);
|
|
179
158
|
if ((0, path_1.isAbsolute)(destination)) {
|
|
@@ -282,6 +261,7 @@ async function importHandler(options) {
|
|
|
282
261
|
const incompatiblePlugins = await (0, check_compatible_with_plugins_1.checkCompatibleWithPlugins)();
|
|
283
262
|
if (Object.keys(incompatiblePlugins).length > 0) {
|
|
284
263
|
(0, check_compatible_with_plugins_1.updatePluginsInNxJson)(workspace_root_1.workspaceRoot, incompatiblePlugins);
|
|
264
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
285
265
|
await destinationGitClient.amendCommit();
|
|
286
266
|
}
|
|
287
267
|
}
|
|
@@ -290,6 +270,7 @@ async function importHandler(options) {
|
|
|
290
270
|
if (installed) {
|
|
291
271
|
const { succeededPlugins } = await (0, configure_plugins_1.configurePlugins)(plugins, updatePackageScripts, pmc, workspace_root_1.workspaceRoot, verbose);
|
|
292
272
|
if (succeededPlugins.length > 0) {
|
|
273
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
293
274
|
await destinationGitClient.amendCommit();
|
|
294
275
|
}
|
|
295
276
|
}
|
|
@@ -361,7 +342,7 @@ async function importHandler(options) {
|
|
|
361
342
|
(0, ai_output_1.writeAiOutput)((0, ai_output_1.buildImportNeedsPluginSelectionResult)({
|
|
362
343
|
detectedPlugins: detectedButNotInstalled.map((name) => ({
|
|
363
344
|
name,
|
|
364
|
-
reason: (0,
|
|
345
|
+
reason: (0, init_v2_1.getPluginReason)(name),
|
|
365
346
|
})),
|
|
366
347
|
sourceRepository,
|
|
367
348
|
ref,
|
|
@@ -456,6 +437,7 @@ async function handlePluginOnlyMode(options, destinationGitClient, verbose) {
|
|
|
456
437
|
if (installed) {
|
|
457
438
|
const { succeededPlugins } = await (0, configure_plugins_1.configurePlugins)(plugins, updatePackageScripts, pmc, workspace_root_1.workspaceRoot, verbose);
|
|
458
439
|
if (succeededPlugins.length > 0) {
|
|
440
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
459
441
|
await destinationGitClient.amendCommit();
|
|
460
442
|
}
|
|
461
443
|
}
|
|
@@ -490,6 +472,7 @@ async function runInstallDestinationRepo(packageManager, destinationGitClient) {
|
|
|
490
472
|
title: 'Installing dependencies for imported code',
|
|
491
473
|
});
|
|
492
474
|
(0, utils_1.runInstall)(workspace_root_1.workspaceRoot, packageManager, (0, package_manager_1.getPackageManagerCommand)(packageManager));
|
|
475
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
493
476
|
await destinationGitClient.amendCommit();
|
|
494
477
|
}
|
|
495
478
|
catch (e) {
|
|
@@ -506,6 +489,7 @@ async function runPluginsInstall(plugins, pmc, destinationGitClient) {
|
|
|
506
489
|
output_1.output.log({ title: 'Installing Plugins' });
|
|
507
490
|
try {
|
|
508
491
|
(0, configure_plugins_1.installPluginPackages)(workspace_root_1.workspaceRoot, pmc, plugins);
|
|
492
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
509
493
|
await destinationGitClient.amendCommit();
|
|
510
494
|
}
|
|
511
495
|
catch (e) {
|
|
@@ -583,6 +567,12 @@ async function handleMissingWorkspacesEntry(pm, pmc, pkgPath, destinationGitClie
|
|
|
583
567
|
return;
|
|
584
568
|
}
|
|
585
569
|
(0, package_manager_1.addPackagePathToWorkspaces)(pkgPath, pm, workspaces, workspace_root_1.workspaceRoot);
|
|
570
|
+
// That helper is shared, so it does not record for us - without this the
|
|
571
|
+
// drain below has nothing to do and the rewritten file ships unformatted.
|
|
572
|
+
// It writes pnpm-workspace.yaml for pnpm and package.json for the rest, so
|
|
573
|
+
// recording package.json unconditionally records a file it never touched.
|
|
574
|
+
(0, format_1.recordInitWrite)((0, path_1.join)(workspace_root_1.workspaceRoot, pm === 'pnpm' ? 'pnpm-workspace.yaml' : 'package.json'));
|
|
575
|
+
await (0, format_1.formatInitWrites)(workspace_root_1.workspaceRoot, 'nx import');
|
|
586
576
|
await destinationGitClient.amendCommit();
|
|
587
577
|
output_1.output.success({
|
|
588
578
|
title: `Project added in workspaces`,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Agent } from '../../ai/utils';
|
|
2
|
-
export declare function determineAiAgents(aiAgents?: Agent[], interactive?: boolean): Promise<Agent[]>;
|
|
2
|
+
export declare function determineAiAgents(aiAgents?: (Agent | 'none')[], interactive?: boolean): Promise<Agent[]>;
|