nx 20.8.4 → 22.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/dist/bin/init-local.d.ts +8 -0
- package/dist/bin/init-local.js +197 -0
- package/dist/bin/nx.d.ts +3 -0
- package/dist/bin/nx.js +306 -0
- package/dist/bin/post-install.js +52 -0
- package/dist/plugins/package-json.d.ts +4 -0
- package/dist/plugins/package-json.js +38 -0
- package/dist/release/changelog-renderer/index.d.ts +109 -0
- package/dist/release/changelog-renderer/index.js +367 -0
- package/dist/src/adapter/angular-json.js +130 -0
- package/dist/src/adapter/compat.d.ts +2 -0
- package/dist/src/adapter/compat.js +153 -0
- package/dist/src/adapter/ngcli-adapter.d.ts +104 -0
- package/dist/src/adapter/ngcli-adapter.js +1001 -0
- package/dist/src/ai/clone-ai-config-repo.d.ts +11 -0
- package/dist/src/ai/clone-ai-config-repo.js +155 -0
- package/dist/src/ai/constants.d.ts +26 -0
- package/dist/src/ai/constants.js +71 -0
- package/dist/src/ai/detect-ai-agent.d.ts +2 -0
- package/dist/src/ai/detect-ai-agent.js +12 -0
- package/dist/src/ai/set-up-ai-agents/get-agent-rules.d.ts +5 -0
- package/dist/src/ai/set-up-ai-agents/get-agent-rules.js +26 -0
- package/dist/src/ai/set-up-ai-agents/schema.d.ts +11 -0
- package/dist/src/ai/set-up-ai-agents/schema.json +34 -0
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts +10 -0
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +516 -0
- package/dist/src/ai/utils.d.ts +20 -0
- package/dist/src/ai/utils.js +217 -0
- package/dist/src/analytics/analytics.d.ts +10 -0
- package/dist/src/analytics/analytics.js +236 -0
- package/dist/src/analytics/index.d.ts +1 -0
- package/dist/src/analytics/index.js +11 -0
- package/dist/src/command-line/add/add.js +126 -0
- package/dist/src/command-line/add/command-object.js +28 -0
- package/dist/src/command-line/affected/affected.js +89 -0
- package/dist/src/command-line/affected/command-object.js +83 -0
- package/dist/src/command-line/ai/ai-output.d.ts +46 -0
- package/dist/src/command-line/ai/ai-output.js +86 -0
- package/dist/src/command-line/configure-ai-agents/command-object.d.ts +8 -0
- package/dist/src/command-line/configure-ai-agents/command-object.js +47 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.d.ts +3 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +425 -0
- package/dist/src/command-line/daemon/command-object.d.ts +3 -0
- package/dist/src/command-line/daemon/command-object.js +29 -0
- package/dist/src/command-line/daemon/daemon.js +31 -0
- package/dist/src/command-line/examples.d.ts +12 -0
- package/dist/src/command-line/examples.js +403 -0
- package/dist/src/command-line/exec/command-object.js +20 -0
- package/dist/src/command-line/exec/exec.js +143 -0
- package/dist/src/command-line/format/command-object.js +58 -0
- package/dist/src/command-line/format/format.js +233 -0
- package/dist/src/command-line/generate/command-object.js +67 -0
- package/dist/src/command-line/generate/generate.js +281 -0
- package/dist/src/command-line/graph/command-object.js +76 -0
- package/dist/src/command-line/graph/graph.d.ts +69 -0
- package/dist/src/command-line/graph/graph.js +978 -0
- package/dist/src/command-line/import/command-object.js +63 -0
- package/dist/src/command-line/import/import.d.ts +26 -0
- package/dist/src/command-line/import/import.js +600 -0
- package/dist/src/command-line/import/utils/ai-output.d.ts +93 -0
- package/dist/src/command-line/import/utils/ai-output.js +209 -0
- package/dist/src/command-line/import/utils/merge-remote-source.js +14 -0
- package/dist/src/command-line/import/utils/prepare-source-repo.js +27 -0
- package/dist/src/command-line/index.d.ts +22 -0
- package/dist/src/command-line/index.js +26 -0
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +2 -0
- package/dist/src/command-line/init/ai-agent-prompts.js +35 -0
- package/dist/src/command-line/init/command-object.js +108 -0
- package/dist/src/command-line/init/configure-plugins.js +210 -0
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +6 -0
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +140 -0
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +356 -0
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +6 -0
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +82 -0
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +50 -0
- package/dist/src/command-line/init/implementation/angular/index.js +133 -0
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +12 -0
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +149 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +204 -0
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +134 -0
- package/dist/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +10 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +137 -0
- package/dist/src/command-line/init/implementation/dot-nx/nxw.js +123 -0
- package/dist/src/command-line/init/implementation/utils.d.ts +27 -0
- package/dist/src/command-line/init/implementation/utils.js +343 -0
- package/dist/src/command-line/init/init-v1.d.ts +8 -0
- package/dist/src/command-line/init/init-v1.js +104 -0
- package/dist/src/command-line/init/init-v2.d.ts +23 -0
- package/dist/src/command-line/init/init-v2.js +609 -0
- package/dist/src/command-line/init/utils/ai-output.d.ts +72 -0
- package/dist/src/command-line/init/utils/ai-output.js +180 -0
- package/dist/src/command-line/list/command-object.js +21 -0
- package/dist/src/command-line/list/list.d.ts +15 -0
- package/dist/src/command-line/list/list.js +48 -0
- package/dist/src/command-line/mcp/command-object.d.ts +2 -0
- package/dist/src/command-line/mcp/command-object.js +29 -0
- package/dist/src/command-line/mcp/mcp.d.ts +2 -0
- package/dist/src/command-line/mcp/mcp.js +60 -0
- package/dist/src/command-line/migrate/command-object.js +79 -0
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +76 -0
- package/dist/src/command-line/migrate/migrate-ui-api.js +354 -0
- package/dist/src/command-line/migrate/migrate.d.ts +151 -0
- package/dist/src/command-line/migrate/migrate.js +1608 -0
- package/dist/src/command-line/migrate/run-migration-process.js +87 -0
- package/dist/src/command-line/new/command-object.js +26 -0
- package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/apply-locally/apply-locally.js +13 -0
- package/dist/src/command-line/nx-cloud/apply-locally/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/apply-locally/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.js +17 -0
- package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/complete-run/stop-all-agents.js +13 -0
- package/dist/src/command-line/nx-cloud/connect/command-object.js +28 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts +13 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +253 -0
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +53 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/command-object.js +13 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/download-cloud-client/download-cloud-client.js +32 -0
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/fix-ci/fix-ci.js +13 -0
- package/dist/src/command-line/nx-cloud/login/command-object.js +20 -0
- package/dist/src/command-line/nx-cloud/login/login.js +10 -0
- package/dist/src/command-line/nx-cloud/logout/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/logout/logout.js +7 -0
- package/dist/src/command-line/nx-cloud/record/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/record/command-object.js +19 -0
- package/dist/src/command-line/nx-cloud/record/record.d.ts +5 -0
- package/dist/src/command-line/nx-cloud/record/record.js +33 -0
- package/dist/src/command-line/nx-cloud/start-agent/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-agent/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-agent/start-agent.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-agent/start-agent.js +13 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +13 -0
- package/dist/src/command-line/nx-cloud/utils.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/utils.js +34 -0
- package/dist/src/command-line/nx-commands.d.ts +10 -0
- package/dist/src/command-line/nx-commands.js +170 -0
- package/dist/src/command-line/register/command-object.js +27 -0
- package/dist/src/command-line/release/changelog/commit-utils.d.ts +13 -0
- package/dist/src/command-line/release/changelog/commit-utils.js +63 -0
- package/dist/src/command-line/release/changelog/version-plan-filtering.d.ts +41 -0
- package/dist/src/command-line/release/changelog/version-plan-filtering.js +152 -0
- package/dist/src/command-line/release/changelog/version-plan-utils.d.ts +31 -0
- package/dist/src/command-line/release/changelog/version-plan-utils.js +92 -0
- package/dist/src/command-line/release/changelog.d.ts +21 -0
- package/dist/src/command-line/release/changelog.js +893 -0
- package/dist/src/command-line/release/command-object.d.ts +84 -0
- package/dist/src/command-line/release/command-object.js +342 -0
- package/dist/src/command-line/release/config/config.d.ts +73 -0
- package/dist/src/command-line/release/config/config.js +1172 -0
- package/dist/src/command-line/release/config/conventional-commits.js +106 -0
- package/dist/src/command-line/release/config/filter-release-groups.d.ts +23 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
- package/dist/src/command-line/release/config/version-plans.js +278 -0
- package/dist/src/command-line/release/index.d.ts +49 -0
- package/dist/src/command-line/release/index.js +49 -0
- package/dist/src/command-line/release/plan-check.js +170 -0
- package/dist/src/command-line/release/plan.js +261 -0
- package/dist/src/command-line/release/publish.d.ts +9 -0
- package/dist/src/command-line/release/publish.js +290 -0
- package/dist/src/command-line/release/release.d.ts +5 -0
- package/dist/src/command-line/release/release.js +300 -0
- package/dist/src/command-line/release/utils/diff.d.ts +21 -0
- package/dist/src/command-line/release/utils/diff.js +168 -0
- package/dist/src/command-line/release/utils/exec-command.js +34 -0
- package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +78 -0
- package/dist/src/command-line/release/utils/git.d.ts +120 -0
- package/dist/src/command-line/release/utils/git.js +560 -0
- package/dist/src/command-line/release/utils/launch-editor.js +46 -0
- package/dist/src/command-line/release/utils/print-changes.js +63 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +230 -0
- package/dist/src/command-line/release/utils/release-graph.js +710 -0
- package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.d.ts +9 -0
- package/dist/src/command-line/release/utils/remote-release-clients/extract-repo-slug.js +61 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.d.ts +58 -0
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +342 -0
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.d.ts +62 -0
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +268 -0
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +111 -0
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +138 -0
- package/dist/src/command-line/release/utils/repository-git-tags.d.ts +25 -0
- package/dist/src/command-line/release/utils/repository-git-tags.js +125 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +34 -0
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +53 -0
- package/dist/src/command-line/release/utils/resolve-semver-specifier.d.ts +7 -0
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
- package/dist/src/command-line/release/utils/semver.d.ts +26 -0
- package/dist/src/command-line/release/utils/semver.js +111 -0
- package/dist/src/command-line/release/utils/shared.d.ts +64 -0
- package/dist/src/command-line/release/utils/shared.js +363 -0
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +40 -0
- package/dist/src/command-line/release/utils/version-plan-utils.js +111 -0
- package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +8 -0
- package/dist/src/command-line/release/version/derive-specifier-from-conventional-commits.js +56 -0
- package/dist/src/command-line/release/version/project-logger.js +47 -0
- package/dist/src/command-line/release/version/release-group-processor.d.ts +115 -0
- package/dist/src/command-line/release/version/release-group-processor.js +632 -0
- package/dist/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/dist/src/command-line/release/version/resolve-current-version.js +240 -0
- package/dist/src/command-line/release/version/topological-sort.js +41 -0
- package/dist/src/command-line/release/version/version-actions.d.ts +199 -0
- package/dist/src/command-line/release/version/version-actions.js +251 -0
- package/dist/src/command-line/release/version.d.ts +25 -0
- package/dist/src/command-line/release/version.js +368 -0
- package/dist/src/command-line/repair/command-object.js +21 -0
- package/dist/src/command-line/repair/repair.js +41 -0
- package/dist/src/command-line/report/command-object.js +12 -0
- package/dist/src/command-line/report/report.d.ts +71 -0
- package/dist/src/command-line/report/report.js +404 -0
- package/dist/src/command-line/reset/command-object.js +27 -0
- package/dist/src/command-line/reset/reset.js +178 -0
- package/dist/src/command-line/run/command-object.js +43 -0
- package/dist/src/command-line/run/executor-utils.d.ts +12 -0
- package/dist/src/command-line/run/executor-utils.js +96 -0
- package/dist/src/command-line/run/run-one.d.ts +17 -0
- package/dist/src/command-line/run/run-one.js +154 -0
- package/dist/src/command-line/run/run.js +179 -0
- package/dist/src/command-line/run-many/command-object.js +18 -0
- package/dist/src/command-line/run-many/run-many.js +89 -0
- package/dist/src/command-line/show/command-object.d.ts +40 -0
- package/dist/src/command-line/show/command-object.js +237 -0
- package/dist/src/command-line/show/project.js +103 -0
- package/dist/src/command-line/show/projects.js +80 -0
- package/dist/src/command-line/show/show-target/index.d.ts +3 -0
- package/dist/src/command-line/show/show-target/index.js +9 -0
- package/dist/src/command-line/show/show-target/info.d.ts +27 -0
- package/dist/src/command-line/show/show-target/info.js +299 -0
- package/dist/src/command-line/show/show-target/inputs.d.ts +2 -0
- package/dist/src/command-line/show/show-target/inputs.js +186 -0
- package/dist/src/command-line/show/show-target/outputs.d.ts +2 -0
- package/dist/src/command-line/show/show-target/outputs.js +195 -0
- package/dist/src/command-line/show/show-target/utils.d.ts +26 -0
- package/dist/src/command-line/show/show-target/utils.js +185 -0
- package/dist/src/command-line/sync/command-object.js +21 -0
- package/dist/src/command-line/sync/sync.js +120 -0
- package/dist/src/command-line/watch/command-object.js +71 -0
- package/dist/src/command-line/watch/watch.d.ts +24 -0
- package/dist/src/command-line/watch/watch.js +198 -0
- package/dist/src/command-line/yargs-utils/arguments-of.d.ts +11 -0
- package/dist/src/command-line/yargs-utils/arguments-of.js +9 -0
- package/dist/src/command-line/yargs-utils/documentation.js +12 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +91 -0
- package/dist/src/command-line/yargs-utils/shared-options.js +395 -0
- package/dist/src/commands-runner/get-command-projects.js +33 -0
- package/dist/src/config/misc-interfaces.d.ts +229 -0
- package/dist/src/config/nx-json.d.ts +862 -0
- package/dist/src/config/nx-json.js +40 -0
- package/dist/src/config/schema-utils.js +126 -0
- package/dist/src/config/task-graph.d.ts +109 -0
- package/dist/src/config/workspace-json-project-json.d.ts +263 -0
- package/dist/src/core/graph/index.html +32 -0
- package/dist/src/core/graph/main.js +1 -0
- package/dist/src/core/graph/runtime.js +1 -0
- package/dist/src/core/graph/styles.css +3 -0
- package/dist/src/core/graph/styles.js +1 -0
- package/dist/src/daemon/cache.d.ts +10 -0
- package/dist/src/daemon/cache.js +58 -0
- package/dist/src/daemon/client/client.d.ts +117 -0
- package/dist/src/daemon/client/client.js +1040 -0
- package/dist/src/daemon/client/daemon-environment.d.ts +4 -0
- package/dist/src/daemon/client/daemon-environment.js +121 -0
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +12 -0
- package/dist/src/daemon/client/daemon-socket-messenger.js +54 -0
- package/dist/src/daemon/is-nx-version-mismatch.d.ts +1 -0
- package/dist/src/daemon/is-nx-version-mismatch.js +8 -0
- package/dist/src/daemon/is-v8-serializer-enabled.d.ts +5 -0
- package/dist/src/daemon/is-v8-serializer-enabled.js +10 -0
- package/dist/src/daemon/logger.d.ts +39 -0
- package/dist/src/daemon/logger.js +80 -0
- package/dist/src/daemon/message-types/configure-ai-agents.d.ts +20 -0
- package/dist/src/daemon/message-types/configure-ai-agents.js +19 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +6 -0
- package/dist/src/daemon/message-types/daemon-message.js +6 -0
- package/dist/src/daemon/message-types/nx-console.d.ts +17 -0
- package/dist/src/daemon/message-types/nx-console.js +19 -0
- package/dist/src/daemon/message-types/register-project-graph-listener.d.ts +5 -0
- package/dist/src/daemon/message-types/register-project-graph-listener.js +11 -0
- package/dist/src/daemon/message-types/streaming-messages.d.ts +14 -0
- package/dist/src/daemon/message-types/streaming-messages.js +19 -0
- package/dist/src/daemon/server/client-socket-context.d.ts +23 -0
- package/dist/src/daemon/server/client-socket-context.js +89 -0
- package/dist/src/daemon/server/file-watching/file-change-events.d.ts +7 -0
- package/dist/src/daemon/server/file-watching/file-change-events.js +19 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +66 -0
- package/dist/src/daemon/server/handle-configure-ai-agents.d.ts +3 -0
- package/dist/src/daemon/server/handle-configure-ai-agents.js +101 -0
- package/dist/src/daemon/server/handle-context-file-data.js +12 -0
- package/dist/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +11 -0
- package/dist/src/daemon/server/handle-get-files-in-directory.js +12 -0
- package/dist/src/daemon/server/handle-get-registered-sync-generators.js +11 -0
- package/dist/src/daemon/server/handle-get-sync-generator-changes.js +20 -0
- package/dist/src/daemon/server/handle-glob.js +20 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +12 -0
- package/dist/src/daemon/server/handle-hash-tasks.js +28 -0
- package/dist/src/daemon/server/handle-nx-console.d.ts +3 -0
- package/dist/src/daemon/server/handle-nx-console.js +54 -0
- package/dist/src/daemon/server/handle-nx-workspace-files.js +12 -0
- package/dist/src/daemon/server/handle-outputs-tracking.d.ts +15 -0
- package/dist/src/daemon/server/handle-outputs-tracking.js +35 -0
- package/dist/src/daemon/server/handle-process-in-background.js +32 -0
- package/dist/src/daemon/server/handle-request-project-graph.d.ts +3 -0
- package/dist/src/daemon/server/handle-request-project-graph.js +36 -0
- package/dist/src/daemon/server/handle-task-history.d.ts +13 -0
- package/dist/src/daemon/server/handle-task-history.js +30 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +19 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.js +35 -0
- package/dist/src/daemon/server/latest-nx.d.ts +10 -0
- package/dist/src/daemon/server/latest-nx.js +51 -0
- package/dist/src/daemon/server/nx-console-operations.d.ts +26 -0
- package/dist/src/daemon/server/nx-console-operations.js +97 -0
- package/dist/src/daemon/server/outputs-tracking.d.ts +23 -0
- package/dist/src/daemon/server/outputs-tracking.js +120 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +29 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +411 -0
- package/dist/src/daemon/server/project-graph-listener-sockets.d.ts +7 -0
- package/dist/src/daemon/server/project-graph-listener-sockets.js +25 -0
- package/dist/src/daemon/server/server.d.ts +10 -0
- package/dist/src/daemon/server/server.js +519 -0
- package/dist/src/daemon/server/shutdown-utils.d.ts +18 -0
- package/dist/src/daemon/server/shutdown-utils.js +152 -0
- package/dist/src/daemon/server/start.d.ts +1 -0
- package/dist/src/daemon/server/start.js +20 -0
- package/dist/src/daemon/server/sync-generators.d.ts +14 -0
- package/dist/src/daemon/server/sync-generators.js +368 -0
- package/dist/src/daemon/server/watcher.d.ts +11 -0
- package/dist/src/daemon/server/watcher.js +98 -0
- package/dist/src/daemon/socket-utils.d.ts +23 -0
- package/dist/src/daemon/socket-utils.js +96 -0
- package/dist/src/daemon/tmp-dir.d.ts +12 -0
- package/dist/src/daemon/tmp-dir.js +71 -0
- package/dist/src/devkit-exports.d.ts +139 -0
- package/dist/src/devkit-internals.d.ts +35 -0
- package/dist/src/devkit-internals.js +75 -0
- package/dist/src/executors/noop/schema.json +10 -0
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +59 -0
- package/dist/src/executors/run-commands/run-commands.impl.js +301 -0
- package/dist/src/executors/run-commands/running-tasks.d.ts +45 -0
- package/dist/src/executors/run-commands/running-tasks.js +513 -0
- package/dist/src/executors/run-commands/schema.json +198 -0
- package/dist/src/executors/run-script/run-script.impl.js +93 -0
- package/dist/src/executors/run-script/schema.json +28 -0
- package/dist/src/executors/utils/convert-nx-executor.js +83 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +19 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +81 -0
- package/dist/src/generators/tree.js +310 -0
- package/dist/src/generators/utils/generate-files.d.ts +44 -0
- package/dist/src/generators/utils/generate-files.js +114 -0
- package/dist/src/generators/utils/nx-json.d.ts +10 -0
- package/dist/src/generators/utils/nx-json.js +52 -0
- package/dist/src/generators/utils/project-configuration.js +307 -0
- package/dist/src/hasher/hash-plan-inspector.d.ts +33 -0
- package/dist/src/hasher/hash-plan-inspector.js +70 -0
- package/dist/src/hasher/hash-task.d.ts +17 -0
- package/dist/src/hasher/hash-task.js +191 -0
- package/dist/src/hasher/native-task-hasher-impl.d.ts +18 -0
- package/dist/src/hasher/native-task-hasher-impl.js +38 -0
- package/dist/src/hasher/task-hasher.d.ts +160 -0
- package/dist/src/hasher/task-hasher.js +299 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.d.ts +2 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +49 -0
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +16 -0
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +97 -0
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +2 -0
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +29 -0
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +2 -0
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +45 -0
- package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +12 -0
- package/dist/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +67 -0
- package/dist/src/migrations/update-17-0-0/move-cache-directory.js +35 -0
- package/dist/src/migrations/update-17-2-0/move-default-base.js +20 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +38 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +101 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +38 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.d.ts +2 -0
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +17 -0
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.d.ts +2 -0
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +100 -0
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.d.ts +2 -0
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +101 -0
- package/dist/src/migrations/update-22-1-0/update-nx-wrapper.d.ts +2 -0
- package/dist/src/migrations/update-22-1-0/update-nx-wrapper.js +7 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.d.ts +2 -0
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +19 -0
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +16 -0
- package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.d.ts +2 -0
- package/dist/src/migrations/update-22-6-0/enable-analytics-prompt.js +23 -0
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.d.ts +2 -0
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +16 -0
- package/dist/src/native/index.d.ts +672 -0
- package/dist/src/native/index.js +173 -0
- package/dist/src/native/native-bindings.js +635 -0
- package/dist/src/native/native-file-cache-location.js +23 -0
- package/dist/src/native/nx.wasi-browser.js +131 -0
- package/dist/src/native/nx.wasi.cjs +161 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/wasi-worker-browser.mjs +30 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +14 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +159 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +41 -0
- package/dist/src/nx-cloud/nx-cloud-tasks-runner-shell.js +41 -0
- package/dist/src/nx-cloud/update-manager.d.ts +23 -0
- package/dist/src/nx-cloud/update-manager.js +267 -0
- package/dist/src/nx-cloud/utilities/axios.d.ts +4 -0
- package/dist/src/nx-cloud/utilities/axios.js +17 -0
- package/dist/src/nx-cloud/utilities/client.d.ts +10 -0
- package/dist/src/nx-cloud/utilities/client.js +42 -0
- package/dist/src/nx-cloud/utilities/environment.js +48 -0
- package/dist/src/nx-cloud/utilities/onboarding.js +28 -0
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +5 -0
- package/dist/src/nx-cloud/utilities/url-shorten.js +84 -0
- package/dist/src/plugins/js/index.d.ts +4 -0
- package/dist/src/plugins/js/index.js +201 -0
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +14 -0
- package/dist/src/plugins/js/lock-file/bun-parser.js +936 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +38 -0
- package/dist/src/plugins/js/lock-file/lock-file.js +255 -0
- package/dist/src/plugins/js/lock-file/npm-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +544 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +660 -0
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +11 -0
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +210 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.js +38 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +873 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.d.ts +10 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.js +509 -0
- package/dist/src/plugins/js/package-json/create-package-json.js +291 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +5 -0
- package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +72 -0
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +93 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +45 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +86 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +75 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +74 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +429 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +121 -0
- package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.d.ts +2 -0
- package/dist/src/plugins/js/utils/get-workspace-packages-from-graph.js +13 -0
- package/dist/src/plugins/js/utils/register.d.ts +159 -0
- package/dist/src/plugins/js/utils/register.js +485 -0
- package/dist/src/plugins/js/utils/typescript.d.ts +23 -0
- package/dist/src/plugins/js/utils/typescript.js +142 -0
- package/dist/src/plugins/js/versions.d.ts +1 -0
- package/dist/src/plugins/js/versions.js +4 -0
- package/dist/src/plugins/package-json/create-nodes.d.ts +27 -0
- package/dist/src/plugins/package-json/create-nodes.js +239 -0
- package/dist/src/plugins/project-json/build-nodes/project-json.d.ts +5 -0
- package/dist/src/plugins/project-json/build-nodes/project-json.js +33 -0
- package/dist/src/project-graph/affected/affected-project-graph.js +90 -0
- package/dist/src/project-graph/build-project-graph.d.ts +23 -0
- package/dist/src/project-graph/build-project-graph.js +304 -0
- package/dist/src/project-graph/error-types.d.ts +140 -0
- package/dist/src/project-graph/error-types.js +419 -0
- package/dist/src/project-graph/file-utils.d.ts +24 -0
- package/dist/src/project-graph/file-utils.js +114 -0
- package/dist/src/project-graph/nx-deps-cache.d.ts +62 -0
- package/dist/src/project-graph/nx-deps-cache.js +345 -0
- package/dist/src/project-graph/plugins/get-plugins.d.ts +5 -0
- package/dist/src/project-graph/plugins/get-plugins.js +224 -0
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +10 -0
- package/dist/src/project-graph/plugins/in-process-loader.js +61 -0
- package/dist/src/project-graph/plugins/isolation/enabled.js +22 -0
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/index.js +5 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +62 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +474 -0
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +3 -0
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +24 -0
- package/dist/src/project-graph/plugins/isolation/message-types.d.ts +59 -0
- package/dist/src/project-graph/plugins/isolation/message-types.js +9 -0
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +142 -0
- package/dist/src/project-graph/plugins/isolation/messaging.js +86 -0
- package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.d.ts +82 -0
- package/dist/src/project-graph/plugins/isolation/plugin-lifecycle-manager.js +188 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +2 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +151 -0
- package/dist/src/project-graph/plugins/isolation/worker-streaming.d.ts +14 -0
- package/dist/src/project-graph/plugins/isolation/worker-streaming.js +39 -0
- package/dist/src/project-graph/plugins/load-resolved-plugin.d.ts +3 -0
- package/dist/src/project-graph/plugins/load-resolved-plugin.js +24 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +41 -0
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +101 -0
- package/dist/src/project-graph/plugins/public-api.d.ts +120 -0
- package/dist/src/project-graph/plugins/resolve-plugin.d.ts +18 -0
- package/dist/src/project-graph/plugins/resolve-plugin.js +256 -0
- package/dist/src/project-graph/plugins/transpiler.js +47 -0
- package/dist/src/project-graph/plugins/utils.d.ts +4 -0
- package/dist/src/project-graph/plugins/utils.js +32 -0
- package/dist/src/project-graph/project-graph.d.ts +54 -0
- package/dist/src/project-graph/project-graph.js +411 -0
- package/dist/src/project-graph/utils/normalize-project-nodes.d.ts +6 -0
- package/dist/src/project-graph/utils/normalize-project-nodes.js +117 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +74 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +469 -0
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +39 -0
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +264 -0
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +69 -0
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +94 -0
- package/dist/src/project-graph/utils/project-configuration/target-merging.d.ts +31 -0
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +332 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.d.ts +12 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +177 -0
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +51 -0
- package/dist/src/project-graph/utils/project-configuration-utils.js +238 -0
- package/dist/src/project-graph/utils/retrieve-workspace-files.d.ts +26 -0
- package/dist/src/tasks-runner/batch/run-batch.js +75 -0
- package/dist/src/tasks-runner/cache.d.ts +94 -0
- package/dist/src/tasks-runner/cache.js +604 -0
- package/dist/src/tasks-runner/create-task-graph.d.ts +42 -0
- package/dist/src/tasks-runner/create-task-graph.js +313 -0
- package/dist/src/tasks-runner/default-tasks-runner.js +71 -0
- package/dist/src/tasks-runner/fork.js +73 -0
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +42 -0
- package/dist/src/tasks-runner/forked-process-task-runner.js +294 -0
- package/dist/src/tasks-runner/init-tasks-runner.d.ts +22 -0
- package/dist/src/tasks-runner/init-tasks-runner.js +149 -0
- package/dist/src/tasks-runner/is-tui-enabled.d.ts +18 -0
- package/dist/src/tasks-runner/is-tui-enabled.js +91 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +75 -0
- package/dist/src/tasks-runner/life-cycle.js +141 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +366 -0
- package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +238 -0
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +109 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +11 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +91 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +16 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +112 -0
- package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.d.ts +9 -0
- package/dist/src/tasks-runner/life-cycles/task-telemetry-life-cycle.js +42 -0
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +19 -0
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +339 -0
- package/dist/src/tasks-runner/process-metrics-service.d.ts +53 -0
- package/dist/src/tasks-runner/process-metrics-service.js +161 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +156 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +57 -0
- package/dist/src/tasks-runner/pseudo-terminal.js +171 -0
- package/dist/src/tasks-runner/run-command.d.ts +42 -0
- package/dist/src/tasks-runner/run-command.js +876 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +19 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +112 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +40 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +177 -0
- package/dist/src/tasks-runner/running-tasks/noop-child-process.d.ts +16 -0
- package/dist/src/tasks-runner/running-tasks/noop-child-process.js +22 -0
- package/dist/src/tasks-runner/running-tasks/output-prefix.d.ts +13 -0
- package/dist/src/tasks-runner/running-tasks/output-prefix.js +63 -0
- package/dist/src/tasks-runner/running-tasks/running-task.d.ts +11 -0
- package/dist/src/tasks-runner/running-tasks/running-task.js +6 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/dist/src/tasks-runner/task-env-paths.d.ts +1 -0
- package/dist/src/tasks-runner/task-env-paths.js +45 -0
- package/dist/src/tasks-runner/task-env.d.ts +22 -0
- package/dist/src/tasks-runner/task-env.js +166 -0
- package/dist/src/tasks-runner/task-graph-utils.d.ts +30 -0
- package/dist/src/tasks-runner/task-graph-utils.js +225 -0
- package/dist/src/tasks-runner/task-io-service.d.ts +96 -0
- package/dist/src/tasks-runner/task-io-service.js +122 -0
- package/dist/src/tasks-runner/task-orchestrator.d.ts +179 -0
- package/dist/src/tasks-runner/task-orchestrator.js +1277 -0
- package/dist/src/tasks-runner/tasks-runner.d.ts +24 -0
- package/dist/src/tasks-runner/tasks-schedule.d.ts +48 -0
- package/dist/src/tasks-runner/tasks-schedule.js +258 -0
- package/dist/src/tasks-runner/utils.d.ts +61 -0
- package/dist/src/tasks-runner/utils.js +450 -0
- package/dist/src/utils/ab-testing.d.ts +50 -0
- package/dist/src/utils/ab-testing.js +128 -0
- package/dist/src/utils/analytics-prompt.d.ts +12 -0
- package/dist/src/utils/analytics-prompt.js +137 -0
- package/dist/src/utils/assert-workspace-validity.js +85 -0
- package/dist/src/utils/binary-extensions.d.ts +1 -0
- package/dist/src/utils/binary-extensions.js +279 -0
- package/dist/src/utils/cache-directory.d.ts +9 -0
- package/dist/src/utils/cache-directory.js +86 -0
- package/dist/src/utils/call-sites.d.ts +14 -0
- package/dist/src/utils/call-sites.js +28 -0
- package/dist/src/utils/catalog/index.d.ts +9 -0
- package/dist/src/utils/catalog/index.js +38 -0
- package/dist/src/utils/catalog/manager-factory.d.ts +5 -0
- package/dist/src/utils/catalog/manager-factory.js +20 -0
- package/dist/src/utils/catalog/manager.d.ts +40 -0
- package/dist/src/utils/catalog/manager.js +13 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +21 -0
- package/dist/src/utils/catalog/pnpm-manager.js +249 -0
- package/dist/src/utils/catalog/types.d.ts +11 -0
- package/dist/src/utils/catalog/types.js +2 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +21 -0
- package/dist/src/utils/catalog/yarn-manager.js +249 -0
- package/dist/src/utils/child-process.js +91 -0
- package/dist/src/utils/code-frames.js +116 -0
- package/dist/src/utils/collapse-expanded-outputs.d.ts +10 -0
- package/dist/src/utils/collapse-expanded-outputs.js +72 -0
- package/dist/src/utils/command-line-utils.d.ts +57 -0
- package/dist/src/utils/command-line-utils.js +249 -0
- package/dist/src/utils/compile-cache.d.ts +24 -0
- package/dist/src/utils/compile-cache.js +49 -0
- package/dist/src/utils/consume-messages-from-socket.d.ts +9 -0
- package/dist/src/utils/consume-messages-from-socket.js +56 -0
- package/dist/src/utils/db-connection.d.ts +14 -0
- package/dist/src/utils/db-connection.js +64 -0
- package/dist/src/utils/default-base.js +17 -0
- package/dist/src/utils/delayed-spinner.d.ts +51 -0
- package/dist/src/utils/delayed-spinner.js +88 -0
- package/dist/src/utils/dotenv.js +19 -0
- package/dist/src/utils/enable-compile-cache.js +7 -0
- package/dist/src/utils/exit-codes.d.ts +15 -0
- package/dist/src/utils/exit-codes.js +75 -0
- package/dist/src/utils/fileutils.js +152 -0
- package/dist/src/utils/find-matching-projects.js +222 -0
- package/dist/src/utils/git-utils.d.ts +42 -0
- package/dist/src/utils/git-utils.index-filter.js +23 -0
- package/dist/src/utils/git-utils.js +298 -0
- package/dist/src/utils/git-utils.tree-filter.js +47 -0
- package/dist/src/utils/handle-errors.js +83 -0
- package/dist/src/utils/handle-import.d.ts +12 -0
- package/dist/src/utils/handle-import.js +32 -0
- package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
- package/dist/src/utils/has-nx-js-plugin.js +24 -0
- package/dist/src/utils/ignore.d.ts +9 -0
- package/dist/src/utils/ignore.js +42 -0
- package/dist/src/utils/installation-directory.js +12 -0
- package/dist/src/utils/installed-nx-version.d.ts +8 -0
- package/dist/src/utils/installed-nx-version.js +67 -0
- package/dist/src/utils/is-ci.d.ts +1 -0
- package/dist/src/utils/is-ci.js +26 -0
- package/dist/src/utils/is-sandbox.d.ts +1 -0
- package/dist/src/utils/is-sandbox.js +9 -0
- package/dist/src/utils/logger.d.ts +23 -0
- package/dist/src/utils/logger.js +74 -0
- package/dist/src/utils/machine-id-cache.d.ts +5 -0
- package/dist/src/utils/machine-id-cache.js +93 -0
- package/dist/src/utils/nx-cloud-utils.d.ts +4 -0
- package/dist/src/utils/nx-cloud-utils.js +28 -0
- package/dist/src/utils/nx-console-prompt.d.ts +1 -0
- package/dist/src/utils/nx-console-prompt.js +64 -0
- package/dist/src/utils/nx-key.d.ts +6 -0
- package/dist/src/utils/nx-key.js +50 -0
- package/dist/src/utils/output.d.ts +79 -0
- package/dist/src/utils/output.js +264 -0
- package/dist/src/utils/package-json.d.ts +212 -0
- package/dist/src/utils/package-json.js +361 -0
- package/dist/src/utils/package-manager.d.ts +122 -0
- package/dist/src/utils/package-manager.js +577 -0
- package/dist/src/utils/params.d.ts +140 -0
- package/dist/src/utils/params.js +710 -0
- package/dist/src/utils/path.js +38 -0
- package/dist/src/utils/perf-hooks.d.ts +19 -0
- package/dist/src/utils/perf-logging.js +46 -0
- package/dist/src/utils/plugin-cache-utils.d.ts +73 -0
- package/dist/src/utils/plugin-cache-utils.js +202 -0
- package/dist/src/utils/plugin-progress-text.d.ts +1 -0
- package/dist/src/utils/plugin-progress-text.js +15 -0
- package/dist/src/utils/plugins/atomizer-utils.d.ts +11 -0
- package/dist/src/utils/plugins/atomizer-utils.js +23 -0
- package/dist/src/utils/plugins/index.d.ts +5 -0
- package/dist/src/utils/plugins/index.js +15 -0
- package/dist/src/utils/plugins/output.d.ts +34 -0
- package/dist/src/utils/plugins/output.js +201 -0
- package/dist/src/utils/plugins/plugin-capabilities.d.ts +15 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +78 -0
- package/dist/src/utils/pnpm-workspace.d.ts +8 -0
- package/dist/src/utils/pnpm-workspace.js +2 -0
- package/dist/src/utils/print-help.js +259 -0
- package/dist/src/utils/progress-topics.d.ts +19 -0
- package/dist/src/utils/progress-topics.js +21 -0
- package/dist/src/utils/project-graph-utils.d.ts +18 -0
- package/dist/src/utils/project-graph-utils.js +78 -0
- package/dist/src/utils/provenance.d.ts +47 -0
- package/dist/src/utils/provenance.js +105 -0
- package/dist/src/utils/require-nx-key.js +23 -0
- package/dist/src/utils/serialize-overrides-into-command-line.js +41 -0
- package/dist/src/utils/shell-quoting.d.ts +10 -0
- package/dist/src/utils/shell-quoting.js +41 -0
- package/dist/src/utils/spinner.d.ts +12 -0
- package/dist/src/utils/spinner.js +61 -0
- package/dist/src/utils/split-target.d.ts +15 -0
- package/dist/src/utils/split-target.js +239 -0
- package/dist/src/utils/sync-generators.d.ts +66 -0
- package/dist/src/utils/sync-generators.js +355 -0
- package/dist/src/utils/task-history.js +51 -0
- package/dist/src/utils/update-nxw.js +22 -0
- package/dist/src/utils/versions.js +4 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +15 -0
- package/dist/src/utils/wait-for-socket-connection.js +53 -0
- package/dist/src/utils/workspace-context.d.ts +21 -0
- package/dist/src/utils/workspace-context.js +120 -0
- package/dist/src/utils/workspace-root.js +40 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +6 -0
- package/dist/src/utils/write-formatted-json-file.js +23 -0
- package/dist/src/utils/yarn-syml/index.d.ts +23 -0
- package/dist/src/utils/yarn-syml/index.js +151 -0
- package/dist/src/utils/yarn-syml/syml-grammar.js +1911 -0
- package/executors.json +6 -6
- package/generators.json +8 -2
- package/migrations.json +108 -11
- package/package.json +410 -44
- package/schemas/nx-schema.json +718 -136
- package/schemas/project-schema.json +107 -12
- package/.eslintrc.json +0 -146
- package/bin/init-local.d.ts +0 -8
- package/bin/init-local.js +0 -144
- package/bin/nx.d.ts +0 -2
- package/bin/nx.js +0 -239
- package/bin/post-install.js +0 -66
- package/plugins/package-json.d.ts +0 -5
- package/plugins/package-json.js +0 -37
- package/release/changelog-renderer/index.d.ts +0 -102
- package/release/changelog-renderer/index.js +0 -339
- package/src/adapter/angular-json.js +0 -122
- package/src/adapter/compat.d.ts +0 -2
- package/src/adapter/compat.js +0 -145
- package/src/adapter/decorate-cli.d.ts +0 -1
- package/src/adapter/decorate-cli.js +0 -24
- package/src/adapter/ngcli-adapter.d.ts +0 -90
- package/src/adapter/ngcli-adapter.js +0 -854
- package/src/command-line/add/add.js +0 -123
- package/src/command-line/add/command-object.js +0 -27
- package/src/command-line/affected/affected.js +0 -88
- package/src/command-line/affected/command-object.js +0 -82
- package/src/command-line/connect/command-object.js +0 -32
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +0 -12
- package/src/command-line/connect/connect-to-nx-cloud.js +0 -149
- package/src/command-line/connect/view-logs.js +0 -55
- package/src/command-line/daemon/command-object.d.ts +0 -2
- package/src/command-line/daemon/command-object.js +0 -21
- package/src/command-line/daemon/daemon.js +0 -26
- package/src/command-line/examples.d.ts +0 -5
- package/src/command-line/examples.js +0 -375
- package/src/command-line/exec/command-object.js +0 -19
- package/src/command-line/exec/exec.js +0 -142
- package/src/command-line/format/command-object.js +0 -55
- package/src/command-line/format/format.js +0 -199
- package/src/command-line/generate/command-object.js +0 -66
- package/src/command-line/generate/generate.js +0 -264
- package/src/command-line/graph/command-object.js +0 -75
- package/src/command-line/graph/graph.d.ts +0 -68
- package/src/command-line/graph/graph.js +0 -803
- package/src/command-line/import/command-object.js +0 -44
- package/src/command-line/import/import.d.ts +0 -25
- package/src/command-line/import/import.js +0 -367
- package/src/command-line/import/utils/merge-remote-source.js +0 -14
- package/src/command-line/import/utils/prepare-source-repo.js +0 -27
- package/src/command-line/init/command-object.js +0 -99
- package/src/command-line/init/configure-plugins.js +0 -203
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +0 -6
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -130
- package/src/command-line/init/implementation/add-nx-to-nest.js +0 -345
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +0 -6
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -72
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +0 -49
- package/src/command-line/init/implementation/angular/index.js +0 -125
- package/src/command-line/init/implementation/angular/integrated-workspace.js +0 -12
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -123
- package/src/command-line/init/implementation/angular/standalone-workspace.js +0 -178
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +0 -134
- package/src/command-line/init/implementation/deduce-default-base.js +0 -53
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +0 -8
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +0 -106
- package/src/command-line/init/implementation/dot-nx/nxw.js +0 -117
- package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.d.ts +0 -1
- package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.js +0 -21
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.d.ts +0 -1
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +0 -20
- package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.d.ts +0 -1
- package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.js +0 -17
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.d.ts +0 -1
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +0 -20
- package/src/command-line/init/implementation/react/clean-up-files.d.ts +0 -1
- package/src/command-line/init/implementation/react/clean-up-files.js +0 -30
- package/src/command-line/init/implementation/react/index.d.ts +0 -4
- package/src/command-line/init/implementation/react/index.js +0 -77
- package/src/command-line/init/implementation/react/read-name-from-package-json.d.ts +0 -1
- package/src/command-line/init/implementation/react/read-name-from-package-json.js +0 -16
- package/src/command-line/init/implementation/react/rename-js-to-jsx.d.ts +0 -1
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +0 -22
- package/src/command-line/init/implementation/react/tsconfig-setup.d.ts +0 -1
- package/src/command-line/init/implementation/react/tsconfig-setup.js +0 -108
- package/src/command-line/init/implementation/react/write-vite-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-vite-config.js +0 -53
- package/src/command-line/init/implementation/react/write-vite-index-html.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-vite-index-html.js +0 -24
- package/src/command-line/init/implementation/utils.d.ts +0 -20
- package/src/command-line/init/implementation/utils.js +0 -284
- package/src/command-line/init/init-v1.d.ts +0 -11
- package/src/command-line/init/init-v1.js +0 -130
- package/src/command-line/init/init-v2.d.ts +0 -14
- package/src/command-line/init/init-v2.js +0 -257
- package/src/command-line/list/command-object.js +0 -15
- package/src/command-line/list/list.d.ts +0 -13
- package/src/command-line/list/list.js +0 -44
- package/src/command-line/login/command-object.js +0 -16
- package/src/command-line/login/login.js +0 -19
- package/src/command-line/logout/command-object.js +0 -12
- package/src/command-line/logout/logout.js +0 -16
- package/src/command-line/migrate/command-object.js +0 -77
- package/src/command-line/migrate/migrate.d.ts +0 -115
- package/src/command-line/migrate/migrate.js +0 -1202
- package/src/command-line/new/command-object.js +0 -25
- package/src/command-line/nx-commands.d.ts +0 -10
- package/src/command-line/nx-commands.js +0 -142
- package/src/command-line/register/command-object.js +0 -26
- package/src/command-line/release/changelog.d.ts +0 -35
- package/src/command-line/release/changelog.js +0 -982
- package/src/command-line/release/command-object.d.ts +0 -72
- package/src/command-line/release/command-object.js +0 -308
- package/src/command-line/release/config/config.d.ts +0 -55
- package/src/command-line/release/config/config.js +0 -994
- package/src/command-line/release/config/conventional-commits.js +0 -105
- package/src/command-line/release/config/filter-release-groups.d.ts +0 -19
- package/src/command-line/release/config/use-legacy-versioning.d.ts +0 -2
- package/src/command-line/release/config/use-legacy-versioning.js +0 -9
- package/src/command-line/release/config/version-plans.js +0 -220
- package/src/command-line/release/index.d.ts +0 -37
- package/src/command-line/release/index.js +0 -42
- package/src/command-line/release/plan-check.js +0 -172
- package/src/command-line/release/plan.js +0 -263
- package/src/command-line/release/publish.d.ts +0 -9
- package/src/command-line/release/publish.js +0 -187
- package/src/command-line/release/release.d.ts +0 -5
- package/src/command-line/release/release.js +0 -255
- package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +0 -7
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +0 -39
- package/src/command-line/release/utils/exec-command.js +0 -34
- package/src/command-line/release/utils/get-touched-projects-for-group.js +0 -78
- package/src/command-line/release/utils/git.d.ts +0 -68
- package/src/command-line/release/utils/git.js +0 -492
- package/src/command-line/release/utils/github.d.ts +0 -32
- package/src/command-line/release/utils/github.js +0 -326
- package/src/command-line/release/utils/launch-editor.js +0 -46
- package/src/command-line/release/utils/print-changes.js +0 -61
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +0 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.js +0 -30
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +0 -52
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +0 -5
- package/src/command-line/release/utils/resolve-semver-specifier.js +0 -58
- package/src/command-line/release/utils/semver.d.ts +0 -19
- package/src/command-line/release/utils/semver.js +0 -66
- package/src/command-line/release/utils/shared.d.ts +0 -47
- package/src/command-line/release/utils/shared.js +0 -219
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +0 -7
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +0 -47
- package/src/command-line/release/version/project-logger.js +0 -45
- package/src/command-line/release/version/release-group-processor.d.ts +0 -251
- package/src/command-line/release/version/release-group-processor.js +0 -1048
- package/src/command-line/release/version/resolve-current-version.d.ts +0 -32
- package/src/command-line/release/version/resolve-current-version.js +0 -241
- package/src/command-line/release/version/test-utils.d.ts +0 -95
- package/src/command-line/release/version/test-utils.js +0 -416
- package/src/command-line/release/version/topological-sort.js +0 -41
- package/src/command-line/release/version/version-actions.d.ts +0 -170
- package/src/command-line/release/version/version-actions.js +0 -183
- package/src/command-line/release/version-legacy.d.ts +0 -46
- package/src/command-line/release/version-legacy.js +0 -453
- package/src/command-line/release/version.d.ts +0 -20
- package/src/command-line/release/version.js +0 -301
- package/src/command-line/repair/command-object.js +0 -20
- package/src/command-line/repair/repair.js +0 -36
- package/src/command-line/report/command-object.js +0 -11
- package/src/command-line/report/report.d.ts +0 -61
- package/src/command-line/report/report.js +0 -339
- package/src/command-line/reset/command-object.js +0 -26
- package/src/command-line/reset/reset.js +0 -131
- package/src/command-line/run/command-object.js +0 -42
- package/src/command-line/run/executor-utils.d.ts +0 -7
- package/src/command-line/run/executor-utils.js +0 -86
- package/src/command-line/run/run-one.d.ts +0 -7
- package/src/command-line/run/run-one.js +0 -138
- package/src/command-line/run/run.js +0 -178
- package/src/command-line/run-many/command-object.js +0 -17
- package/src/command-line/run-many/run-many.js +0 -89
- package/src/command-line/show/command-object.d.ts +0 -26
- package/src/command-line/show/command-object.js +0 -115
- package/src/command-line/show/project.js +0 -82
- package/src/command-line/show/projects.js +0 -81
- package/src/command-line/sync/command-object.js +0 -20
- package/src/command-line/sync/sync.js +0 -114
- package/src/command-line/watch/command-object.js +0 -64
- package/src/command-line/watch/watch.d.ts +0 -23
- package/src/command-line/watch/watch.js +0 -173
- package/src/command-line/yargs-utils/documentation.js +0 -11
- package/src/command-line/yargs-utils/shared-options.d.ts +0 -79
- package/src/command-line/yargs-utils/shared-options.js +0 -279
- package/src/commands-runner/get-command-projects.js +0 -18
- package/src/config/misc-interfaces.d.ts +0 -200
- package/src/config/nx-json.d.ts +0 -605
- package/src/config/nx-json.js +0 -39
- package/src/config/schema-utils.js +0 -125
- package/src/config/task-graph.d.ts +0 -104
- package/src/config/workspace-json-project-json.d.ts +0 -246
- package/src/core/graph/index.html +0 -30
- package/src/core/graph/main.js +0 -1
- package/src/core/graph/runtime.js +0 -1
- package/src/core/graph/styles.css +0 -3
- package/src/core/graph/styles.js +0 -1
- package/src/daemon/cache.d.ts +0 -9
- package/src/daemon/cache.js +0 -68
- package/src/daemon/client/client.d.ts +0 -77
- package/src/daemon/client/client.js +0 -543
- package/src/daemon/client/daemon-socket-messenger.d.ts +0 -12
- package/src/daemon/client/daemon-socket-messenger.js +0 -26
- package/src/daemon/client/exec-is-server-available.js +0 -11
- package/src/daemon/client/generate-help-output.d.ts +0 -1
- package/src/daemon/client/generate-help-output.js +0 -26
- package/src/daemon/server/file-watching/file-watcher-sockets.js +0 -66
- package/src/daemon/server/handle-context-file-data.js +0 -12
- package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +0 -11
- package/src/daemon/server/handle-get-files-in-directory.js +0 -12
- package/src/daemon/server/handle-get-registered-sync-generators.js +0 -11
- package/src/daemon/server/handle-get-sync-generator-changes.js +0 -19
- package/src/daemon/server/handle-glob.js +0 -20
- package/src/daemon/server/handle-hash-tasks.d.ts +0 -10
- package/src/daemon/server/handle-hash-tasks.js +0 -35
- package/src/daemon/server/handle-nx-workspace-files.js +0 -12
- package/src/daemon/server/handle-outputs-tracking.d.ts +0 -15
- package/src/daemon/server/handle-outputs-tracking.js +0 -35
- package/src/daemon/server/handle-process-in-background.js +0 -32
- package/src/daemon/server/handle-request-project-graph.d.ts +0 -2
- package/src/daemon/server/handle-request-project-graph.js +0 -36
- package/src/daemon/server/handle-task-history.d.ts +0 -13
- package/src/daemon/server/handle-task-history.js +0 -30
- package/src/daemon/server/handle-tasks-execution-hooks.d.ts +0 -19
- package/src/daemon/server/handle-tasks-execution-hooks.js +0 -35
- package/src/daemon/server/logger.d.ts +0 -18
- package/src/daemon/server/logger.js +0 -38
- package/src/daemon/server/outputs-tracking.d.ts +0 -8
- package/src/daemon/server/outputs-tracking.js +0 -93
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +0 -24
- package/src/daemon/server/project-graph-incremental-recomputation.js +0 -300
- package/src/daemon/server/server.d.ts +0 -9
- package/src/daemon/server/server.js +0 -404
- package/src/daemon/server/shutdown-utils.d.ts +0 -17
- package/src/daemon/server/shutdown-utils.js +0 -91
- package/src/daemon/server/start.js +0 -17
- package/src/daemon/server/sync-generators.d.ts +0 -13
- package/src/daemon/server/sync-generators.js +0 -357
- package/src/daemon/server/watcher.d.ts +0 -11
- package/src/daemon/server/watcher.js +0 -103
- package/src/daemon/socket-utils.d.ts +0 -12
- package/src/daemon/socket-utils.js +0 -55
- package/src/daemon/tmp-dir.d.ts +0 -12
- package/src/daemon/tmp-dir.js +0 -70
- package/src/devkit-exports.d.ts +0 -139
- package/src/devkit-internals.d.ts +0 -28
- package/src/devkit-internals.js +0 -57
- package/src/executors/noop/schema.json +0 -10
- package/src/executors/run-commands/run-commands.impl.d.ts +0 -58
- package/src/executors/run-commands/run-commands.impl.js +0 -487
- package/src/executors/run-commands/schema.json +0 -198
- package/src/executors/run-script/run-script.impl.js +0 -57
- package/src/executors/run-script/schema.json +0 -28
- package/src/executors/utils/convert-nx-executor.js +0 -83
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -14
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -66
- package/src/generators/tree.js +0 -309
- package/src/generators/utils/nx-json.d.ts +0 -11
- package/src/generators/utils/nx-json.js +0 -58
- package/src/generators/utils/project-configuration.js +0 -289
- package/src/hasher/hash-task.d.ts +0 -8
- package/src/hasher/hash-task.js +0 -85
- package/src/hasher/native-task-hasher-impl.d.ts +0 -18
- package/src/hasher/native-task-hasher-impl.js +0 -37
- package/src/hasher/task-hasher.d.ts +0 -124
- package/src/hasher/task-hasher.js +0 -240
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/native/index.d.ts +0 -311
- package/src/native/index.js +0 -108
- package/src/native/native-bindings.js +0 -393
- package/src/native/native-file-cache-location.js +0 -22
- package/src/native/nx.wasi-browser.js +0 -117
- package/src/native/nx.wasi.cjs +0 -148
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/native/tests/__fixtures__/file-lock.fixture.js +0 -20
- package/src/native/wasi-worker-browser.mjs +0 -32
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +0 -14
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +0 -160
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +0 -41
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +0 -41
- package/src/nx-cloud/update-manager.d.ts +0 -19
- package/src/nx-cloud/update-manager.js +0 -252
- package/src/nx-cloud/utilities/axios.d.ts +0 -2
- package/src/nx-cloud/utilities/axios.js +0 -24
- package/src/nx-cloud/utilities/client.d.ts +0 -10
- package/src/nx-cloud/utilities/client.js +0 -35
- package/src/nx-cloud/utilities/environment.js +0 -47
- package/src/nx-cloud/utilities/onboarding.js +0 -28
- package/src/nx-cloud/utilities/url-shorten.d.ts +0 -10
- package/src/nx-cloud/utilities/url-shorten.js +0 -156
- package/src/plugins/js/index.d.ts +0 -4
- package/src/plugins/js/index.js +0 -106
- package/src/plugins/js/lock-file/lock-file.d.ts +0 -34
- package/src/plugins/js/lock-file/lock-file.js +0 -226
- package/src/plugins/js/lock-file/npm-parser.d.ts +0 -7
- package/src/plugins/js/lock-file/npm-parser.js +0 -475
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +0 -7
- package/src/plugins/js/lock-file/pnpm-parser.js +0 -466
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +0 -7
- package/src/plugins/js/lock-file/project-graph-pruning.js +0 -154
- package/src/plugins/js/lock-file/utils/package-json.d.ts +0 -10
- package/src/plugins/js/lock-file/utils/package-json.js +0 -35
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +0 -854
- package/src/plugins/js/lock-file/yarn-parser.d.ts +0 -7
- package/src/plugins/js/lock-file/yarn-parser.js +0 -494
- package/src/plugins/js/package-json/create-package-json.js +0 -247
- package/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +0 -4
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +0 -29
- package/src/plugins/js/project-graph/affected/npm-packages.js +0 -68
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +0 -45
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +0 -80
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +0 -88
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +0 -71
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +0 -358
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -120
- package/src/plugins/js/utils/register.d.ts +0 -156
- package/src/plugins/js/utils/register.js +0 -344
- package/src/plugins/js/utils/typescript.d.ts +0 -15
- package/src/plugins/js/utils/typescript.js +0 -98
- package/src/plugins/js/versions.d.ts +0 -1
- package/src/plugins/js/versions.js +0 -4
- package/src/plugins/package-json/create-nodes.d.ts +0 -19
- package/src/plugins/package-json/create-nodes.js +0 -209
- package/src/plugins/project-json/build-nodes/project-json.d.ts +0 -6
- package/src/plugins/project-json/build-nodes/project-json.js +0 -45
- package/src/project-graph/affected/affected-project-graph.js +0 -85
- package/src/project-graph/build-project-graph.d.ts +0 -23
- package/src/project-graph/build-project-graph.js +0 -315
- package/src/project-graph/error-types.d.ts +0 -138
- package/src/project-graph/error-types.js +0 -391
- package/src/project-graph/file-utils.d.ts +0 -30
- package/src/project-graph/file-utils.js +0 -180
- package/src/project-graph/nx-deps-cache.d.ts +0 -51
- package/src/project-graph/nx-deps-cache.js +0 -282
- package/src/project-graph/plugins/get-plugins.d.ts +0 -4
- package/src/project-graph/plugins/get-plugins.js +0 -144
- package/src/project-graph/plugins/in-process-loader.d.ts +0 -10
- package/src/project-graph/plugins/in-process-loader.js +0 -60
- package/src/project-graph/plugins/isolation/enabled.js +0 -19
- package/src/project-graph/plugins/isolation/index.d.ts +0 -3
- package/src/project-graph/plugins/isolation/index.js +0 -8
- package/src/project-graph/plugins/isolation/messaging.d.ts +0 -143
- package/src/project-graph/plugins/isolation/messaging.js +0 -50
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +0 -3
- package/src/project-graph/plugins/isolation/plugin-pool.js +0 -310
- package/src/project-graph/plugins/isolation/plugin-worker.js +0 -208
- package/src/project-graph/plugins/load-resolved-plugin.d.ts +0 -3
- package/src/project-graph/plugins/load-resolved-plugin.js +0 -22
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +0 -20
- package/src/project-graph/plugins/loaded-nx-plugin.js +0 -80
- package/src/project-graph/plugins/public-api.d.ts +0 -149
- package/src/project-graph/plugins/resolve-plugin.d.ts +0 -15
- package/src/project-graph/plugins/resolve-plugin.js +0 -134
- package/src/project-graph/plugins/transpiler.js +0 -47
- package/src/project-graph/plugins/utils.d.ts +0 -2
- package/src/project-graph/plugins/utils.js +0 -26
- package/src/project-graph/project-graph.d.ts +0 -53
- package/src/project-graph/project-graph.js +0 -327
- package/src/project-graph/utils/normalize-project-nodes.d.ts +0 -6
- package/src/project-graph/utils/normalize-project-nodes.js +0 -88
- package/src/project-graph/utils/project-configuration-utils.d.ts +0 -74
- package/src/project-graph/utils/project-configuration-utils.js +0 -811
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +0 -26
- package/src/tasks-runner/batch/run-batch.js +0 -75
- package/src/tasks-runner/cache.d.ts +0 -82
- package/src/tasks-runner/cache.js +0 -541
- package/src/tasks-runner/create-task-graph.d.ts +0 -40
- package/src/tasks-runner/create-task-graph.js +0 -270
- package/src/tasks-runner/default-tasks-runner.js +0 -80
- package/src/tasks-runner/fork.js +0 -30
- package/src/tasks-runner/forked-process-task-runner.d.ts +0 -45
- package/src/tasks-runner/forked-process-task-runner.js +0 -427
- package/src/tasks-runner/init-tasks-runner.d.ts +0 -13
- package/src/tasks-runner/init-tasks-runner.js +0 -59
- package/src/tasks-runner/life-cycle.d.ts +0 -50
- package/src/tasks-runner/life-cycle.js +0 -71
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +0 -353
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +0 -228
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +0 -106
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +0 -9
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +0 -54
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +0 -10
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +0 -55
- package/src/tasks-runner/pseudo-ipc.js +0 -140
- package/src/tasks-runner/pseudo-terminal.d.ts +0 -45
- package/src/tasks-runner/pseudo-terminal.js +0 -168
- package/src/tasks-runner/run-command.d.ts +0 -36
- package/src/tasks-runner/run-command.js +0 -623
- package/src/tasks-runner/task-env.d.ts +0 -20
- package/src/tasks-runner/task-env.js +0 -171
- package/src/tasks-runner/task-graph-utils.d.ts +0 -21
- package/src/tasks-runner/task-graph-utils.js +0 -111
- package/src/tasks-runner/task-orchestrator.d.ts +0 -53
- package/src/tasks-runner/task-orchestrator.js +0 -468
- package/src/tasks-runner/tasks-runner.d.ts +0 -23
- package/src/tasks-runner/tasks-schedule.d.ts +0 -41
- package/src/tasks-runner/tasks-schedule.js +0 -192
- package/src/tasks-runner/utils.d.ts +0 -57
- package/src/tasks-runner/utils.js +0 -394
- package/src/utils/ab-testing.d.ts +0 -51
- package/src/utils/ab-testing.js +0 -112
- package/src/utils/assert-workspace-validity.js +0 -88
- package/src/utils/cache-directory.d.ts +0 -7
- package/src/utils/cache-directory.js +0 -71
- package/src/utils/child-process.js +0 -112
- package/src/utils/code-frames.js +0 -118
- package/src/utils/collapse-expanded-outputs.d.ts +0 -1
- package/src/utils/collapse-expanded-outputs.js +0 -40
- package/src/utils/command-line-utils.d.ts +0 -56
- package/src/utils/command-line-utils.js +0 -247
- package/src/utils/consume-messages-from-socket.d.ts +0 -1
- package/src/utils/consume-messages-from-socket.js +0 -21
- package/src/utils/db-connection.d.ts +0 -6
- package/src/utils/db-connection.js +0 -29
- package/src/utils/default-base.js +0 -17
- package/src/utils/delayed-spinner.d.ts +0 -42
- package/src/utils/delayed-spinner.js +0 -80
- package/src/utils/dotenv.js +0 -21
- package/src/utils/exit-codes.d.ts +0 -5
- package/src/utils/exit-codes.js +0 -19
- package/src/utils/fileutils.js +0 -151
- package/src/utils/find-matching-projects.js +0 -222
- package/src/utils/git-utils.d.ts +0 -41
- package/src/utils/git-utils.index-filter.d.ts +0 -0
- package/src/utils/git-utils.index-filter.js +0 -21
- package/src/utils/git-utils.js +0 -259
- package/src/utils/git-utils.tree-filter.d.ts +0 -11
- package/src/utils/git-utils.tree-filter.js +0 -45
- package/src/utils/handle-errors.js +0 -82
- package/src/utils/ignore.d.ts +0 -8
- package/src/utils/ignore.js +0 -75
- package/src/utils/installation-directory.js +0 -12
- package/src/utils/is-ci.d.ts +0 -1
- package/src/utils/is-ci.js +0 -23
- package/src/utils/logger.d.ts +0 -12
- package/src/utils/logger.js +0 -52
- package/src/utils/nx-cloud-utils.d.ts +0 -3
- package/src/utils/nx-cloud-utils.js +0 -21
- package/src/utils/nx-key.d.ts +0 -7
- package/src/utils/nx-key.js +0 -52
- package/src/utils/output.d.ts +0 -71
- package/src/utils/output.js +0 -240
- package/src/utils/package-json.d.ts +0 -107
- package/src/utils/package-json.js +0 -179
- package/src/utils/package-manager.d.ts +0 -114
- package/src/utils/package-manager.js +0 -490
- package/src/utils/params.d.ts +0 -137
- package/src/utils/params.js +0 -664
- package/src/utils/path.js +0 -37
- package/src/utils/perf-logging.js +0 -13
- package/src/utils/plugins/index.d.ts +0 -4
- package/src/utils/plugins/index.js +0 -13
- package/src/utils/plugins/output.d.ts +0 -6
- package/src/utils/plugins/output.js +0 -111
- package/src/utils/plugins/plugin-capabilities.d.ts +0 -14
- package/src/utils/plugins/plugin-capabilities.js +0 -76
- package/src/utils/print-help.js +0 -258
- package/src/utils/project-graph-utils.d.ts +0 -13
- package/src/utils/project-graph-utils.js +0 -73
- package/src/utils/require-nx-key.js +0 -22
- package/src/utils/serialize-overrides-into-command-line.js +0 -42
- package/src/utils/split-target.d.ts +0 -3
- package/src/utils/split-target.js +0 -48
- package/src/utils/sync-generators.d.ts +0 -64
- package/src/utils/sync-generators.js +0 -348
- package/src/utils/task-history.js +0 -51
- package/src/utils/update-nxw.js +0 -11
- package/src/utils/versions.js +0 -4
- package/src/utils/workspace-context.d.ts +0 -21
- package/src/utils/workspace-context.js +0 -119
- package/src/utils/workspace-root.js +0 -39
- /package/{bin → dist/bin}/nx-cloud.d.ts +0 -0
- /package/{bin → dist/bin}/nx-cloud.js +0 -0
- /package/{bin → dist/bin}/post-install.d.ts +0 -0
- /package/{bin → dist/bin}/run-executor.d.ts +0 -0
- /package/{bin → dist/bin}/run-executor.js +0 -0
- /package/{presets → dist/presets}/core.json +0 -0
- /package/{presets → dist/presets}/npm.json +0 -0
- /package/{release → dist/release}/index.d.ts +0 -0
- /package/{release → dist/release}/index.js +0 -0
- /package/{src → dist/src}/adapter/angular-json.d.ts +0 -0
- /package/{src → dist/src}/adapter/rxjs-for-await.d.ts +0 -0
- /package/{src → dist/src}/adapter/rxjs-for-await.js +0 -0
- /package/{src → dist/src}/command-line/add/add.d.ts +0 -0
- /package/{src → dist/src}/command-line/add/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/affected/affected.d.ts +0 -0
- /package/{src → dist/src}/command-line/affected/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/daemon/daemon.d.ts +0 -0
- /package/{src → dist/src}/command-line/deprecated/command-objects.d.ts +0 -0
- /package/{src → dist/src}/command-line/deprecated/command-objects.js +0 -0
- /package/{src → dist/src}/command-line/exec/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/exec/exec.d.ts +0 -0
- /package/{src → dist/src}/command-line/format/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/format/format.d.ts +0 -0
- /package/{src → dist/src}/command-line/generate/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/generate/generate.d.ts +0 -0
- /package/{src → dist/src}/command-line/generate/generator-utils.d.ts +0 -0
- /package/{src → dist/src}/command-line/generate/generator-utils.js +0 -0
- /package/{src → dist/src}/command-line/graph/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/import/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/import/utils/merge-remote-source.d.ts +0 -0
- /package/{src → dist/src}/command-line/import/utils/prepare-source-repo.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/configure-plugins.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/add-nx-to-nest.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/add-nx-to-turborepo.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/index.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/integrated-workspace.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/legacy-angular-versions.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/standalone-workspace.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/types.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/angular/types.js +0 -0
- /package/{src → dist/src}/command-line/init/implementation/check-compatible-with-plugins.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/deduce-default-base.d.ts +0 -0
- /package/{src → dist/src}/command-line/init/implementation/dot-nx/nxw.d.ts +0 -0
- /package/{src → dist/src}/command-line/list/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/migrate/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/new/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/new/new.d.ts +0 -0
- /package/{src → dist/src}/command-line/new/new.js +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/connect/command-object.d.ts +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/connect/view-logs.d.ts +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/login/command-object.d.ts +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/login/login.d.ts +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/logout/command-object.d.ts +0 -0
- /package/{src/command-line → dist/src/command-line/nx-cloud}/logout/logout.d.ts +0 -0
- /package/{src → dist/src}/command-line/register/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/register/register.d.ts +0 -0
- /package/{src → dist/src}/command-line/register/register.js +0 -0
- /package/{src → dist/src}/command-line/release/config/conventional-commits.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/config/deep-merge-json.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/config/deep-merge-json.js +0 -0
- /package/{src → dist/src}/command-line/release/config/filter-release-groups.js +0 -0
- /package/{src → dist/src}/command-line/release/config/version-plans.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/plan-check.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/plan.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/exec-command.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/generate-version-plan-content.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/generate-version-plan-content.js +0 -0
- /package/{src → dist/src}/command-line/release/utils/get-touched-projects-for-group.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/launch-editor.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/markdown.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/markdown.js +0 -0
- /package/{src → dist/src}/command-line/release/utils/print-changes.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/print-config.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/print-config.js +0 -0
- /package/{src → dist/src}/command-line/release/utils/resolve-nx-json-error-message.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/shared-legacy.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/utils/shared-legacy.js +0 -0
- /package/{src → dist/src}/command-line/release/version/deriver-specifier-from-version-plans.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/version/deriver-specifier-from-version-plans.js +0 -0
- /package/{src → dist/src}/command-line/release/version/project-logger.d.ts +0 -0
- /package/{src → dist/src}/command-line/release/version/topological-sort.d.ts +0 -0
- /package/{src → dist/src}/command-line/repair/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/repair/repair.d.ts +0 -0
- /package/{src → dist/src}/command-line/report/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/reset/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/reset/reset.d.ts +0 -0
- /package/{src → dist/src}/command-line/run/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/run/run.d.ts +0 -0
- /package/{src → dist/src}/command-line/run-many/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/run-many/run-many.d.ts +0 -0
- /package/{src → dist/src}/command-line/show/project.d.ts +0 -0
- /package/{src → dist/src}/command-line/show/projects.d.ts +0 -0
- /package/{src → dist/src}/command-line/sync/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/sync/sync.d.ts +0 -0
- /package/{src → dist/src}/command-line/watch/command-object.d.ts +0 -0
- /package/{src → dist/src}/command-line/yargs-utils/documentation.d.ts +0 -0
- /package/{src → dist/src}/commands-runner/command-graph.d.ts +0 -0
- /package/{src → dist/src}/commands-runner/command-graph.js +0 -0
- /package/{src → dist/src}/commands-runner/create-command-graph.d.ts +0 -0
- /package/{src → dist/src}/commands-runner/create-command-graph.js +0 -0
- /package/{src → dist/src}/commands-runner/get-command-projects.d.ts +0 -0
- /package/{src → dist/src}/config/calculate-default-project-name.d.ts +0 -0
- /package/{src → dist/src}/config/calculate-default-project-name.js +0 -0
- /package/{src → dist/src}/config/configuration.d.ts +0 -0
- /package/{src → dist/src}/config/configuration.js +0 -0
- /package/{src → dist/src}/config/misc-interfaces.js +0 -0
- /package/{src → dist/src}/config/project-graph.d.ts +0 -0
- /package/{src → dist/src}/config/project-graph.js +0 -0
- /package/{src → dist/src}/config/schema-utils.d.ts +0 -0
- /package/{src → dist/src}/config/task-graph.js +0 -0
- /package/{src → dist/src}/config/to-project-name.d.ts +0 -0
- /package/{src → dist/src}/config/to-project-name.js +0 -0
- /package/{src → dist/src}/config/workspace-json-project-json.js +0 -0
- /package/{src → dist/src}/core/graph/environment.js +0 -0
- /package/{src → dist/src}/core/graph/favicon.ico +0 -0
- /package/{src → dist/src}/daemon/is-on-daemon.d.ts +0 -0
- /package/{src → dist/src}/daemon/is-on-daemon.js +0 -0
- /package/{src → dist/src}/daemon/message-types/flush-sync-generator-changes-to-disk.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/flush-sync-generator-changes-to-disk.js +0 -0
- /package/{src → dist/src}/daemon/message-types/force-shutdown.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/force-shutdown.js +0 -0
- /package/{src → dist/src}/daemon/message-types/get-context-file-data.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/get-context-file-data.js +0 -0
- /package/{src → dist/src}/daemon/message-types/get-files-in-directory.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/get-files-in-directory.js +0 -0
- /package/{src → dist/src}/daemon/message-types/get-nx-workspace-files.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/get-nx-workspace-files.js +0 -0
- /package/{src → dist/src}/daemon/message-types/get-registered-sync-generators.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/get-registered-sync-generators.js +0 -0
- /package/{src → dist/src}/daemon/message-types/get-sync-generator-changes.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/get-sync-generator-changes.js +0 -0
- /package/{src → dist/src}/daemon/message-types/glob.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/glob.js +0 -0
- /package/{src → dist/src}/daemon/message-types/hash-glob.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/hash-glob.js +0 -0
- /package/{src → dist/src}/daemon/message-types/run-tasks-execution-hooks.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/run-tasks-execution-hooks.js +0 -0
- /package/{src → dist/src}/daemon/message-types/task-history.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/task-history.js +0 -0
- /package/{src → dist/src}/daemon/message-types/update-workspace-context.d.ts +0 -0
- /package/{src → dist/src}/daemon/message-types/update-workspace-context.js +0 -0
- /package/{src → dist/src}/daemon/server/file-watching/changed-projects.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/file-watching/changed-projects.js +0 -0
- /package/{src → dist/src}/daemon/server/file-watching/file-watcher-sockets.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-context-file-data.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-flush-sync-generator-changes-to-disk.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-force-shutdown.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-force-shutdown.js +0 -0
- /package/{src → dist/src}/daemon/server/handle-get-files-in-directory.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-get-registered-sync-generators.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-get-sync-generator-changes.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-glob.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-hash-glob.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-hash-glob.js +0 -0
- /package/{src → dist/src}/daemon/server/handle-nx-workspace-files.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-process-in-background.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-request-shutdown.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-request-shutdown.js +0 -0
- /package/{src → dist/src}/daemon/server/handle-update-workspace-context.d.ts +0 -0
- /package/{src → dist/src}/daemon/server/handle-update-workspace-context.js +0 -0
- /package/{src → dist/src}/devkit-exports.js +0 -0
- /package/{src → dist/src}/devkit-testing-exports.d.ts +0 -0
- /package/{src → dist/src}/devkit-testing-exports.js +0 -0
- /package/{src → dist/src}/executors/noop/noop.impl.d.ts +0 -0
- /package/{src → dist/src}/executors/noop/noop.impl.js +0 -0
- /package/{src → dist/src}/executors/run-script/run-script.impl.d.ts +0 -0
- /package/{src → dist/src}/executors/utils/convert-nx-executor.d.ts +0 -0
- /package/{src → dist/src}/generators/testing-utils/create-tree-with-empty-workspace.d.ts +0 -0
- /package/{src → dist/src}/generators/testing-utils/create-tree-with-empty-workspace.js +0 -0
- /package/{src → dist/src}/generators/testing-utils/create-tree.d.ts +0 -0
- /package/{src → dist/src}/generators/testing-utils/create-tree.js +0 -0
- /package/{src → dist/src}/generators/tree.d.ts +0 -0
- /package/{src → dist/src}/generators/utils/glob.d.ts +0 -0
- /package/{src → dist/src}/generators/utils/glob.js +0 -0
- /package/{src → dist/src}/generators/utils/json.d.ts +0 -0
- /package/{src → dist/src}/generators/utils/json.js +0 -0
- /package/{src → dist/src}/generators/utils/project-configuration.d.ts +0 -0
- /package/{src → dist/src}/hasher/create-task-hasher.d.ts +0 -0
- /package/{src → dist/src}/hasher/create-task-hasher.js +0 -0
- /package/{src → dist/src}/hasher/file-hasher.d.ts +0 -0
- /package/{src → dist/src}/hasher/file-hasher.js +0 -0
- /package/{src → dist/src}/index.d.ts +0 -0
- /package/{src → dist/src}/index.js +0 -0
- /package/{src → dist/src}/migrations/update-17-0-0/move-cache-directory.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-0-0/rm-default-collection-npm-scope.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -0
- /package/{src → dist/src}/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -0
- /package/{src → dist/src}/migrations/update-17-2-0/move-default-base.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-3-0/nx-release-path.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-3-0/nx-release-path.js +0 -0
- /package/{src → dist/src}/migrations/update-17-3-0/update-nxw.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-17-3-0/update-nxw.js +0 -0
- /package/{src → dist/src}/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -0
- /package/{src → dist/src}/migrations/update-19-2-0/move-workspace-data-directory.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-19-2-0/move-workspace-data-directory.js +0 -0
- /package/{src → dist/src}/migrations/update-19-2-4/set-project-name.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-19-2-4/set-project-name.js +0 -0
- /package/{src → dist/src}/migrations/update-20-0-0/move-use-daemon-process.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-20-0-0/move-use-daemon-process.js +0 -0
- /package/{src → dist/src}/migrations/update-20-0-1/use-legacy-cache.d.ts +0 -0
- /package/{src → dist/src}/migrations/update-20-0-1/use-legacy-cache.js +0 -0
- /package/{src → dist/src}/native/assert-supported-platform.d.ts +0 -0
- /package/{src → dist/src}/native/assert-supported-platform.js +0 -0
- /package/{src → dist/src}/native/browser.js +0 -0
- /package/{src → dist/src}/native/native-file-cache-location.d.ts +0 -0
- /package/{src → dist/src}/native/transform-objects.d.ts +0 -0
- /package/{src → dist/src}/native/transform-objects.js +0 -0
- /package/{src → dist/src}/native/wasi-worker.mjs +0 -0
- /package/{src → dist/src}/nx-cloud/debug-logger.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/debug-logger.js +0 -0
- /package/{src → dist/src}/nx-cloud/models/onboarding-status.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/models/onboarding-status.js +0 -0
- /package/{src → dist/src}/nx-cloud/nx-cloud-tasks-runner-shell.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/resolution-helpers.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/resolution-helpers.js +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/environment.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/get-cloud-options.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/get-cloud-options.js +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/is-workspace-claimed.d.ts +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/is-workspace-claimed.js +0 -0
- /package/{src → dist/src}/nx-cloud/utilities/onboarding.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/hasher/hasher.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/hasher/hasher.js +0 -0
- /package/{src → dist/src}/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/package-json/create-package-json.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/affected/npm-packages.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/affected/touched-projects.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/affected/touched-projects.js +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/affected/tsconfig-json-changes.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/affected/tsconfig-json-changes.js +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-nodes/build-npm-package-nodes.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +0 -0
- /package/{src → dist/src}/plugins/js/utils/config.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/utils/config.js +0 -0
- /package/{src → dist/src}/plugins/js/utils/packages.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/utils/packages.js +0 -0
- /package/{src → dist/src}/plugins/js/utils/resolve-relative-to-dir.d.ts +0 -0
- /package/{src → dist/src}/plugins/js/utils/resolve-relative-to-dir.js +0 -0
- /package/{src → dist/src}/plugins/package-json/index.d.ts +0 -0
- /package/{src → dist/src}/plugins/package-json/index.js +0 -0
- /package/{src → dist/src}/project-graph/affected/affected-project-graph-models.d.ts +0 -0
- /package/{src → dist/src}/project-graph/affected/affected-project-graph-models.js +0 -0
- /package/{src → dist/src}/project-graph/affected/affected-project-graph.d.ts +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/project-glob-changes.d.ts +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/project-glob-changes.js +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/workspace-json-changes.d.ts +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/workspace-json-changes.js +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/workspace-projects.d.ts +0 -0
- /package/{src → dist/src}/project-graph/affected/locators/workspace-projects.js +0 -0
- /package/{src → dist/src}/project-graph/file-map-utils.d.ts +0 -0
- /package/{src → dist/src}/project-graph/file-map-utils.js +0 -0
- /package/{src → dist/src}/project-graph/operators.d.ts +0 -0
- /package/{src → dist/src}/project-graph/operators.js +0 -0
- /package/{src → dist/src}/project-graph/plugins/index.d.ts +0 -0
- /package/{src → dist/src}/project-graph/plugins/index.js +0 -0
- /package/{src → dist/src}/project-graph/plugins/isolation/enabled.d.ts +0 -0
- /package/{src → dist/src}/project-graph/plugins/public-api.js +0 -0
- /package/{src → dist/src}/project-graph/plugins/tasks-execution-hooks.d.ts +0 -0
- /package/{src → dist/src}/project-graph/plugins/tasks-execution-hooks.js +0 -0
- /package/{src → dist/src}/project-graph/plugins/transpiler.d.ts +0 -0
- /package/{src → dist/src}/project-graph/project-graph-builder.d.ts +0 -0
- /package/{src → dist/src}/project-graph/project-graph-builder.js +0 -0
- /package/{src → dist/src}/project-graph/utils/build-all-workspace-files.d.ts +0 -0
- /package/{src → dist/src}/project-graph/utils/build-all-workspace-files.js +0 -0
- /package/{src → dist/src}/project-graph/utils/find-project-for-path.d.ts +0 -0
- /package/{src → dist/src}/project-graph/utils/find-project-for-path.js +0 -0
- /package/{src → dist/src}/project-graph/utils/implicit-project-dependencies.d.ts +0 -0
- /package/{src → dist/src}/project-graph/utils/implicit-project-dependencies.js +0 -0
- /package/{src → dist/src}/project-graph/utils/retrieve-workspace-files.js +0 -0
- /package/{src → dist/src}/tasks-runner/batch/batch-messages.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/batch/batch-messages.js +0 -0
- /package/{src → dist/src}/tasks-runner/batch/run-batch.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/default-tasks-runner.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/fork.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/empty-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/formatting-utils.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/formatting-utils.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/pretty-time.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/pretty-time.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/store-run-information-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/store-run-information-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-profiling-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-results-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-results-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/task-timings-life-cycle.js +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/view-logs-utils.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/life-cycles/view-logs-utils.js +0 -0
- /package/{src → dist/src}/tasks-runner/pseudo-ipc.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/remove-old-cache-records.d.ts +0 -0
- /package/{src → dist/src}/tasks-runner/remove-old-cache-records.js +0 -0
- /package/{src → dist/src}/tasks-runner/tasks-runner.js +0 -0
- /package/{src → dist/src}/utils/all-file-data.d.ts +0 -0
- /package/{src → dist/src}/utils/all-file-data.js +0 -0
- /package/{src → dist/src}/utils/assert-workspace-validity.d.ts +0 -0
- /package/{src → dist/src}/utils/async-iterator.d.ts +0 -0
- /package/{src → dist/src}/utils/async-iterator.js +0 -0
- /package/{src → dist/src}/utils/child-process.d.ts +0 -0
- /package/{src → dist/src}/utils/chunkify.d.ts +0 -0
- /package/{src → dist/src}/utils/chunkify.js +0 -0
- /package/{src → dist/src}/utils/code-frames.d.ts +0 -0
- /package/{src → dist/src}/utils/default-base.d.ts +0 -0
- /package/{src → dist/src}/utils/dotenv.d.ts +0 -0
- /package/{src/daemon/client/exec-is-server-available.d.ts → dist/src/utils/enable-compile-cache.d.ts} +0 -0
- /package/{src → dist/src}/utils/fileutils.d.ts +0 -0
- /package/{src → dist/src}/utils/find-matching-projects.d.ts +0 -0
- /package/{src → dist/src}/utils/find-workspace-root.d.ts +0 -0
- /package/{src → dist/src}/utils/find-workspace-root.js +0 -0
- /package/{src → dist/src}/utils/get-package-name-from-import-path.d.ts +0 -0
- /package/{src → dist/src}/utils/get-package-name-from-import-path.js +0 -0
- /package/{src/daemon/server/start.d.ts → dist/src/utils/git-utils.index-filter.d.ts} +0 -0
- /package/{src/project-graph/plugins/isolation/plugin-worker.d.ts → dist/src/utils/git-utils.tree-filter.d.ts} +0 -0
- /package/{src → dist/src}/utils/globs.d.ts +0 -0
- /package/{src → dist/src}/utils/globs.js +0 -0
- /package/{src → dist/src}/utils/handle-errors.d.ts +0 -0
- /package/{src → dist/src}/utils/installation-directory.d.ts +0 -0
- /package/{src → dist/src}/utils/is-using-prettier.d.ts +0 -0
- /package/{src → dist/src}/utils/is-using-prettier.js +0 -0
- /package/{src → dist/src}/utils/json-diff.d.ts +0 -0
- /package/{src → dist/src}/utils/json-diff.js +0 -0
- /package/{src → dist/src}/utils/json.d.ts +0 -0
- /package/{src → dist/src}/utils/json.js +0 -0
- /package/{src → dist/src}/utils/legacy-task-history.d.ts +0 -0
- /package/{src → dist/src}/utils/legacy-task-history.js +0 -0
- /package/{src → dist/src}/utils/object-sort.d.ts +0 -0
- /package/{src → dist/src}/utils/object-sort.js +0 -0
- /package/{src → dist/src}/utils/path.d.ts +0 -0
- /package/{src → dist/src}/utils/perf-logging.d.ts +0 -0
- /package/{src → dist/src}/utils/plugins/core-plugins.d.ts +0 -0
- /package/{src → dist/src}/utils/plugins/core-plugins.js +0 -0
- /package/{src → dist/src}/utils/plugins/installed-plugins.d.ts +0 -0
- /package/{src → dist/src}/utils/plugins/installed-plugins.js +0 -0
- /package/{src → dist/src}/utils/plugins/local-plugins.d.ts +0 -0
- /package/{src → dist/src}/utils/plugins/local-plugins.js +0 -0
- /package/{src → dist/src}/utils/print-help.d.ts +0 -0
- /package/{src → dist/src}/utils/promised-based-queue.d.ts +0 -0
- /package/{src → dist/src}/utils/promised-based-queue.js +0 -0
- /package/{src → dist/src}/utils/require-nx-key.d.ts +0 -0
- /package/{src → dist/src}/utils/serializable-error.d.ts +0 -0
- /package/{src → dist/src}/utils/serializable-error.js +0 -0
- /package/{src → dist/src}/utils/serialize-overrides-into-command-line.d.ts +0 -0
- /package/{src → dist/src}/utils/serialize-target.d.ts +0 -0
- /package/{src → dist/src}/utils/serialize-target.js +0 -0
- /package/{src → dist/src}/utils/strip-indents.d.ts +0 -0
- /package/{src → dist/src}/utils/strip-indents.js +0 -0
- /package/{src → dist/src}/utils/task-history.d.ts +0 -0
- /package/{src → dist/src}/utils/update-nxw.d.ts +0 -0
- /package/{src → dist/src}/utils/versions.d.ts +0 -0
- /package/{src → dist/src}/utils/workspace-root.d.ts +0 -0
- /package/{tasks-runners → dist/tasks-runners}/default.d.ts +0 -0
- /package/{tasks-runners → dist/tasks-runners}/default.js +0 -0
|
@@ -0,0 +1,1608 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migrator = void 0;
|
|
4
|
+
exports.formatCommandFailure = formatCommandFailure;
|
|
5
|
+
exports.normalizeVersion = normalizeVersion;
|
|
6
|
+
exports.parseMigrationsOptions = parseMigrationsOptions;
|
|
7
|
+
exports.isNpmPeerDepsError = isNpmPeerDepsError;
|
|
8
|
+
exports.executeMigrations = executeMigrations;
|
|
9
|
+
exports.runNxOrAngularMigration = runNxOrAngularMigration;
|
|
10
|
+
exports.migrate = migrate;
|
|
11
|
+
exports.runMigration = runMigration;
|
|
12
|
+
exports.readMigrationCollection = readMigrationCollection;
|
|
13
|
+
exports.getImplementationPath = getImplementationPath;
|
|
14
|
+
exports.nxCliPath = nxCliPath;
|
|
15
|
+
const tslib_1 = require("tslib");
|
|
16
|
+
const pc = tslib_1.__importStar(require("picocolors"));
|
|
17
|
+
const child_process_1 = require("child_process");
|
|
18
|
+
const enquirer_1 = require("enquirer");
|
|
19
|
+
const handle_import_1 = require("../../utils/handle-import");
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const module_1 = require("module");
|
|
22
|
+
const path_2 = require("../../utils/path");
|
|
23
|
+
const semver_1 = require("semver");
|
|
24
|
+
const node_url_1 = require("node:url");
|
|
25
|
+
const util_1 = require("util");
|
|
26
|
+
const tree_1 = require("../../generators/tree");
|
|
27
|
+
const fileutils_1 = require("../../utils/fileutils");
|
|
28
|
+
const write_formatted_json_file_1 = require("../../utils/write-formatted-json-file");
|
|
29
|
+
const logger_1 = require("../../utils/logger");
|
|
30
|
+
const git_utils_1 = require("../../utils/git-utils");
|
|
31
|
+
const package_json_1 = require("../../utils/package-json");
|
|
32
|
+
const package_manager_1 = require("../../utils/package-manager");
|
|
33
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
|
34
|
+
const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
|
|
35
|
+
const output_1 = require("../../utils/output");
|
|
36
|
+
const fs_1 = require("fs");
|
|
37
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
|
38
|
+
const is_ci_1 = require("../../utils/is-ci");
|
|
39
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
|
40
|
+
const configuration_1 = require("../../config/configuration");
|
|
41
|
+
const child_process_2 = require("../../utils/child-process");
|
|
42
|
+
const client_1 = require("../../daemon/client/client");
|
|
43
|
+
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
|
44
|
+
const project_graph_1 = require("../../project-graph/project-graph");
|
|
45
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
46
|
+
const provenance_1 = require("../../utils/provenance");
|
|
47
|
+
const catalog_1 = require("../../utils/catalog");
|
|
48
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
49
|
+
function formatCommandFailure(command, error) {
|
|
50
|
+
const normalizeCommandOutput = (output) => {
|
|
51
|
+
if (!output) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const normalized = typeof output === 'string' ? output.trim() : output.toString().trim();
|
|
55
|
+
return normalized || undefined;
|
|
56
|
+
};
|
|
57
|
+
const details = normalizeCommandOutput(error.stderr) ||
|
|
58
|
+
normalizeCommandOutput(error.stdout) ||
|
|
59
|
+
normalizeCommandOutput(error.message)
|
|
60
|
+
?.replace(`Command failed: ${command}`, '')
|
|
61
|
+
.trim();
|
|
62
|
+
return [`Command failed: ${command}`, ...(details ? [details] : [])].join('\n');
|
|
63
|
+
}
|
|
64
|
+
function runOrReturnExitCode(run) {
|
|
65
|
+
try {
|
|
66
|
+
run();
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
if (typeof e === 'object' &&
|
|
71
|
+
e !== null &&
|
|
72
|
+
'status' in e &&
|
|
73
|
+
typeof e.status === 'number') {
|
|
74
|
+
return e.status;
|
|
75
|
+
}
|
|
76
|
+
throw e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function normalizeVersion(version) {
|
|
80
|
+
const [semver, ...prereleaseTagParts] = version.split('-');
|
|
81
|
+
// Handle versions like 1.0.0-beta-next.2
|
|
82
|
+
const prereleaseTag = prereleaseTagParts.join('-');
|
|
83
|
+
const [major, minor, patch] = semver.split('.');
|
|
84
|
+
const newSemver = `${major || 0}.${minor || 0}.${patch || 0}`;
|
|
85
|
+
const newVersion = prereleaseTag
|
|
86
|
+
? `${newSemver}-${prereleaseTag}`
|
|
87
|
+
: newSemver;
|
|
88
|
+
const withoutPatch = `${major || 0}.${minor || 0}.0`;
|
|
89
|
+
const withoutPatchAndMinor = `${major || 0}.0.0`;
|
|
90
|
+
const variationsToCheck = [
|
|
91
|
+
newVersion,
|
|
92
|
+
newSemver,
|
|
93
|
+
withoutPatch,
|
|
94
|
+
withoutPatchAndMinor,
|
|
95
|
+
];
|
|
96
|
+
for (const variation of variationsToCheck) {
|
|
97
|
+
try {
|
|
98
|
+
if ((0, semver_1.gt)(variation, '0.0.0')) {
|
|
99
|
+
return variation;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch { }
|
|
103
|
+
}
|
|
104
|
+
return '0.0.0';
|
|
105
|
+
}
|
|
106
|
+
function cleanSemver(version) {
|
|
107
|
+
return (0, semver_1.clean)(version) ?? (0, semver_1.coerce)(version);
|
|
108
|
+
}
|
|
109
|
+
function normalizeSlashes(packageName) {
|
|
110
|
+
return packageName.replace(/\\/g, '/');
|
|
111
|
+
}
|
|
112
|
+
class Migrator {
|
|
113
|
+
constructor(opts) {
|
|
114
|
+
this.packageUpdates = {};
|
|
115
|
+
this.collectedVersions = {};
|
|
116
|
+
this.promptAnswers = {};
|
|
117
|
+
this.packageJson = opts.packageJson;
|
|
118
|
+
this.nxInstallation = opts.nxInstallation;
|
|
119
|
+
this.getInstalledPackageVersion = opts.getInstalledPackageVersion;
|
|
120
|
+
this.fetch = opts.fetch;
|
|
121
|
+
this.installedPkgVersionOverrides = opts.from;
|
|
122
|
+
this.to = opts.to;
|
|
123
|
+
this.interactive = opts.interactive;
|
|
124
|
+
this.excludeAppliedMigrations = opts.excludeAppliedMigrations;
|
|
125
|
+
}
|
|
126
|
+
async fetchMigrationConfig(packageName, packageVersion) {
|
|
127
|
+
const migrationConfig = await this.fetch(packageName, packageVersion);
|
|
128
|
+
if (!migrationConfig.version) {
|
|
129
|
+
throw new Error(`Fetched migration metadata for ${packageName} is invalid: the target version is missing.`);
|
|
130
|
+
}
|
|
131
|
+
return migrationConfig;
|
|
132
|
+
}
|
|
133
|
+
async migrate(targetPackage, targetVersion) {
|
|
134
|
+
await this.buildPackageJsonUpdates(targetPackage, {
|
|
135
|
+
version: targetVersion,
|
|
136
|
+
addToPackageJson: false,
|
|
137
|
+
});
|
|
138
|
+
const migrations = await this.createMigrateJson();
|
|
139
|
+
return {
|
|
140
|
+
packageUpdates: this.packageUpdates,
|
|
141
|
+
migrations,
|
|
142
|
+
minVersionWithSkippedUpdates: this.minVersionWithSkippedUpdates,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async createMigrateJson() {
|
|
146
|
+
const migrations = await Promise.all(Object.keys(this.packageUpdates).map(async (packageName) => {
|
|
147
|
+
if (this.packageUpdates[packageName].ignoreMigrations) {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
const currentVersion = this.getPkgVersion(packageName);
|
|
151
|
+
if (currentVersion === null)
|
|
152
|
+
return [];
|
|
153
|
+
const { version } = this.packageUpdates[packageName];
|
|
154
|
+
const { generators } = await this.fetchMigrationConfig(packageName, version);
|
|
155
|
+
if (!generators)
|
|
156
|
+
return [];
|
|
157
|
+
return Object.entries(generators)
|
|
158
|
+
.filter(([, migration]) => migration.version &&
|
|
159
|
+
this.gt(migration.version, currentVersion) &&
|
|
160
|
+
this.lte(migration.version, version) &&
|
|
161
|
+
this.areMigrationRequirementsMet(packageName, migration))
|
|
162
|
+
.map(([migrationName, migration]) => ({
|
|
163
|
+
...migration,
|
|
164
|
+
package: packageName,
|
|
165
|
+
name: migrationName,
|
|
166
|
+
}));
|
|
167
|
+
}));
|
|
168
|
+
return migrations.flat();
|
|
169
|
+
}
|
|
170
|
+
async buildPackageJsonUpdates(targetPackage, target) {
|
|
171
|
+
const packagesToCheck = await this.populatePackageJsonUpdatesAndGetPackagesToCheck(targetPackage, target);
|
|
172
|
+
for (const packageToCheck of packagesToCheck) {
|
|
173
|
+
const filteredUpdates = {};
|
|
174
|
+
for (const [packageUpdateKey, packageUpdate] of Object.entries(packageToCheck.updates)) {
|
|
175
|
+
if (this.areRequirementsMet(packageUpdate.requires) &&
|
|
176
|
+
!this.areIncompatiblePackagesPresent(packageUpdate.incompatibleWith) &&
|
|
177
|
+
(!this.interactive ||
|
|
178
|
+
(await this.runPackageJsonUpdatesConfirmationPrompt(packageUpdate, packageUpdateKey, packageToCheck.package)))) {
|
|
179
|
+
Object.entries(packageUpdate.packages).forEach(([name, update]) => {
|
|
180
|
+
this.validatePackageUpdateVersion(packageToCheck.package, name, update);
|
|
181
|
+
filteredUpdates[name] = update;
|
|
182
|
+
this.packageUpdates[name] = update;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
await Promise.all(Object.entries(filteredUpdates).map(([name, update]) => this.buildPackageJsonUpdates(name, update)));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async populatePackageJsonUpdatesAndGetPackagesToCheck(targetPackage, target) {
|
|
190
|
+
let targetVersion = target.version;
|
|
191
|
+
if (this.to[targetPackage]) {
|
|
192
|
+
targetVersion = this.to[targetPackage];
|
|
193
|
+
}
|
|
194
|
+
if (!this.getPkgVersion(targetPackage)) {
|
|
195
|
+
this.addPackageUpdate(targetPackage, {
|
|
196
|
+
version: target.version,
|
|
197
|
+
addToPackageJson: target.addToPackageJson || false,
|
|
198
|
+
...(target.ignoreMigrations && { ignoreMigrations: true }),
|
|
199
|
+
});
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
let migrationConfig;
|
|
203
|
+
try {
|
|
204
|
+
migrationConfig = await this.fetchMigrationConfig(targetPackage, targetVersion);
|
|
205
|
+
}
|
|
206
|
+
catch (e) {
|
|
207
|
+
if (e?.message?.includes('No matching version')) {
|
|
208
|
+
throw new Error(`${e.message}\nRun migrate with --to="package1@version1,package2@version2"`);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
throw e;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
targetVersion = migrationConfig.version;
|
|
215
|
+
if (this.collectedVersions[targetPackage] &&
|
|
216
|
+
(0, semver_1.gte)(this.collectedVersions[targetPackage], targetVersion)) {
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
this.collectedVersions[targetPackage] = targetVersion;
|
|
220
|
+
this.addPackageUpdate(targetPackage, {
|
|
221
|
+
version: migrationConfig.version,
|
|
222
|
+
addToPackageJson: target.addToPackageJson || false,
|
|
223
|
+
...(target.ignoreMigrations && { ignoreMigrations: true }),
|
|
224
|
+
});
|
|
225
|
+
const { packageJsonUpdates, packageGroupOrder } = this.getPackageJsonUpdatesFromMigrationConfig(targetPackage, targetVersion, migrationConfig, target.ignorePackageGroup);
|
|
226
|
+
if (!Object.keys(packageJsonUpdates).length) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
const shouldCheckUpdates = Object.values(packageJsonUpdates).some((packageJsonUpdate) => (this.interactive && packageJsonUpdate['x-prompt']) ||
|
|
230
|
+
Object.keys(packageJsonUpdate.requires ?? {}).length ||
|
|
231
|
+
Object.keys(packageJsonUpdate.incompatibleWith ?? {}).length);
|
|
232
|
+
if (shouldCheckUpdates) {
|
|
233
|
+
return [{ package: targetPackage, updates: packageJsonUpdates }];
|
|
234
|
+
}
|
|
235
|
+
const packageUpdatesToApply = Object.values(packageJsonUpdates).reduce((m, c) => ({ ...m, ...c.packages }), {});
|
|
236
|
+
return (await Promise.all(Object.entries(packageUpdatesToApply).map(([packageName, packageUpdate]) => {
|
|
237
|
+
this.validatePackageUpdateVersion(targetPackage, packageName, packageUpdate);
|
|
238
|
+
return this.populatePackageJsonUpdatesAndGetPackagesToCheck(packageName, packageUpdate);
|
|
239
|
+
})))
|
|
240
|
+
.filter((pkgs) => pkgs.length)
|
|
241
|
+
.flat()
|
|
242
|
+
.sort((pkgUpdate1, pkgUpdate2) => packageGroupOrder.indexOf(pkgUpdate1.package) -
|
|
243
|
+
packageGroupOrder.indexOf(pkgUpdate2.package));
|
|
244
|
+
}
|
|
245
|
+
getPackageJsonUpdatesFromMigrationConfig(packageName, targetVersion, migrationConfig, ignorePackageGroup) {
|
|
246
|
+
const packageGroupOrder = this.getPackageJsonUpdatesFromPackageGroup(packageName, targetVersion, migrationConfig, ignorePackageGroup);
|
|
247
|
+
if (!migrationConfig.packageJsonUpdates ||
|
|
248
|
+
!this.getPkgVersion(packageName)) {
|
|
249
|
+
return { packageJsonUpdates: {}, packageGroupOrder };
|
|
250
|
+
}
|
|
251
|
+
const packageJsonUpdates = this.filterPackageJsonUpdates(migrationConfig.packageJsonUpdates, packageName, targetVersion);
|
|
252
|
+
return { packageJsonUpdates, packageGroupOrder };
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Mutates migrationConfig, adding package group updates into packageJsonUpdates section
|
|
256
|
+
*
|
|
257
|
+
* @param packageName Package which is being migrated
|
|
258
|
+
* @param targetVersion Version which is being migrated to
|
|
259
|
+
* @param migrationConfig Configuration which is mutated to contain package json updates
|
|
260
|
+
* @returns Order of package groups
|
|
261
|
+
*/
|
|
262
|
+
getPackageJsonUpdatesFromPackageGroup(packageName, targetVersion, migrationConfig, ignorePackageGroup) {
|
|
263
|
+
if (ignorePackageGroup) {
|
|
264
|
+
return [];
|
|
265
|
+
}
|
|
266
|
+
const packageGroup = packageName === '@nrwl/workspace' && (0, semver_1.lt)(targetVersion, '14.0.0-beta.0')
|
|
267
|
+
? LEGACY_NRWL_PACKAGE_GROUP
|
|
268
|
+
: (migrationConfig.packageGroup ?? []);
|
|
269
|
+
let packageGroupOrder = [];
|
|
270
|
+
if (packageGroup.length) {
|
|
271
|
+
packageGroupOrder = packageGroup.map((packageConfig) => packageConfig.package);
|
|
272
|
+
migrationConfig.packageJsonUpdates ??= {};
|
|
273
|
+
const packages = {};
|
|
274
|
+
migrationConfig.packageJsonUpdates[targetVersion + '--PackageGroup'] = {
|
|
275
|
+
version: targetVersion,
|
|
276
|
+
packages,
|
|
277
|
+
};
|
|
278
|
+
for (const packageConfig of packageGroup) {
|
|
279
|
+
packages[packageConfig.package] = {
|
|
280
|
+
version: packageConfig.version === '*'
|
|
281
|
+
? targetVersion
|
|
282
|
+
: packageConfig.version,
|
|
283
|
+
alwaysAddToPackageJson: false,
|
|
284
|
+
};
|
|
285
|
+
if (packageConfig.version === '*' &&
|
|
286
|
+
this.installedPkgVersionOverrides[packageName]) {
|
|
287
|
+
this.installedPkgVersionOverrides[packageConfig.package] ??=
|
|
288
|
+
this.installedPkgVersionOverrides[packageName];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return packageGroupOrder;
|
|
293
|
+
}
|
|
294
|
+
filterPackageJsonUpdates(packageJsonUpdates, packageName, targetVersion) {
|
|
295
|
+
const filteredPackageJsonUpdates = {};
|
|
296
|
+
for (const [packageJsonUpdateKey, packageJsonUpdate] of Object.entries(packageJsonUpdates)) {
|
|
297
|
+
if (!packageJsonUpdate.packages ||
|
|
298
|
+
this.lt(packageJsonUpdate.version, this.getPkgVersion(packageName)) ||
|
|
299
|
+
this.gt(packageJsonUpdate.version, targetVersion)) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
const dependencies = {
|
|
303
|
+
...this.packageJson?.dependencies,
|
|
304
|
+
...this.packageJson?.devDependencies,
|
|
305
|
+
...this.nxInstallation?.plugins,
|
|
306
|
+
...(this.nxInstallation && { nx: this.nxInstallation.version }),
|
|
307
|
+
};
|
|
308
|
+
const filtered = {};
|
|
309
|
+
for (const [packageName, packageUpdate] of Object.entries(packageJsonUpdate.packages)) {
|
|
310
|
+
if (this.shouldApplyPackageUpdate(packageUpdate, packageName, dependencies)) {
|
|
311
|
+
filtered[packageName] = {
|
|
312
|
+
version: packageUpdate.version,
|
|
313
|
+
addToPackageJson: packageUpdate.alwaysAddToPackageJson
|
|
314
|
+
? typeof packageUpdate.alwaysAddToPackageJson === 'string'
|
|
315
|
+
? packageUpdate.alwaysAddToPackageJson
|
|
316
|
+
: 'dependencies'
|
|
317
|
+
: packageUpdate.addToPackageJson || false,
|
|
318
|
+
...(packageUpdate.ignorePackageGroup && {
|
|
319
|
+
ignorePackageGroup: true,
|
|
320
|
+
}),
|
|
321
|
+
...(packageUpdate.ignoreMigrations && {
|
|
322
|
+
ignoreMigrations: true,
|
|
323
|
+
}),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (Object.keys(filtered).length) {
|
|
328
|
+
packageJsonUpdate.packages = filtered;
|
|
329
|
+
filteredPackageJsonUpdates[packageJsonUpdateKey] = packageJsonUpdate;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return filteredPackageJsonUpdates;
|
|
333
|
+
}
|
|
334
|
+
shouldApplyPackageUpdate(packageUpdate, packageName, dependencies) {
|
|
335
|
+
return ((!packageUpdate.ifPackageInstalled ||
|
|
336
|
+
this.getPkgVersion(packageUpdate.ifPackageInstalled)) &&
|
|
337
|
+
(packageUpdate.alwaysAddToPackageJson ||
|
|
338
|
+
packageUpdate.addToPackageJson ||
|
|
339
|
+
!!dependencies?.[packageName]) &&
|
|
340
|
+
(!this.collectedVersions[packageName] ||
|
|
341
|
+
this.gt(packageUpdate.version, this.collectedVersions[packageName])));
|
|
342
|
+
}
|
|
343
|
+
validatePackageUpdateVersion(sourcePackageName, packageName, packageUpdate) {
|
|
344
|
+
if (!packageUpdate.version) {
|
|
345
|
+
throw new Error(`Fetched migration metadata for ${sourcePackageName} is invalid: the target version for ${packageName} is missing.`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
addPackageUpdate(name, packageUpdate) {
|
|
349
|
+
if (!this.packageUpdates[name] ||
|
|
350
|
+
this.gt(packageUpdate.version, this.packageUpdates[name].version)) {
|
|
351
|
+
this.packageUpdates[name] = packageUpdate;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
areRequirementsMet(requirements) {
|
|
355
|
+
if (!requirements || !Object.keys(requirements).length) {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
return Object.entries(requirements).every(([pkgName, versionRange]) => {
|
|
359
|
+
if (this.packageUpdates[pkgName]) {
|
|
360
|
+
return (0, semver_1.satisfies)(cleanSemver(this.packageUpdates[pkgName].version), versionRange, { includePrerelease: true });
|
|
361
|
+
}
|
|
362
|
+
return (this.getPkgVersion(pkgName) &&
|
|
363
|
+
(0, semver_1.satisfies)(this.getPkgVersion(pkgName), versionRange, {
|
|
364
|
+
includePrerelease: true,
|
|
365
|
+
}));
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
areIncompatiblePackagesPresent(incompatibleWith) {
|
|
369
|
+
if (!incompatibleWith || !Object.keys(incompatibleWith).length) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
return Object.entries(incompatibleWith).some(([pkgName, versionRange]) => {
|
|
373
|
+
if (this.packageUpdates[pkgName]) {
|
|
374
|
+
return (0, semver_1.satisfies)(cleanSemver(this.packageUpdates[pkgName].version), versionRange, { includePrerelease: true });
|
|
375
|
+
}
|
|
376
|
+
return (this.getPkgVersion(pkgName) &&
|
|
377
|
+
(0, semver_1.satisfies)(this.getPkgVersion(pkgName), versionRange, {
|
|
378
|
+
includePrerelease: true,
|
|
379
|
+
}));
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
areMigrationRequirementsMet(packageName, migration) {
|
|
383
|
+
if (!this.excludeAppliedMigrations) {
|
|
384
|
+
return this.areRequirementsMet(migration.requires);
|
|
385
|
+
}
|
|
386
|
+
return ((this.wasMigrationSkipped(migration.requires) ||
|
|
387
|
+
this.isMigrationForHigherVersionThanWhatIsInstalled(packageName, migration)) &&
|
|
388
|
+
this.areRequirementsMet(migration.requires));
|
|
389
|
+
}
|
|
390
|
+
isMigrationForHigherVersionThanWhatIsInstalled(packageName, migration) {
|
|
391
|
+
const installedVersion = this.getInstalledPackageVersion(packageName);
|
|
392
|
+
return (migration.version &&
|
|
393
|
+
(!installedVersion || this.gt(migration.version, installedVersion)) &&
|
|
394
|
+
this.lte(migration.version, this.packageUpdates[packageName].version));
|
|
395
|
+
}
|
|
396
|
+
wasMigrationSkipped(requirements) {
|
|
397
|
+
// no requiremets, so it ran before
|
|
398
|
+
if (!requirements || !Object.keys(requirements).length) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
// at least a requirement was not met, it was skipped
|
|
402
|
+
return Object.entries(requirements).some(([pkgName, versionRange]) => !this.getInstalledPackageVersion(pkgName) ||
|
|
403
|
+
!(0, semver_1.satisfies)(this.getInstalledPackageVersion(pkgName), versionRange, {
|
|
404
|
+
includePrerelease: true,
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
async runPackageJsonUpdatesConfirmationPrompt(packageUpdate, packageUpdateKey, packageName) {
|
|
408
|
+
if (!packageUpdate['x-prompt']) {
|
|
409
|
+
return Promise.resolve(true);
|
|
410
|
+
}
|
|
411
|
+
const promptKey = this.getPackageUpdatePromptKey(packageUpdate);
|
|
412
|
+
if (this.promptAnswers[promptKey] !== undefined) {
|
|
413
|
+
// a same prompt was already answered, skip
|
|
414
|
+
return Promise.resolve(false);
|
|
415
|
+
}
|
|
416
|
+
const promptConfig = {
|
|
417
|
+
name: 'shouldApply',
|
|
418
|
+
type: 'confirm',
|
|
419
|
+
message: packageUpdate['x-prompt'],
|
|
420
|
+
initial: true,
|
|
421
|
+
};
|
|
422
|
+
if (packageName.startsWith('@nx/')) {
|
|
423
|
+
// @ts-expect-error -- enquirer types aren't correct, footer does exist
|
|
424
|
+
promptConfig.footer = () => pc.dim(` View migration details at https://nx.dev/nx-api/${packageName.replace('@nx/', '')}#${packageUpdateKey.replace(/[-\.]/g, '')}packageupdates`);
|
|
425
|
+
}
|
|
426
|
+
return await (0, enquirer_1.prompt)([promptConfig]).then(({ shouldApply }) => {
|
|
427
|
+
this.promptAnswers[promptKey] = shouldApply;
|
|
428
|
+
if (!shouldApply &&
|
|
429
|
+
(!this.minVersionWithSkippedUpdates ||
|
|
430
|
+
(0, semver_1.lt)(packageUpdate.version, this.minVersionWithSkippedUpdates))) {
|
|
431
|
+
this.minVersionWithSkippedUpdates = packageUpdate.version;
|
|
432
|
+
}
|
|
433
|
+
return shouldApply;
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
getPackageUpdatePromptKey(packageUpdate) {
|
|
437
|
+
return Object.entries(packageUpdate.packages)
|
|
438
|
+
.map(([name, update]) => `${name}:${JSON.stringify(update)}`)
|
|
439
|
+
.join('|');
|
|
440
|
+
}
|
|
441
|
+
getPkgVersion(pkg) {
|
|
442
|
+
return this.getInstalledPackageVersion(pkg, this.installedPkgVersionOverrides);
|
|
443
|
+
}
|
|
444
|
+
gt(v1, v2) {
|
|
445
|
+
return (0, semver_1.gt)(normalizeVersion(v1), normalizeVersion(v2));
|
|
446
|
+
}
|
|
447
|
+
lt(v1, v2) {
|
|
448
|
+
return (0, semver_1.lt)(normalizeVersion(v1), normalizeVersion(v2));
|
|
449
|
+
}
|
|
450
|
+
lte(v1, v2) {
|
|
451
|
+
return (0, semver_1.lte)(normalizeVersion(v1), normalizeVersion(v2));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
exports.Migrator = Migrator;
|
|
455
|
+
const LEGACY_NRWL_PACKAGE_GROUP = [
|
|
456
|
+
{ package: '@nrwl/workspace', version: '*' },
|
|
457
|
+
{ package: '@nrwl/angular', version: '*' },
|
|
458
|
+
{ package: '@nrwl/cypress', version: '*' },
|
|
459
|
+
{ package: '@nrwl/devkit', version: '*' },
|
|
460
|
+
{ package: '@nrwl/eslint-plugin-nx', version: '*' },
|
|
461
|
+
{ package: '@nrwl/express', version: '*' },
|
|
462
|
+
{ package: '@nrwl/jest', version: '*' },
|
|
463
|
+
{ package: '@nrwl/linter', version: '*' },
|
|
464
|
+
{ package: '@nrwl/nest', version: '*' },
|
|
465
|
+
{ package: '@nrwl/next', version: '*' },
|
|
466
|
+
{ package: '@nrwl/node', version: '*' },
|
|
467
|
+
{ package: '@nrwl/nx-plugin', version: '*' },
|
|
468
|
+
{ package: '@nrwl/react', version: '*' },
|
|
469
|
+
{ package: '@nrwl/storybook', version: '*' },
|
|
470
|
+
{ package: '@nrwl/web', version: '*' },
|
|
471
|
+
{ package: '@nrwl/js', version: '*' },
|
|
472
|
+
{ package: 'nx-cloud', version: 'latest' },
|
|
473
|
+
{ package: '@nrwl/react-native', version: '*' },
|
|
474
|
+
{ package: '@nrwl/detox', version: '*' },
|
|
475
|
+
{ package: '@nrwl/expo', version: '*' },
|
|
476
|
+
{ package: '@nrwl/tao', version: '*' },
|
|
477
|
+
];
|
|
478
|
+
async function normalizeVersionWithTagCheck(pkg, version) {
|
|
479
|
+
// This doesn't seem like a valid version, lets check if its a tag on the registry.
|
|
480
|
+
if (version && !(0, semver_1.parse)(version)) {
|
|
481
|
+
try {
|
|
482
|
+
return (0, package_manager_1.resolvePackageVersionUsingRegistry)(pkg, version);
|
|
483
|
+
}
|
|
484
|
+
catch {
|
|
485
|
+
// fall through to old logic
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return normalizeVersion(version);
|
|
489
|
+
}
|
|
490
|
+
async function versionOverrides(overrides, param) {
|
|
491
|
+
const res = {};
|
|
492
|
+
const promises = overrides.split(',').map((p) => {
|
|
493
|
+
const split = p.lastIndexOf('@');
|
|
494
|
+
if (split === -1 || split === 0) {
|
|
495
|
+
throw new Error(`Incorrect '${param}' section. Use --${param}="package@version"`);
|
|
496
|
+
}
|
|
497
|
+
const selectedPackage = p.substring(0, split).trim();
|
|
498
|
+
const selectedVersion = p.substring(split + 1).trim();
|
|
499
|
+
if (!selectedPackage || !selectedVersion) {
|
|
500
|
+
throw new Error(`Incorrect '${param}' section. Use --${param}="package@version"`);
|
|
501
|
+
}
|
|
502
|
+
return normalizeVersionWithTagCheck(selectedPackage, selectedVersion).then((version) => {
|
|
503
|
+
res[normalizeSlashes(selectedPackage)] = version;
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
await Promise.all(promises);
|
|
507
|
+
return res;
|
|
508
|
+
}
|
|
509
|
+
async function parseTargetPackageAndVersion(args) {
|
|
510
|
+
if (!args) {
|
|
511
|
+
throw new Error(`Provide the correct package name and version. E.g., my-package@9.0.0.`);
|
|
512
|
+
}
|
|
513
|
+
if (args.indexOf('@') > -1) {
|
|
514
|
+
const i = args.lastIndexOf('@');
|
|
515
|
+
if (i === 0) {
|
|
516
|
+
const targetPackage = args.trim();
|
|
517
|
+
const targetVersion = 'latest';
|
|
518
|
+
return { targetPackage, targetVersion };
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
const targetPackage = args.substring(0, i);
|
|
522
|
+
const maybeVersion = args.substring(i + 1);
|
|
523
|
+
if (!targetPackage || !maybeVersion) {
|
|
524
|
+
throw new Error(`Provide the correct package name and version. E.g., my-package@9.0.0.`);
|
|
525
|
+
}
|
|
526
|
+
const targetVersion = await normalizeVersionWithTagCheck(targetPackage, maybeVersion);
|
|
527
|
+
return { targetPackage, targetVersion };
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
if (args === 'latest' ||
|
|
532
|
+
args === 'next' ||
|
|
533
|
+
args === 'canary' ||
|
|
534
|
+
(0, semver_1.valid)(args) ||
|
|
535
|
+
args.match(/^\d+(?:\.\d+)?(?:\.\d+)?$/)) {
|
|
536
|
+
// Passing `nx` here may seem wrong, but nx and @nrwl/workspace are synced in version.
|
|
537
|
+
// We could duplicate the ternary below, but its not necessary since they are equivalent
|
|
538
|
+
// on the registry
|
|
539
|
+
const targetVersion = await normalizeVersionWithTagCheck('nx', args);
|
|
540
|
+
const targetPackage = !['latest', 'next', 'canary'].includes(args) &&
|
|
541
|
+
(0, semver_1.lt)(targetVersion, '14.0.0-beta.0')
|
|
542
|
+
? '@nrwl/workspace'
|
|
543
|
+
: 'nx';
|
|
544
|
+
return {
|
|
545
|
+
targetPackage,
|
|
546
|
+
targetVersion,
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
return {
|
|
551
|
+
targetPackage: args,
|
|
552
|
+
targetVersion: 'latest',
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
async function parseMigrationsOptions(options) {
|
|
558
|
+
if (options.runMigrations === '') {
|
|
559
|
+
options.runMigrations = 'migrations.json';
|
|
560
|
+
}
|
|
561
|
+
if (!options.runMigrations) {
|
|
562
|
+
const [from, to] = await Promise.all([
|
|
563
|
+
options.from
|
|
564
|
+
? versionOverrides(options.from, 'from')
|
|
565
|
+
: Promise.resolve({}),
|
|
566
|
+
options.to
|
|
567
|
+
? await versionOverrides(options.to, 'to')
|
|
568
|
+
: Promise.resolve({}),
|
|
569
|
+
]);
|
|
570
|
+
const { targetPackage, targetVersion } = await parseTargetPackageAndVersion(options['packageAndVersion']);
|
|
571
|
+
return {
|
|
572
|
+
type: 'generateMigrations',
|
|
573
|
+
targetPackage: normalizeSlashes(targetPackage),
|
|
574
|
+
targetVersion,
|
|
575
|
+
from,
|
|
576
|
+
to,
|
|
577
|
+
interactive: options.interactive,
|
|
578
|
+
excludeAppliedMigrations: options.excludeAppliedMigrations,
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
return {
|
|
583
|
+
type: 'runMigrations',
|
|
584
|
+
runMigrations: options.runMigrations,
|
|
585
|
+
ifExists: options.ifExists,
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function createInstalledPackageVersionsResolver(root) {
|
|
590
|
+
const cache = {};
|
|
591
|
+
const nxRequires = (0, installation_directory_1.getNxRequirePaths)(root).map((path) => (0, module_1.createRequire)((0, path_1.join)(path, 'package.json')));
|
|
592
|
+
function getInstalledPackageVersion(packageName, overrides) {
|
|
593
|
+
if (overrides?.[packageName]) {
|
|
594
|
+
return overrides[packageName];
|
|
595
|
+
}
|
|
596
|
+
if (packageName === 'nx') {
|
|
597
|
+
const nxVersion = cache[packageName] ??
|
|
598
|
+
(() => {
|
|
599
|
+
for (const req of nxRequires) {
|
|
600
|
+
try {
|
|
601
|
+
const packageJsonPath = req.resolve('nx/package.json');
|
|
602
|
+
if (packageJsonPath.startsWith(workspace_root_1.workspaceRoot)) {
|
|
603
|
+
return (0, fileutils_1.readJsonFile)(packageJsonPath).version;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
catch { }
|
|
607
|
+
}
|
|
608
|
+
return getInstalledPackageVersion('@nrwl/workspace', overrides);
|
|
609
|
+
})();
|
|
610
|
+
if (nxVersion) {
|
|
611
|
+
cache[packageName] = nxVersion;
|
|
612
|
+
}
|
|
613
|
+
return nxVersion;
|
|
614
|
+
}
|
|
615
|
+
try {
|
|
616
|
+
if (!cache[packageName]) {
|
|
617
|
+
const { packageJson, path } = (0, package_json_1.readModulePackageJson)(packageName, (0, installation_directory_1.getNxRequirePaths)(root));
|
|
618
|
+
// old workspaces would have the temp installation of nx in the cache,
|
|
619
|
+
// so the resolved package is not the one we need
|
|
620
|
+
if (!path.startsWith(workspace_root_1.workspaceRoot)) {
|
|
621
|
+
throw new Error('Resolved a package outside the workspace root.');
|
|
622
|
+
}
|
|
623
|
+
cache[packageName] = packageJson.version;
|
|
624
|
+
}
|
|
625
|
+
return cache[packageName];
|
|
626
|
+
}
|
|
627
|
+
catch {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return getInstalledPackageVersion;
|
|
632
|
+
}
|
|
633
|
+
// testing-fetch-start
|
|
634
|
+
function createFetcher() {
|
|
635
|
+
const migrationsCache = {};
|
|
636
|
+
const resolvedVersionCache = {};
|
|
637
|
+
function fetchMigrations(packageName, packageVersion, setCache) {
|
|
638
|
+
if (process.env.NX_MIGRATE_SKIP_REGISTRY_FETCH === 'true') {
|
|
639
|
+
// Skip registry fetch and use installation method directly
|
|
640
|
+
logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
|
|
641
|
+
return getPackageMigrationsUsingInstall(packageName, packageVersion);
|
|
642
|
+
}
|
|
643
|
+
const cacheKey = packageName + '-' + packageVersion;
|
|
644
|
+
return Promise.resolve(resolvedVersionCache[cacheKey])
|
|
645
|
+
.then((cachedResolvedVersion) => {
|
|
646
|
+
if (cachedResolvedVersion) {
|
|
647
|
+
return cachedResolvedVersion;
|
|
648
|
+
}
|
|
649
|
+
resolvedVersionCache[cacheKey] = (0, package_manager_1.resolvePackageVersionUsingRegistry)(packageName, packageVersion);
|
|
650
|
+
return resolvedVersionCache[cacheKey];
|
|
651
|
+
})
|
|
652
|
+
.then((resolvedVersion) => {
|
|
653
|
+
if (resolvedVersion !== packageVersion &&
|
|
654
|
+
migrationsCache[`${packageName}-${resolvedVersion}`]) {
|
|
655
|
+
return migrationsCache[`${packageName}-${resolvedVersion}`];
|
|
656
|
+
}
|
|
657
|
+
setCache(packageName, resolvedVersion);
|
|
658
|
+
return getPackageMigrationsUsingRegistry(packageName, resolvedVersion);
|
|
659
|
+
})
|
|
660
|
+
.catch((e) => {
|
|
661
|
+
logger_1.logger.verbose(`Failed to get migrations from registry for ${packageName}@${packageVersion}: ${e.message}. Falling back to install.`);
|
|
662
|
+
logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
|
|
663
|
+
return getPackageMigrationsUsingInstall(packageName, packageVersion);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return function nxMigrateFetcher(packageName, packageVersion) {
|
|
667
|
+
if (migrationsCache[`${packageName}-${packageVersion}`]) {
|
|
668
|
+
return migrationsCache[`${packageName}-${packageVersion}`];
|
|
669
|
+
}
|
|
670
|
+
let resolvedVersion = packageVersion;
|
|
671
|
+
let migrations;
|
|
672
|
+
function setCache(packageName, packageVersion) {
|
|
673
|
+
migrationsCache[packageName + '-' + packageVersion] = migrations;
|
|
674
|
+
}
|
|
675
|
+
migrations = fetchMigrations(packageName, packageVersion, setCache).then((result) => {
|
|
676
|
+
if (result.schematics) {
|
|
677
|
+
result.generators = { ...result.schematics, ...result.generators };
|
|
678
|
+
delete result.schematics;
|
|
679
|
+
}
|
|
680
|
+
resolvedVersion = result.version;
|
|
681
|
+
return result;
|
|
682
|
+
});
|
|
683
|
+
setCache(packageName, packageVersion);
|
|
684
|
+
return migrations;
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
// testing-fetch-end
|
|
688
|
+
async function getPackageMigrationsUsingRegistry(packageName, packageVersion) {
|
|
689
|
+
if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
|
|
690
|
+
await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
|
|
691
|
+
}
|
|
692
|
+
// check if there are migrations in the packages by looking at the
|
|
693
|
+
// registry directly
|
|
694
|
+
const migrationsConfig = await getPackageMigrationsConfigFromRegistry(packageName, packageVersion);
|
|
695
|
+
if (!migrationsConfig) {
|
|
696
|
+
return {
|
|
697
|
+
name: packageName,
|
|
698
|
+
version: packageVersion,
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (!migrationsConfig.migrations) {
|
|
702
|
+
return {
|
|
703
|
+
name: packageName,
|
|
704
|
+
version: packageVersion,
|
|
705
|
+
packageGroup: migrationsConfig.packageGroup,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
logger_1.logger.info(`Fetching ${packageName}@${packageVersion}`);
|
|
709
|
+
// try to obtain the migrations from the registry directly
|
|
710
|
+
return await downloadPackageMigrationsFromRegistry(packageName, packageVersion, migrationsConfig);
|
|
711
|
+
}
|
|
712
|
+
async function getPackageMigrationsConfigFromRegistry(packageName, packageVersion) {
|
|
713
|
+
const result = await (0, package_manager_1.packageRegistryView)(packageName, packageVersion, 'nx-migrations ng-update dist --json');
|
|
714
|
+
if (!result) {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
const json = JSON.parse(result);
|
|
718
|
+
if (!json['nx-migrations'] && !json['ng-update']) {
|
|
719
|
+
const registry = new node_url_1.URL('dist' in json ? json.dist.tarball : json.tarball)
|
|
720
|
+
.hostname;
|
|
721
|
+
// Registries other than npmjs and the local registry may not support full metadata via npm view
|
|
722
|
+
// so throw error so that fetcher falls back to getting config via install
|
|
723
|
+
if (!['registry.npmjs.org', 'localhost', 'artifactory'].some((v) => registry.includes(v))) {
|
|
724
|
+
throw new Error(`Getting migration config from registry is not supported from ${registry}`);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return (0, package_json_1.readNxMigrateConfig)(json);
|
|
728
|
+
}
|
|
729
|
+
async function downloadPackageMigrationsFromRegistry(packageName, packageVersion, { migrations: migrationsFilePath, packageGroup, }) {
|
|
730
|
+
const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
|
|
731
|
+
let result;
|
|
732
|
+
try {
|
|
733
|
+
const { tarballPath } = await (0, package_manager_1.packageRegistryPack)(dir, packageName, packageVersion);
|
|
734
|
+
const migrations = await (0, fileutils_1.extractFileFromTarball)((0, path_1.join)(dir, tarballPath), (0, path_2.joinPathFragments)('package', migrationsFilePath), (0, path_1.join)(dir, migrationsFilePath)).then((path) => (0, fileutils_1.readJsonFile)(path));
|
|
735
|
+
result = { ...migrations, packageGroup, version: packageVersion };
|
|
736
|
+
}
|
|
737
|
+
catch {
|
|
738
|
+
throw new Error(`Failed to find migrations file "${migrationsFilePath}" in package "${packageName}@${packageVersion}".`);
|
|
739
|
+
}
|
|
740
|
+
finally {
|
|
741
|
+
await cleanup();
|
|
742
|
+
}
|
|
743
|
+
return result;
|
|
744
|
+
}
|
|
745
|
+
function createConcurrencyLimiter(concurrency) {
|
|
746
|
+
const queue = [];
|
|
747
|
+
let active = 0;
|
|
748
|
+
function next() {
|
|
749
|
+
while (queue.length > 0 && active < concurrency) {
|
|
750
|
+
active++;
|
|
751
|
+
queue.shift()();
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return function limit(fn) {
|
|
755
|
+
return new Promise((resolve, reject) => {
|
|
756
|
+
queue.push(() => {
|
|
757
|
+
fn()
|
|
758
|
+
.then(resolve, reject)
|
|
759
|
+
.finally(() => {
|
|
760
|
+
active--;
|
|
761
|
+
next();
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
next();
|
|
765
|
+
});
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
const installConcurrencyLimit = process.env.NX_MIGRATE_INSTALL_CONCURRENCY
|
|
769
|
+
? createConcurrencyLimiter(Math.max(1, Math.floor(Number(process.env.NX_MIGRATE_INSTALL_CONCURRENCY)) || 1))
|
|
770
|
+
: null;
|
|
771
|
+
async function getPackageMigrationsUsingInstall(packageName, packageVersion) {
|
|
772
|
+
const run = () => getPackageMigrationsUsingInstallImpl(packageName, packageVersion);
|
|
773
|
+
return installConcurrencyLimit ? installConcurrencyLimit(run) : run();
|
|
774
|
+
}
|
|
775
|
+
async function getPackageMigrationsUsingInstallImpl(packageName, packageVersion) {
|
|
776
|
+
const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
|
|
777
|
+
let result;
|
|
778
|
+
if ((0, provenance_1.getNxPackageGroup)().includes(packageName)) {
|
|
779
|
+
await (0, provenance_1.ensurePackageHasProvenance)(packageName, packageVersion);
|
|
780
|
+
}
|
|
781
|
+
try {
|
|
782
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)((0, package_manager_1.detectPackageManager)(dir), dir);
|
|
783
|
+
await execAsync(`${pmc.add} ${packageName}@${packageVersion}`, {
|
|
784
|
+
cwd: dir,
|
|
785
|
+
env: {
|
|
786
|
+
...process.env,
|
|
787
|
+
npm_config_legacy_peer_deps: 'true',
|
|
788
|
+
},
|
|
789
|
+
});
|
|
790
|
+
const { migrations: migrationsFilePath, packageGroup, packageJson, } = readPackageMigrationConfig(packageName, dir);
|
|
791
|
+
let migrations = undefined;
|
|
792
|
+
if (migrationsFilePath) {
|
|
793
|
+
migrations = (0, fileutils_1.readJsonFile)(migrationsFilePath);
|
|
794
|
+
}
|
|
795
|
+
result = { ...migrations, packageGroup, version: packageJson.version };
|
|
796
|
+
}
|
|
797
|
+
catch (e) {
|
|
798
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)((0, package_manager_1.detectPackageManager)(dir), dir);
|
|
799
|
+
throw new Error([
|
|
800
|
+
`Failed to fetch migrations for ${packageName}@${packageVersion}`,
|
|
801
|
+
formatCommandFailure(`${pmc.add} ${packageName}@${packageVersion}`, e),
|
|
802
|
+
].join('\n'));
|
|
803
|
+
}
|
|
804
|
+
finally {
|
|
805
|
+
await cleanup();
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
}
|
|
809
|
+
function readPackageMigrationConfig(packageName, dir) {
|
|
810
|
+
const { path: packageJsonPath, packageJson: json } = (0, package_json_1.readModulePackageJson)(packageName, (0, installation_directory_1.getNxRequirePaths)(dir));
|
|
811
|
+
const config = (0, package_json_1.readNxMigrateConfig)(json);
|
|
812
|
+
if (!config) {
|
|
813
|
+
return { packageJson: json, migrations: null, packageGroup: [] };
|
|
814
|
+
}
|
|
815
|
+
try {
|
|
816
|
+
const migrationFile = require.resolve(config.migrations, {
|
|
817
|
+
paths: [(0, path_1.dirname)(packageJsonPath)],
|
|
818
|
+
});
|
|
819
|
+
return {
|
|
820
|
+
packageJson: json,
|
|
821
|
+
migrations: migrationFile,
|
|
822
|
+
packageGroup: config.packageGroup,
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
catch {
|
|
826
|
+
return {
|
|
827
|
+
packageJson: json,
|
|
828
|
+
migrations: null,
|
|
829
|
+
packageGroup: config.packageGroup,
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
async function createMigrationsFile(root, migrations) {
|
|
834
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)((0, path_1.join)(root, 'migrations.json'), { migrations });
|
|
835
|
+
}
|
|
836
|
+
async function updatePackageJson(root, updatedPackages) {
|
|
837
|
+
const packageJsonPath = (0, path_1.join)(root, 'package.json');
|
|
838
|
+
if (!(0, fs_1.existsSync)(packageJsonPath)) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
const parseOptions = {};
|
|
842
|
+
const json = (0, fileutils_1.readJsonFile)(packageJsonPath, parseOptions);
|
|
843
|
+
const manager = (0, catalog_1.getCatalogManager)(root);
|
|
844
|
+
const catalogUpdates = [];
|
|
845
|
+
Object.keys(updatedPackages).forEach((p) => {
|
|
846
|
+
const existingVersion = json.dependencies?.[p] ?? json.devDependencies?.[p];
|
|
847
|
+
if (existingVersion && manager?.isCatalogReference(existingVersion)) {
|
|
848
|
+
const { catalogName } = manager.parseCatalogReference(existingVersion);
|
|
849
|
+
catalogUpdates.push({
|
|
850
|
+
packageName: p,
|
|
851
|
+
version: updatedPackages[p].version,
|
|
852
|
+
catalogName,
|
|
853
|
+
});
|
|
854
|
+
// don't overwrite the catalog reference with the new version
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
// Update non-catalog packages in package.json
|
|
858
|
+
if (json.devDependencies?.[p]) {
|
|
859
|
+
json.devDependencies[p] = updatedPackages[p].version;
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
if (json.dependencies?.[p]) {
|
|
863
|
+
json.dependencies[p] = updatedPackages[p].version;
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
const dependencyType = updatedPackages[p].addToPackageJson;
|
|
867
|
+
if (typeof dependencyType === 'string') {
|
|
868
|
+
json[dependencyType] ??= {};
|
|
869
|
+
json[dependencyType][p] = updatedPackages[p].version;
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)(packageJsonPath, json, {
|
|
873
|
+
appendNewLine: parseOptions.endsWithNewline,
|
|
874
|
+
});
|
|
875
|
+
// Update catalog definitions
|
|
876
|
+
if (catalogUpdates.length) {
|
|
877
|
+
// manager is guaranteed to be defined when there are catalog updates
|
|
878
|
+
manager.updateCatalogVersions(root, catalogUpdates);
|
|
879
|
+
await formatCatalogDefinitionFiles(manager, root);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
async function formatCatalogDefinitionFiles(manager, root) {
|
|
883
|
+
const catalogDefinitionFilePaths = manager.getCatalogDefinitionFilePaths();
|
|
884
|
+
const catalogDefinitionFiles = catalogDefinitionFilePaths.map((filePath) => {
|
|
885
|
+
const absolutePath = (0, path_1.join)(root, filePath);
|
|
886
|
+
return {
|
|
887
|
+
path: filePath,
|
|
888
|
+
absolutePath,
|
|
889
|
+
content: (0, fs_1.readFileSync)(absolutePath, 'utf-8'),
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
const results = await (0, format_changed_files_with_prettier_if_available_1.formatFilesWithPrettierIfAvailable)(catalogDefinitionFiles.map(({ path, content }) => ({ path, content })), root, { silent: true });
|
|
893
|
+
for (const { path, absolutePath, content } of catalogDefinitionFiles) {
|
|
894
|
+
(0, fs_1.writeFileSync)(absolutePath, results.has(path) ? results.get(path) : content, { encoding: 'utf-8' });
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
async function updateInstallationDetails(root, updatedPackages) {
|
|
898
|
+
const nxJsonPath = (0, path_1.join)(root, 'nx.json');
|
|
899
|
+
const parseOptions = {};
|
|
900
|
+
const nxJson = (0, fileutils_1.readJsonFile)(nxJsonPath, parseOptions);
|
|
901
|
+
if (!nxJson.installation) {
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
const nxVersion = updatedPackages.nx?.version;
|
|
905
|
+
if (nxVersion) {
|
|
906
|
+
nxJson.installation.version = nxVersion;
|
|
907
|
+
}
|
|
908
|
+
if (nxJson.installation.plugins) {
|
|
909
|
+
for (const dep in nxJson.installation.plugins) {
|
|
910
|
+
const update = updatedPackages[dep];
|
|
911
|
+
if (update) {
|
|
912
|
+
nxJson.installation.plugins[dep] = (0, semver_1.valid)(update.version)
|
|
913
|
+
? update.version
|
|
914
|
+
: await (0, package_manager_1.resolvePackageVersionUsingRegistry)(dep, update.version);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
await (0, write_formatted_json_file_1.writeFormattedJsonFile)(nxJsonPath, nxJson, {
|
|
919
|
+
appendNewLine: parseOptions.endsWithNewline,
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
async function isMigratingToNewMajor(from, to) {
|
|
923
|
+
from = normalizeVersion(from);
|
|
924
|
+
to = ['latest', 'next', 'canary'].includes(to) ? to : normalizeVersion(to);
|
|
925
|
+
if (!(0, semver_1.valid)(from)) {
|
|
926
|
+
from = await (0, package_manager_1.resolvePackageVersionUsingRegistry)('nx', from);
|
|
927
|
+
}
|
|
928
|
+
if (!(0, semver_1.valid)(to)) {
|
|
929
|
+
to = await (0, package_manager_1.resolvePackageVersionUsingRegistry)('nx', to);
|
|
930
|
+
}
|
|
931
|
+
return (0, semver_1.major)(from) < (0, semver_1.major)(to);
|
|
932
|
+
}
|
|
933
|
+
function readNxVersion(packageJson, root) {
|
|
934
|
+
return ((0, package_json_1.getDependencyVersionFromPackageJson)('nx', root, packageJson) ??
|
|
935
|
+
(0, package_json_1.getDependencyVersionFromPackageJson)('@nx/workspace', root, packageJson) ??
|
|
936
|
+
(0, package_json_1.getDependencyVersionFromPackageJson)('@nrwl/workspace', root, packageJson));
|
|
937
|
+
}
|
|
938
|
+
async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
|
|
939
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
940
|
+
try {
|
|
941
|
+
const rootPkgJsonPath = (0, path_1.join)(root, 'package.json');
|
|
942
|
+
let originalPackageJson = (0, fs_1.existsSync)(rootPkgJsonPath)
|
|
943
|
+
? (0, fileutils_1.readJsonFile)(rootPkgJsonPath)
|
|
944
|
+
: null;
|
|
945
|
+
const originalNxJson = (0, configuration_1.readNxJson)();
|
|
946
|
+
const from = originalNxJson.installation?.version ??
|
|
947
|
+
readNxVersion(originalPackageJson, root);
|
|
948
|
+
logger_1.logger.info(`Fetching meta data about packages.`);
|
|
949
|
+
logger_1.logger.info(`It may take a few minutes.`);
|
|
950
|
+
const migrator = new Migrator({
|
|
951
|
+
packageJson: originalPackageJson,
|
|
952
|
+
nxInstallation: originalNxJson.installation,
|
|
953
|
+
getInstalledPackageVersion: createInstalledPackageVersionsResolver(root),
|
|
954
|
+
fetch: createFetcher(),
|
|
955
|
+
from: opts.from,
|
|
956
|
+
to: opts.to,
|
|
957
|
+
interactive: opts.interactive && !(0, is_ci_1.isCI)(),
|
|
958
|
+
excludeAppliedMigrations: opts.excludeAppliedMigrations,
|
|
959
|
+
});
|
|
960
|
+
const { migrations, packageUpdates, minVersionWithSkippedUpdates } = await migrator.migrate(opts.targetPackage, opts.targetVersion);
|
|
961
|
+
await updatePackageJson(root, packageUpdates);
|
|
962
|
+
await updateInstallationDetails(root, packageUpdates);
|
|
963
|
+
if (migrations.length > 0) {
|
|
964
|
+
await createMigrationsFile(root, [
|
|
965
|
+
...addSplitConfigurationMigrationIfAvailable(from, packageUpdates),
|
|
966
|
+
...migrations,
|
|
967
|
+
]);
|
|
968
|
+
}
|
|
969
|
+
output_1.output.success({
|
|
970
|
+
title: `The migrate command has run successfully.`,
|
|
971
|
+
bodyLines: [
|
|
972
|
+
`- package.json has been updated.`,
|
|
973
|
+
migrations.length > 0
|
|
974
|
+
? `- migrations.json has been generated.`
|
|
975
|
+
: `- There are no migrations to run, so migrations.json has not been created.`,
|
|
976
|
+
],
|
|
977
|
+
});
|
|
978
|
+
try {
|
|
979
|
+
if (opts.interactive !== false &&
|
|
980
|
+
['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
|
|
981
|
+
(await isMigratingToNewMajor(from, opts.targetVersion)) &&
|
|
982
|
+
!(0, is_ci_1.isCI)() &&
|
|
983
|
+
!(0, nx_cloud_utils_1.isNxCloudDisabled)(originalNxJson) &&
|
|
984
|
+
!(0, nx_cloud_utils_1.isNxCloudUsed)(originalNxJson)) {
|
|
985
|
+
output_1.output.success({
|
|
986
|
+
title: 'Connect to Nx Cloud',
|
|
987
|
+
bodyLines: [
|
|
988
|
+
'Nx Cloud is a first-party CI companion for Nx projects. It improves critical aspects of CI:',
|
|
989
|
+
'- Speed: 30% - 70% faster CI',
|
|
990
|
+
'- Cost: 40% - 75% reduction in CI costs',
|
|
991
|
+
'- Reliability: by automatically identifying flaky tasks and re-running them',
|
|
992
|
+
],
|
|
993
|
+
});
|
|
994
|
+
await (0, connect_to_nx_cloud_1.connectToNxCloudWithPrompt)('migrate');
|
|
995
|
+
originalPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
catch {
|
|
999
|
+
// The above code is to remind folks when updating to a new major and not currently using Nx cloud.
|
|
1000
|
+
// If for some reason it fails, it shouldn't affect the overall migration process
|
|
1001
|
+
}
|
|
1002
|
+
const bodyLines = process.env['NX_CONSOLE']
|
|
1003
|
+
? [
|
|
1004
|
+
'- Inspect the package.json changes in the built-in diff editor [Click to open]',
|
|
1005
|
+
'- Confirm the changes to install the new dependencies and continue the migration',
|
|
1006
|
+
]
|
|
1007
|
+
: [
|
|
1008
|
+
`- Make sure package.json changes make sense and then run '${pmc.install}',`,
|
|
1009
|
+
...(migrations.length > 0
|
|
1010
|
+
? [`- Run '${pmc.exec} nx migrate --run-migrations'`]
|
|
1011
|
+
: []),
|
|
1012
|
+
...(opts.interactive && minVersionWithSkippedUpdates
|
|
1013
|
+
? [
|
|
1014
|
+
`- You opted out of some migrations for now. Write the following command down somewhere to apply these migrations later:`,
|
|
1015
|
+
` nx migrate ${opts.targetVersion} --from ${opts.targetPackage}@${minVersionWithSkippedUpdates} --exclude-applied-migrations`,
|
|
1016
|
+
`- To learn more go to https://nx.dev/recipes/tips-n-tricks/advanced-update`,
|
|
1017
|
+
]
|
|
1018
|
+
: [
|
|
1019
|
+
`- To learn more go to https://nx.dev/features/automate-updating-dependencies`,
|
|
1020
|
+
]),
|
|
1021
|
+
...(showConnectToCloudMessage()
|
|
1022
|
+
? [
|
|
1023
|
+
`- You may run '${pmc.run('nx', 'connect-to-nx-cloud')}' to get faster builds, GitHub integration, and more. Check out https://nx.app`,
|
|
1024
|
+
]
|
|
1025
|
+
: []),
|
|
1026
|
+
];
|
|
1027
|
+
output_1.output.log({
|
|
1028
|
+
title: 'Next steps:',
|
|
1029
|
+
bodyLines,
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
catch (e) {
|
|
1033
|
+
output_1.output.error({
|
|
1034
|
+
title: `The migrate command failed.`,
|
|
1035
|
+
});
|
|
1036
|
+
throw e;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
function addSplitConfigurationMigrationIfAvailable(from, packageJson) {
|
|
1040
|
+
if (!packageJson['@nrwl/workspace'])
|
|
1041
|
+
return [];
|
|
1042
|
+
if ((0, semver_1.gte)(packageJson['@nrwl/workspace'].version, '15.7.0-beta.0') &&
|
|
1043
|
+
(0, semver_1.lt)(normalizeVersion(from), '15.7.0-beta.0')) {
|
|
1044
|
+
return [
|
|
1045
|
+
{
|
|
1046
|
+
version: '15.7.0-beta.0',
|
|
1047
|
+
description: 'Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.',
|
|
1048
|
+
implementation: './src/migrations/update-15-7-0/split-configuration-into-project-json-files',
|
|
1049
|
+
package: '@nrwl/workspace',
|
|
1050
|
+
name: '15-7-0-split-configuration-into-project-json-files',
|
|
1051
|
+
},
|
|
1052
|
+
];
|
|
1053
|
+
}
|
|
1054
|
+
else {
|
|
1055
|
+
return [];
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function showConnectToCloudMessage() {
|
|
1059
|
+
try {
|
|
1060
|
+
const nxJson = (0, configuration_1.readNxJson)();
|
|
1061
|
+
const defaultRunnerIsUsed = (0, connect_to_nx_cloud_1.onlyDefaultRunnerIsUsed)(nxJson);
|
|
1062
|
+
return !!defaultRunnerIsUsed;
|
|
1063
|
+
}
|
|
1064
|
+
catch {
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
function runInstall(nxWorkspaceRoot, phase = 'pre-migration') {
|
|
1069
|
+
const cwd = nxWorkspaceRoot ?? process.cwd();
|
|
1070
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(cwd);
|
|
1071
|
+
const pmCommands = (0, package_manager_1.getPackageManagerCommand)(packageManager, cwd);
|
|
1072
|
+
const installCommand = `${pmCommands.install} ${pmCommands.ignoreScriptsFlag ?? ''}`;
|
|
1073
|
+
output_1.output.log({
|
|
1074
|
+
title: `Running '${installCommand}' to make sure necessary packages are installed`,
|
|
1075
|
+
});
|
|
1076
|
+
return new Promise((resolve, reject) => {
|
|
1077
|
+
// For npm, pipe stderr so we can detect peer dependency errors while still
|
|
1078
|
+
// mirroring it live to the user's terminal. Other package managers inherit
|
|
1079
|
+
// stderr directly since we don't need to inspect their output.
|
|
1080
|
+
const shouldCaptureStderr = packageManager === 'npm';
|
|
1081
|
+
const child = (0, child_process_1.spawn)(installCommand, {
|
|
1082
|
+
shell: true,
|
|
1083
|
+
stdio: ['inherit', 'inherit', shouldCaptureStderr ? 'pipe' : 'inherit'],
|
|
1084
|
+
windowsHide: true,
|
|
1085
|
+
cwd,
|
|
1086
|
+
});
|
|
1087
|
+
const stderrChunks = [];
|
|
1088
|
+
child.stderr?.on('data', (chunk) => {
|
|
1089
|
+
process.stderr.write(chunk);
|
|
1090
|
+
stderrChunks.push(chunk);
|
|
1091
|
+
});
|
|
1092
|
+
child.on('error', reject);
|
|
1093
|
+
child.on('close', (code) => {
|
|
1094
|
+
if (code === 0) {
|
|
1095
|
+
resolve();
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
if (shouldCaptureStderr) {
|
|
1099
|
+
const stderr = Buffer.concat(stderrChunks).toString().trim();
|
|
1100
|
+
if (isNpmPeerDepsError(stderr)) {
|
|
1101
|
+
// Log the remediation guidance here so every caller of `runInstall`
|
|
1102
|
+
// (CLI migrate, `nx repair`, single-migration runner, etc.) surfaces
|
|
1103
|
+
// it consistently. Top-level callers catch `NpmPeerDepsInstallError`
|
|
1104
|
+
// and return a non-zero exit code without re-logging.
|
|
1105
|
+
logNpmPeerDepsError(phase);
|
|
1106
|
+
reject(new NpmPeerDepsInstallError());
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
reject(new Error(`Command failed: ${installCommand}`));
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
class NpmPeerDepsInstallError extends Error {
|
|
1115
|
+
constructor() {
|
|
1116
|
+
super('npm install failed due to peer dependency conflicts.');
|
|
1117
|
+
this.name = 'NpmPeerDepsInstallError';
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Detects npm peer-dependency resolution failures. Keyed on the `ERESOLVE`
|
|
1122
|
+
* error code, which npm consistently emits for this class of failure across
|
|
1123
|
+
* v7+ (`npm ERR! code ERESOLVE` / `npm error code ERESOLVE`). Falls back to a
|
|
1124
|
+
* small set of stable phrases in case the code line is missing from the
|
|
1125
|
+
* captured output.
|
|
1126
|
+
*/
|
|
1127
|
+
function isNpmPeerDepsError(stderr) {
|
|
1128
|
+
if (/\bERESOLVE\b/.test(stderr)) {
|
|
1129
|
+
return true;
|
|
1130
|
+
}
|
|
1131
|
+
const lowerStderr = stderr.toLowerCase();
|
|
1132
|
+
return (lowerStderr.includes('unable to resolve dependency tree') ||
|
|
1133
|
+
lowerStderr.includes('could not resolve dependency') ||
|
|
1134
|
+
lowerStderr.includes('conflicting peer dependency'));
|
|
1135
|
+
}
|
|
1136
|
+
function logNpmPeerDepsError(phase) {
|
|
1137
|
+
const peerDepsResolutionSteps = [
|
|
1138
|
+
'Recommended approaches (in order of preference):',
|
|
1139
|
+
'',
|
|
1140
|
+
'1. Use "overrides" in package.json to force compatible versions across the dependency tree.',
|
|
1141
|
+
' See https://docs.npmjs.com/cli/configuring-npm/package-json#overrides',
|
|
1142
|
+
'2. Persist legacy peer deps resolution in the project ".npmrc":',
|
|
1143
|
+
' npm config set legacy-peer-deps=true --location=project',
|
|
1144
|
+
' (bypasses peer dependency resolution; use with caution)',
|
|
1145
|
+
'3. As a last resort, force the installation by running "npm install --force".',
|
|
1146
|
+
' (does not persist and may produce broken installs)',
|
|
1147
|
+
];
|
|
1148
|
+
const manualInstallHint = [
|
|
1149
|
+
'If you installed the dependencies manually, pass "--skip-install" to avoid re-installing them:',
|
|
1150
|
+
' nx migrate --run-migrations --skip-install',
|
|
1151
|
+
];
|
|
1152
|
+
if (phase === 'pre-migration') {
|
|
1153
|
+
output_1.output.error({
|
|
1154
|
+
title: 'You need to resolve the peer dependency conflicts before the migration can continue',
|
|
1155
|
+
bodyLines: [
|
|
1156
|
+
...peerDepsResolutionSteps,
|
|
1157
|
+
'',
|
|
1158
|
+
'Once the conflicts are resolved, re-run the migrations:',
|
|
1159
|
+
' nx migrate --run-migrations',
|
|
1160
|
+
'',
|
|
1161
|
+
...manualInstallHint,
|
|
1162
|
+
],
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
output_1.output.error({
|
|
1167
|
+
title: 'Some migrations have been applied, but installing the updated dependencies failed',
|
|
1168
|
+
bodyLines: [
|
|
1169
|
+
...peerDepsResolutionSteps,
|
|
1170
|
+
'',
|
|
1171
|
+
'Once the conflicts are resolved, run "npm install" to install the updated dependencies.',
|
|
1172
|
+
'If the migration was interrupted before completing, re-run the remaining migrations:',
|
|
1173
|
+
' nx migrate --run-migrations',
|
|
1174
|
+
'',
|
|
1175
|
+
...manualInstallHint,
|
|
1176
|
+
],
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix, shouldSkipInstall = false) {
|
|
1181
|
+
const changedDepInstaller = new ChangedDepInstaller(root, shouldSkipInstall);
|
|
1182
|
+
const migrationsWithNoChanges = [];
|
|
1183
|
+
const sortedMigrations = migrations.sort((a, b) => {
|
|
1184
|
+
// special case for the split configuration migration to run first
|
|
1185
|
+
if (a.name === '15-7-0-split-configuration-into-project-json-files') {
|
|
1186
|
+
return -1;
|
|
1187
|
+
}
|
|
1188
|
+
if (b.name === '15-7-0-split-configuration-into-project-json-files') {
|
|
1189
|
+
return 1;
|
|
1190
|
+
}
|
|
1191
|
+
return (0, semver_1.lt)(normalizeVersion(a.version), normalizeVersion(b.version))
|
|
1192
|
+
? -1
|
|
1193
|
+
: 1;
|
|
1194
|
+
});
|
|
1195
|
+
logger_1.logger.info(`Running the following migrations:`);
|
|
1196
|
+
sortedMigrations.forEach((m) => logger_1.logger.info(`- ${m.package}: ${m.name} (${m.description})`));
|
|
1197
|
+
logger_1.logger.info(`---------------------------------------------------------\n`);
|
|
1198
|
+
const allNextSteps = [];
|
|
1199
|
+
for (const m of sortedMigrations) {
|
|
1200
|
+
logger_1.logger.info(`Running migration ${m.package}: ${m.name}`);
|
|
1201
|
+
try {
|
|
1202
|
+
const { changes, nextSteps } = await runNxOrAngularMigration(root, m, isVerbose, shouldCreateCommits, commitPrefix, () => changedDepInstaller.installDepsIfChanged());
|
|
1203
|
+
allNextSteps.push(...nextSteps);
|
|
1204
|
+
if (changes.length === 0) {
|
|
1205
|
+
migrationsWithNoChanges.push(m);
|
|
1206
|
+
}
|
|
1207
|
+
logger_1.logger.info(`---------------------------------------------------------`);
|
|
1208
|
+
}
|
|
1209
|
+
catch (e) {
|
|
1210
|
+
if (!(e instanceof NpmPeerDepsInstallError)) {
|
|
1211
|
+
output_1.output.error({
|
|
1212
|
+
title: `Failed to run ${m.name} from ${m.package}. This workspace is NOT up to date!`,
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
throw e;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
if (!shouldCreateCommits) {
|
|
1219
|
+
await changedDepInstaller.installDepsIfChanged();
|
|
1220
|
+
}
|
|
1221
|
+
if (changedDepInstaller.skippedInstall) {
|
|
1222
|
+
logSkippedPostMigrationInstall(root);
|
|
1223
|
+
}
|
|
1224
|
+
return { migrationsWithNoChanges, nextSteps: allNextSteps };
|
|
1225
|
+
}
|
|
1226
|
+
class ChangedDepInstaller {
|
|
1227
|
+
constructor(root, shouldSkipInstall = false) {
|
|
1228
|
+
this.root = root;
|
|
1229
|
+
this.shouldSkipInstall = shouldSkipInstall;
|
|
1230
|
+
this._skippedInstall = false;
|
|
1231
|
+
this.initialDeps = getStringifiedPackageJsonDeps(root);
|
|
1232
|
+
}
|
|
1233
|
+
get skippedInstall() {
|
|
1234
|
+
return this._skippedInstall;
|
|
1235
|
+
}
|
|
1236
|
+
async installDepsIfChanged() {
|
|
1237
|
+
const currentDeps = getStringifiedPackageJsonDeps(this.root);
|
|
1238
|
+
if (this.initialDeps !== currentDeps) {
|
|
1239
|
+
if (this.shouldSkipInstall) {
|
|
1240
|
+
this._skippedInstall = true;
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
await runInstall(this.root, 'post-migration');
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
this.initialDeps = currentDeps;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
function logSkippedPostMigrationInstall(root) {
|
|
1250
|
+
const packageManager = (0, package_manager_1.detectPackageManager)(root);
|
|
1251
|
+
const installCommand = (0, package_manager_1.getPackageManagerCommand)(packageManager, root).install;
|
|
1252
|
+
output_1.output.warn({
|
|
1253
|
+
title: 'Migrations updated your dependencies, but the install was skipped',
|
|
1254
|
+
bodyLines: [`Run "${installCommand}" to install the updated dependencies.`],
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
async function runNxOrAngularMigration(root, migration, isVerbose, shouldCreateCommits, commitPrefix, installDepsIfChanged, handleInstallDeps = false) {
|
|
1258
|
+
if (!installDepsIfChanged) {
|
|
1259
|
+
const changedDepInstaller = new ChangedDepInstaller(root);
|
|
1260
|
+
installDepsIfChanged = () => changedDepInstaller.installDepsIfChanged();
|
|
1261
|
+
}
|
|
1262
|
+
const { collection, collectionPath } = readMigrationCollection(migration.package, root);
|
|
1263
|
+
let changes = [];
|
|
1264
|
+
let nextSteps = [];
|
|
1265
|
+
if (!isAngularMigration(collection, migration.name)) {
|
|
1266
|
+
({ nextSteps, changes } = await runNxMigration(root, collectionPath, collection, migration.name, migration.version));
|
|
1267
|
+
logger_1.logger.info(`Ran ${migration.name} from ${migration.package}`);
|
|
1268
|
+
logger_1.logger.info(` ${migration.description}\n`);
|
|
1269
|
+
if (changes.length < 1) {
|
|
1270
|
+
logger_1.logger.info(`No changes were made\n`);
|
|
1271
|
+
return { changes, nextSteps };
|
|
1272
|
+
}
|
|
1273
|
+
logger_1.logger.info('Changes:');
|
|
1274
|
+
(0, tree_1.printChanges)(changes, ' ');
|
|
1275
|
+
logger_1.logger.info('');
|
|
1276
|
+
}
|
|
1277
|
+
else {
|
|
1278
|
+
const ngCliAdapter = await getNgCompatLayer();
|
|
1279
|
+
const migrationProjectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
1280
|
+
const { madeChanges, loggingQueue } = await ngCliAdapter.runMigration(root, migration.package, migration.name, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(migrationProjectGraph).projects, isVerbose, migrationProjectGraph);
|
|
1281
|
+
logger_1.logger.info(`Ran ${migration.name} from ${migration.package}`);
|
|
1282
|
+
logger_1.logger.info(` ${migration.description}\n`);
|
|
1283
|
+
if (!madeChanges) {
|
|
1284
|
+
logger_1.logger.info(`No changes were made\n`);
|
|
1285
|
+
return { changes, nextSteps };
|
|
1286
|
+
}
|
|
1287
|
+
logger_1.logger.info('Changes:');
|
|
1288
|
+
loggingQueue.forEach((log) => logger_1.logger.info(' ' + log));
|
|
1289
|
+
logger_1.logger.info('');
|
|
1290
|
+
}
|
|
1291
|
+
if (shouldCreateCommits) {
|
|
1292
|
+
await installDepsIfChanged();
|
|
1293
|
+
const commitMessage = `${commitPrefix}${migration.name}`;
|
|
1294
|
+
try {
|
|
1295
|
+
const committedSha = (0, git_utils_1.commitChanges)(commitMessage, root);
|
|
1296
|
+
if (committedSha) {
|
|
1297
|
+
logger_1.logger.info(pc.dim(`- Commit created for changes: ${committedSha}`));
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
logger_1.logger.info(pc.red(`- A commit could not be created/retrieved for an unknown reason`));
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
catch (e) {
|
|
1304
|
+
logger_1.logger.info(pc.red(`- ${e.message}`));
|
|
1305
|
+
}
|
|
1306
|
+
// if we are running this function alone, we need to install deps internally
|
|
1307
|
+
}
|
|
1308
|
+
else if (handleInstallDeps) {
|
|
1309
|
+
await installDepsIfChanged();
|
|
1310
|
+
}
|
|
1311
|
+
return { changes, nextSteps };
|
|
1312
|
+
}
|
|
1313
|
+
async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits = false, commitPrefix, shouldSkipInstall = false) {
|
|
1314
|
+
if (!shouldSkipInstall && !process.env.NX_MIGRATE_SKIP_INSTALL) {
|
|
1315
|
+
await runInstall();
|
|
1316
|
+
}
|
|
1317
|
+
if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
|
|
1318
|
+
// we are running from a temp installation with nx latest, switch to running
|
|
1319
|
+
// from local installation
|
|
1320
|
+
const exitCode = runOrReturnExitCode(() => (0, child_process_2.runNxSync)(`migrate ${args.join(' ')}`, {
|
|
1321
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
1322
|
+
env: {
|
|
1323
|
+
...process.env,
|
|
1324
|
+
NX_MIGRATE_SKIP_INSTALL: 'true',
|
|
1325
|
+
NX_MIGRATE_USE_LOCAL: 'true',
|
|
1326
|
+
},
|
|
1327
|
+
}));
|
|
1328
|
+
if (exitCode !== 0) {
|
|
1329
|
+
return exitCode;
|
|
1330
|
+
}
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
const migrationsExists = (0, fileutils_1.fileExists)(opts.runMigrations);
|
|
1334
|
+
if (opts.ifExists && !migrationsExists) {
|
|
1335
|
+
output_1.output.log({
|
|
1336
|
+
title: `Migrations file '${opts.runMigrations}' doesn't exist`,
|
|
1337
|
+
});
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
else if (!opts.ifExists && !migrationsExists) {
|
|
1341
|
+
throw new Error(`File '${opts.runMigrations}' doesn't exist, can't run migrations. Use flag --if-exists to run migrations only if the file exists`);
|
|
1342
|
+
}
|
|
1343
|
+
output_1.output.log({
|
|
1344
|
+
title: `Running migrations from '${opts.runMigrations}'` +
|
|
1345
|
+
(shouldCreateCommits ? ', with each applied in a dedicated commit' : ''),
|
|
1346
|
+
});
|
|
1347
|
+
const migrations = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, opts.runMigrations)).migrations;
|
|
1348
|
+
const { migrationsWithNoChanges, nextSteps } = await executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix, shouldSkipInstall);
|
|
1349
|
+
if (migrationsWithNoChanges.length < migrations.length) {
|
|
1350
|
+
output_1.output.success({
|
|
1351
|
+
title: `Successfully finished running migrations from '${opts.runMigrations}'. This workspace is up to date!`,
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
else {
|
|
1355
|
+
output_1.output.success({
|
|
1356
|
+
title: `No changes were made from running '${opts.runMigrations}'. This workspace is up to date!`,
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
if (nextSteps.length > 0) {
|
|
1360
|
+
output_1.output.log({
|
|
1361
|
+
title: `Some migrations have additional information, see below.`,
|
|
1362
|
+
bodyLines: nextSteps.map((line) => `- ${line}`),
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function getStringifiedPackageJsonDeps(root) {
|
|
1367
|
+
try {
|
|
1368
|
+
const { dependencies, devDependencies } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
|
1369
|
+
return JSON.stringify([dependencies, devDependencies]);
|
|
1370
|
+
}
|
|
1371
|
+
catch {
|
|
1372
|
+
// We don't really care if the .nx/installation property changes,
|
|
1373
|
+
// whenever nxw is invoked it will handle the dep updates.
|
|
1374
|
+
return '';
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
async function runNxMigration(root, collectionPath, collection, name, migrationVersion) {
|
|
1378
|
+
const { path: implPath, fnSymbol } = getImplementationPath(collection, collectionPath, name, migrationVersion);
|
|
1379
|
+
const fn = require(implPath)[fnSymbol];
|
|
1380
|
+
const host = new tree_1.FsTree(root, process.env.NX_VERBOSE_LOGGING === 'true', `migration ${collection.name}:${name}`);
|
|
1381
|
+
let nextSteps = await fn(host, {});
|
|
1382
|
+
// This accounts for migrations that mistakenly return a generator callback
|
|
1383
|
+
// from a migration. We've never executed these, so its not a breaking change that
|
|
1384
|
+
// we don't call them now... but currently shipping a migration with one wouldn't break
|
|
1385
|
+
// the migrate flow, so we are being cautious.
|
|
1386
|
+
if (!isStringArray(nextSteps)) {
|
|
1387
|
+
nextSteps = [];
|
|
1388
|
+
}
|
|
1389
|
+
host.lock();
|
|
1390
|
+
const changes = host.listChanges();
|
|
1391
|
+
(0, tree_1.flushChanges)(root, changes);
|
|
1392
|
+
return { changes, nextSteps };
|
|
1393
|
+
}
|
|
1394
|
+
async function migrate(root, args, rawArgs) {
|
|
1395
|
+
await client_1.daemonClient.stop();
|
|
1396
|
+
return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
1397
|
+
const opts = await parseMigrationsOptions(args);
|
|
1398
|
+
if (opts.type === 'generateMigrations') {
|
|
1399
|
+
await generateMigrationsJsonAndUpdatePackageJson(root, opts);
|
|
1400
|
+
}
|
|
1401
|
+
else {
|
|
1402
|
+
try {
|
|
1403
|
+
return await runMigrations(root, opts, rawArgs, args['verbose'], args['createCommits'], args['commitPrefix'], args['skipInstall']);
|
|
1404
|
+
}
|
|
1405
|
+
catch (e) {
|
|
1406
|
+
// The remediation guidance is already logged by `runInstall`; swallow
|
|
1407
|
+
// the error here so `handleErrors` doesn't print a noisy stack after
|
|
1408
|
+
// the friendly output.
|
|
1409
|
+
if (e instanceof NpmPeerDepsInstallError) {
|
|
1410
|
+
return 1;
|
|
1411
|
+
}
|
|
1412
|
+
throw e;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
async function runMigration() {
|
|
1418
|
+
return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
1419
|
+
const runLocalMigrate = () => runOrReturnExitCode(() => (0, child_process_2.runNxSync)(`_migrate ${process.argv.slice(3).join(' ')}`, {
|
|
1420
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
1421
|
+
}));
|
|
1422
|
+
if (process.env.NX_USE_LOCAL !== 'true' &&
|
|
1423
|
+
process.env.NX_MIGRATE_USE_LOCAL === undefined) {
|
|
1424
|
+
const p = await nxCliPath();
|
|
1425
|
+
if (p === null) {
|
|
1426
|
+
return runLocalMigrate();
|
|
1427
|
+
}
|
|
1428
|
+
// ensure local registry from process is not interfering with the install
|
|
1429
|
+
// when we start the process from temp folder the local registry would override the custom registry
|
|
1430
|
+
if (process.env.npm_config_registry &&
|
|
1431
|
+
process.env.npm_config_registry.match(/^https:\/\/registry\.(npmjs\.org|yarnpkg\.com)/)) {
|
|
1432
|
+
delete process.env.npm_config_registry;
|
|
1433
|
+
}
|
|
1434
|
+
return runOrReturnExitCode(() => (0, child_process_1.execSync)(`${p} _migrate ${process.argv.slice(3).join(' ')}`, {
|
|
1435
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
1436
|
+
windowsHide: true,
|
|
1437
|
+
}));
|
|
1438
|
+
}
|
|
1439
|
+
return runLocalMigrate();
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
function readMigrationCollection(packageName, root) {
|
|
1443
|
+
const collectionPath = readPackageMigrationConfig(packageName, root).migrations;
|
|
1444
|
+
const collection = (0, fileutils_1.readJsonFile)(collectionPath);
|
|
1445
|
+
collection.name ??= packageName;
|
|
1446
|
+
return {
|
|
1447
|
+
collection,
|
|
1448
|
+
collectionPath,
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function getImplementationPath(collection, collectionPath, name, migrationVersion) {
|
|
1452
|
+
const g = collection.generators?.[name] || collection.schematics?.[name];
|
|
1453
|
+
if (!g) {
|
|
1454
|
+
throw new MigrationImplementationMissingError(`Unable to determine implementation path for "${collectionPath}:${name}"`, collectionPath, migrationVersion);
|
|
1455
|
+
}
|
|
1456
|
+
const implRelativePathAndMaybeSymbol = g.implementation || g.factory;
|
|
1457
|
+
const [implRelativePath, fnSymbol = 'default'] = implRelativePathAndMaybeSymbol.split('#');
|
|
1458
|
+
let implPath;
|
|
1459
|
+
try {
|
|
1460
|
+
implPath = require.resolve(implRelativePath, {
|
|
1461
|
+
paths: [(0, path_1.dirname)(collectionPath)],
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
catch (e) {
|
|
1465
|
+
try {
|
|
1466
|
+
// workaround for a bug in node 12
|
|
1467
|
+
implPath = require.resolve(`${(0, path_1.dirname)(collectionPath)}/${implRelativePath}`);
|
|
1468
|
+
}
|
|
1469
|
+
catch {
|
|
1470
|
+
throw new MigrationImplementationMissingError(`Could not resolve implementation for migration "${name}" from "${collectionPath}"`, collectionPath, migrationVersion ?? g.version);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return { path: implPath, fnSymbol };
|
|
1474
|
+
}
|
|
1475
|
+
class MigrationImplementationMissingError extends Error {
|
|
1476
|
+
constructor(baseMessage, collectionPath, migrationVersion) {
|
|
1477
|
+
super(buildMigrationMissingMessage(baseMessage, collectionPath, migrationVersion));
|
|
1478
|
+
this.name = 'MigrationImplementationMissingError';
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
function buildMigrationMissingMessage(baseMessage, collectionPath, migrationVersion) {
|
|
1482
|
+
if (!migrationVersion) {
|
|
1483
|
+
return baseMessage;
|
|
1484
|
+
}
|
|
1485
|
+
try {
|
|
1486
|
+
const packageJsonPath = (0, path_1.join)((0, path_1.dirname)(collectionPath), 'package.json');
|
|
1487
|
+
if (!(0, fs_1.existsSync)(packageJsonPath)) {
|
|
1488
|
+
return baseMessage;
|
|
1489
|
+
}
|
|
1490
|
+
const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
|
1491
|
+
const installedVersion = packageJson.version;
|
|
1492
|
+
if (installedVersion &&
|
|
1493
|
+
(0, semver_1.lt)(normalizeVersion(installedVersion), normalizeVersion(migrationVersion))) {
|
|
1494
|
+
const packageManager = (0, package_manager_1.detectPackageManager)();
|
|
1495
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
1496
|
+
const overrideFieldName = getOverrideFieldName(packageManager);
|
|
1497
|
+
return (`${baseMessage}\n\n` +
|
|
1498
|
+
`The installed version of "${packageJson.name}" is ${installedVersion}, ` +
|
|
1499
|
+
`but this migration requires version ${migrationVersion}. ` +
|
|
1500
|
+
`This likely means the package version is being held back by an ${overrideFieldName} ` +
|
|
1501
|
+
`in your package.json. ` +
|
|
1502
|
+
`Remove the ${overrideFieldName} and run "${pmc.install}" to install the correct version.`);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
catch {
|
|
1506
|
+
// Fall through to return the base message if we can't read package info
|
|
1507
|
+
}
|
|
1508
|
+
return baseMessage;
|
|
1509
|
+
}
|
|
1510
|
+
function getOverrideFieldName(packageManager) {
|
|
1511
|
+
switch (packageManager) {
|
|
1512
|
+
case 'pnpm':
|
|
1513
|
+
return '"pnpm.overrides"';
|
|
1514
|
+
case 'yarn':
|
|
1515
|
+
return '"resolutions"';
|
|
1516
|
+
case 'npm':
|
|
1517
|
+
case 'bun':
|
|
1518
|
+
return '"overrides"';
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
async function nxCliPath(nxWorkspaceRoot) {
|
|
1522
|
+
const version = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
|
|
1523
|
+
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
1524
|
+
await (0, provenance_1.ensurePackageHasProvenance)('nx', version);
|
|
1525
|
+
try {
|
|
1526
|
+
const packageManager = (0, package_manager_1.detectPackageManager)();
|
|
1527
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
1528
|
+
const { dirSync } = require('tmp');
|
|
1529
|
+
const tmpDir = dirSync().name;
|
|
1530
|
+
(0, fileutils_1.writeJsonFile)((0, path_1.join)(tmpDir, 'package.json'), {
|
|
1531
|
+
dependencies: {
|
|
1532
|
+
nx: version,
|
|
1533
|
+
},
|
|
1534
|
+
license: 'MIT',
|
|
1535
|
+
});
|
|
1536
|
+
const root = nxWorkspaceRoot ?? workspace_root_1.workspaceRoot;
|
|
1537
|
+
const isNonJs = !(0, fs_1.existsSync)((0, path_1.join)(root, 'package.json'));
|
|
1538
|
+
(0, package_manager_1.copyPackageManagerConfigurationFiles)(isNonJs ? (0, installation_directory_1.getNxInstallationPath)(root) : root, tmpDir);
|
|
1539
|
+
// Let's print the output of the install process to the console when verbose
|
|
1540
|
+
// is enabled, so it's easier to debug issues with the installation process
|
|
1541
|
+
const stdio = isVerbose
|
|
1542
|
+
? ['ignore', 'inherit', 'inherit']
|
|
1543
|
+
: 'ignore';
|
|
1544
|
+
if (pmc.preInstall) {
|
|
1545
|
+
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
1546
|
+
(0, child_process_1.execSync)(pmc.preInstall, {
|
|
1547
|
+
cwd: tmpDir,
|
|
1548
|
+
stdio,
|
|
1549
|
+
windowsHide: true,
|
|
1550
|
+
});
|
|
1551
|
+
// if it's berry ensure we set the node_linker to node-modules
|
|
1552
|
+
if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
|
|
1553
|
+
(0, child_process_1.execSync)('yarn config set nodeLinker node-modules', {
|
|
1554
|
+
cwd: tmpDir,
|
|
1555
|
+
stdio,
|
|
1556
|
+
windowsHide: true,
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
(0, child_process_1.execSync)(`${pmc.install} ${pmc.ignoreScriptsFlag ?? ''}`, {
|
|
1561
|
+
cwd: tmpDir,
|
|
1562
|
+
stdio,
|
|
1563
|
+
windowsHide: true,
|
|
1564
|
+
});
|
|
1565
|
+
// Set NODE_PATH so that these modules can be used for module resolution
|
|
1566
|
+
addToNodePath((0, path_1.join)(tmpDir, 'node_modules'));
|
|
1567
|
+
addToNodePath((0, path_1.join)(nxWorkspaceRoot ?? workspace_root_1.workspaceRoot, 'node_modules'));
|
|
1568
|
+
return (0, path_1.join)(tmpDir, `node_modules`, '.bin', 'nx');
|
|
1569
|
+
}
|
|
1570
|
+
catch (e) {
|
|
1571
|
+
console.error(`Failed to install the ${version} version of the migration script. Using the current version.`);
|
|
1572
|
+
if (isVerbose) {
|
|
1573
|
+
console.error(e);
|
|
1574
|
+
}
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function addToNodePath(dir) {
|
|
1579
|
+
// NODE_PATH is a delimited list of paths.
|
|
1580
|
+
// The delimiter is different for windows.
|
|
1581
|
+
const delimiter = require('os').platform() === 'win32' ? ';' : ':';
|
|
1582
|
+
const paths = process.env.NODE_PATH
|
|
1583
|
+
? process.env.NODE_PATH.split(delimiter)
|
|
1584
|
+
: [];
|
|
1585
|
+
// Add the tmp path
|
|
1586
|
+
paths.push(dir);
|
|
1587
|
+
// Update the env variable.
|
|
1588
|
+
process.env.NODE_PATH = paths.join(delimiter);
|
|
1589
|
+
}
|
|
1590
|
+
function isAngularMigration(collection, name) {
|
|
1591
|
+
return !collection.generators?.[name] && collection.schematics?.[name];
|
|
1592
|
+
}
|
|
1593
|
+
const getNgCompatLayer = (() => {
|
|
1594
|
+
let _ngCliAdapter;
|
|
1595
|
+
return async function getNgCompatLayer() {
|
|
1596
|
+
if (!_ngCliAdapter) {
|
|
1597
|
+
_ngCliAdapter = await (0, handle_import_1.handleImport)('../../adapter/ngcli-adapter.js', __dirname);
|
|
1598
|
+
require('../../adapter/compat');
|
|
1599
|
+
}
|
|
1600
|
+
return _ngCliAdapter;
|
|
1601
|
+
};
|
|
1602
|
+
})();
|
|
1603
|
+
function isStringArray(value) {
|
|
1604
|
+
if (!Array.isArray(value)) {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
return value.every((v) => typeof v === 'string');
|
|
1608
|
+
}
|