@ohos-ports/nx 19.8.4-beta.2 → 20.8.4-beta.1
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/.eslintrc.json +146 -0
- package/LICENSE +1 -1
- package/bin/init-local.js +0 -39
- package/bin/nx.js +28 -15
- package/bin/post-install.js +7 -5
- package/migrations.json +11 -37
- package/ohos-build/build-Cargo.toml.patch +12 -0
- package/ohos-build/build-cargo-config.patch +20 -0
- package/ohos-build/index.js.patch +18 -0
- package/ohos-build/native-bindings.js.patch +25 -0
- package/ohos-build/nix-0.25.1-ohos.patch +539 -0
- package/ohos-build/nix-0.27.1-ohos.patch +436 -0
- package/package.json +25 -62
- package/plugins/package-json.d.ts +5 -1
- package/plugins/package-json.js +27 -2
- package/release/changelog-renderer/index.d.ts +102 -0
- package/release/changelog-renderer/index.js +339 -0
- package/release/index.d.ts +4 -0
- package/release/index.js +13 -0
- package/schemas/nx-schema.json +964 -0
- package/schemas/project-schema.json +331 -0
- package/schemas/workspace-schema.json +185 -0
- package/src/adapter/angular-json.js +2 -8
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -1
- package/src/adapter/ngcli-adapter.js +7 -7
- package/src/command-line/add/add.js +21 -48
- package/src/command-line/affected/affected.js +3 -3
- package/src/command-line/connect/view-logs.js +1 -1
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/exec.js +3 -3
- package/src/command-line/format/command-object.js +9 -0
- package/src/command-line/format/format.js +10 -6
- package/src/command-line/generate/command-object.js +1 -2
- package/src/command-line/generate/generate.d.ts +1 -1
- package/src/command-line/generate/generate.js +3 -1
- package/src/command-line/generate/generator-utils.js +10 -5
- package/src/command-line/graph/graph.js +6 -9
- package/src/command-line/import/import.js +110 -71
- package/src/command-line/init/command-object.js +25 -9
- package/src/command-line/init/configure-plugins.d.ts +34 -0
- package/src/command-line/init/configure-plugins.js +203 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +4 -3
- package/src/command-line/init/implementation/angular/standalone-workspace.js +8 -5
- package/src/command-line/init/implementation/check-compatible-with-plugins.d.ts +15 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +134 -0
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +1 -1
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -1
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +33 -186
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +6 -2
- package/src/command-line/init/implementation/utils.js +116 -37
- package/src/command-line/init/init-v1.js +2 -2
- package/src/command-line/init/init-v2.d.ts +2 -2
- package/src/command-line/init/init-v2.js +73 -55
- package/src/command-line/login/login.js +3 -0
- package/src/command-line/logout/logout.js +3 -0
- package/src/command-line/migrate/command-object.js +2 -96
- package/src/command-line/migrate/migrate.d.ts +1 -0
- package/src/command-line/migrate/migrate.js +111 -19
- package/src/command-line/nx-commands.js +20 -6
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.d.ts +5 -4
- package/src/command-line/release/changelog.js +64 -79
- package/src/command-line/release/command-object.d.ts +7 -4
- package/src/command-line/release/command-object.js +24 -13
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +173 -43
- package/src/command-line/release/config/conventional-commits.js +7 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +4 -0
- package/src/command-line/release/config/filter-release-groups.js +10 -3
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/config/version-plans.js +1 -1
- package/src/command-line/release/index.d.ts +9 -2
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +8 -4
- package/src/command-line/release/publish.d.ts +6 -1
- package/src/command-line/release/publish.js +50 -27
- package/src/command-line/release/release.js +33 -20
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/exec-command.js +1 -1
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +104 -19
- package/src/command-line/release/utils/github.d.ts +1 -0
- package/src/command-line/release/utils/github.js +6 -2
- package/src/command-line/release/utils/launch-editor.js +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +251 -0
- package/src/command-line/release/version/release-group-processor.js +1048 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +95 -0
- package/src/command-line/release/version/test-utils.js +416 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +170 -0
- package/src/command-line/release/version/version-actions.js +183 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +93 -255
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -16
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +37 -15
- package/src/command-line/run/run.js +1 -2
- package/src/command-line/run-many/run-many.js +1 -4
- package/src/command-line/show/project.js +25 -3
- package/src/command-line/show/projects.js +4 -0
- package/src/command-line/sync/sync.js +3 -3
- package/src/command-line/watch/watch.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +26 -0
- package/src/config/misc-interfaces.d.ts +3 -15
- package/src/config/nx-json.d.ts +145 -19
- package/src/config/project-graph.d.ts +4 -4
- package/src/config/project-graph.js +8 -0
- package/src/config/schema-utils.d.ts +4 -3
- package/src/config/schema-utils.js +71 -4
- package/src/config/workspace-json-project-json.d.ts +23 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -0
- package/src/daemon/client/client.js +42 -4
- package/src/daemon/client/generate-help-output.js +1 -1
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/message-types/run-tasks-execution-hooks.d.ts +13 -0
- package/src/daemon/message-types/run-tasks-execution-hooks.js +19 -0
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/handle-hash-tasks.js +1 -1
- package/src/daemon/server/handle-tasks-execution-hooks.d.ts +19 -0
- package/src/daemon/server/handle-tasks-execution-hooks.js +35 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +5 -5
- package/src/daemon/server/server.js +26 -2
- package/src/daemon/server/shutdown-utils.js +4 -2
- package/src/devkit-exports.d.ts +10 -7
- package/src/devkit-exports.js +4 -6
- package/src/devkit-internals.d.ts +4 -2
- package/src/devkit-internals.js +8 -3
- package/src/executors/run-commands/run-commands.impl.d.ts +1 -0
- package/src/executors/run-commands/run-commands.impl.js +11 -4
- package/src/executors/run-commands/schema.json +14 -0
- package/src/executors/run-script/run-script.impl.js +1 -1
- package/src/executors/utils/convert-nx-executor.js +2 -4
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/generators/utils/nx-json.d.ts +1 -1
- package/src/generators/utils/project-configuration.js +15 -4
- package/src/hasher/create-task-hasher.js +1 -1
- package/src/hasher/file-hasher.d.ts +1 -0
- package/src/hasher/file-hasher.js +5 -0
- package/src/hasher/hash-task.js +1 -1
- package/src/hasher/task-hasher.d.ts +2 -6
- package/src/hasher/task-hasher.js +6 -32
- package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/src/migrations/update-20-0-1/use-legacy-cache.d.ts +2 -0
- package/src/migrations/update-20-0-1/use-legacy-cache.js +20 -0
- package/src/native/index.d.ts +49 -20
- package/src/native/index.js +18 -3
- package/src/native/native-bindings.js +12 -2
- package/src/native/nx.openharmony-arm64.node +0 -0
- package/src/native/nx.wasi-browser.js +11 -8
- package/src/native/nx.wasi.cjs +11 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/native/tests/__fixtures__/file-lock.fixture.js +20 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -2
- package/src/nx-cloud/update-manager.js +13 -1
- package/src/plugins/js/index.js +2 -2
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +3 -1
- package/src/plugins/js/lock-file/yarn-parser.js +102 -44
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +2 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +6 -20
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +14 -2
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +81 -19
- package/src/plugins/js/utils/config.js +2 -9
- package/src/plugins/js/utils/packages.d.ts +8 -0
- package/src/plugins/js/utils/packages.js +91 -0
- package/src/plugins/js/utils/register.d.ts +5 -1
- package/src/plugins/js/utils/register.js +2 -1
- package/src/plugins/js/utils/typescript.d.ts +1 -0
- package/src/plugins/js/utils/typescript.js +4 -3
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/src/plugins/package-json/create-nodes.d.ts +7 -8
- package/src/plugins/package-json/create-nodes.js +34 -12
- package/src/project-graph/affected/affected-project-graph.js +3 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +16 -4
- package/src/project-graph/build-project-graph.d.ts +2 -1
- package/src/project-graph/build-project-graph.js +66 -43
- package/src/project-graph/error-types.d.ts +15 -12
- package/src/project-graph/error-types.js +109 -23
- package/src/project-graph/file-utils.d.ts +3 -3
- package/src/project-graph/file-utils.js +8 -7
- package/src/project-graph/nx-deps-cache.d.ts +6 -3
- package/src/project-graph/nx-deps-cache.js +66 -11
- package/src/project-graph/plugins/get-plugins.d.ts +4 -0
- package/src/project-graph/plugins/get-plugins.js +144 -0
- package/src/project-graph/plugins/in-process-loader.d.ts +10 -0
- package/src/project-graph/plugins/in-process-loader.js +60 -0
- package/src/project-graph/plugins/index.d.ts +2 -1
- package/src/project-graph/plugins/index.js +5 -3
- package/src/project-graph/plugins/isolation/enabled.d.ts +1 -0
- package/src/project-graph/plugins/isolation/enabled.js +19 -0
- package/src/project-graph/plugins/isolation/index.d.ts +2 -2
- package/src/project-graph/plugins/isolation/index.js +1 -7
- package/src/project-graph/plugins/isolation/messaging.d.ts +39 -21
- package/src/project-graph/plugins/isolation/messaging.js +5 -1
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +58 -49
- package/src/project-graph/plugins/isolation/plugin-worker.js +79 -29
- package/src/project-graph/plugins/load-resolved-plugin.d.ts +3 -0
- package/src/project-graph/plugins/load-resolved-plugin.js +22 -0
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +20 -0
- package/src/project-graph/plugins/loaded-nx-plugin.js +80 -0
- package/src/project-graph/plugins/public-api.d.ts +32 -13
- package/src/project-graph/plugins/resolve-plugin.d.ts +15 -0
- package/src/project-graph/plugins/resolve-plugin.js +134 -0
- package/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -0
- package/src/project-graph/plugins/tasks-execution-hooks.js +65 -0
- package/src/project-graph/plugins/transpiler.d.ts +8 -0
- package/src/project-graph/plugins/transpiler.js +47 -0
- package/src/project-graph/plugins/utils.d.ts +2 -8
- package/src/project-graph/plugins/utils.js +2 -39
- package/src/project-graph/project-graph.d.ts +3 -1
- package/src/project-graph/project-graph.js +86 -20
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +55 -25
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -7
- package/src/project-graph/utils/retrieve-workspace-files.js +17 -23
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +2 -4
- package/src/tasks-runner/cache.d.ts +22 -4
- package/src/tasks-runner/cache.js +160 -18
- package/src/tasks-runner/create-task-graph.d.ts +13 -1
- package/src/tasks-runner/create-task-graph.js +50 -22
- package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
- package/src/tasks-runner/default-tasks-runner.js +20 -2
- package/src/tasks-runner/forked-process-task-runner.d.ts +4 -1
- package/src/tasks-runner/forked-process-task-runner.js +62 -40
- package/src/tasks-runner/init-tasks-runner.js +0 -2
- package/src/tasks-runner/life-cycle.d.ts +7 -0
- package/src/tasks-runner/run-command.d.ts +2 -4
- package/src/tasks-runner/run-command.js +51 -18
- package/src/tasks-runner/task-graph-utils.d.ts +11 -0
- package/src/tasks-runner/task-graph-utils.js +23 -0
- package/src/tasks-runner/task-orchestrator.js +14 -4
- package/src/tasks-runner/utils.js +2 -0
- package/src/utils/ab-testing.js +1 -1
- package/src/utils/assert-workspace-validity.js +4 -0
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +5 -3
- package/src/utils/command-line-utils.js +37 -57
- package/src/utils/db-connection.d.ts +2 -1
- package/src/utils/db-connection.js +7 -0
- package/src/utils/default-base.js +1 -1
- package/src/utils/delayed-spinner.d.ts +42 -0
- package/src/utils/delayed-spinner.js +80 -0
- package/src/utils/find-matching-projects.js +13 -1
- package/src/utils/git-utils.index-filter.js +2 -2
- package/src/utils/git-utils.js +4 -4
- package/src/utils/git-utils.tree-filter.js +1 -1
- package/src/utils/handle-errors.js +24 -13
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-cloud-utils.js +3 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +5 -1
- package/src/utils/package-json.js +9 -3
- package/src/utils/package-manager.d.ts +14 -0
- package/src/utils/package-manager.js +89 -3
- package/src/utils/path.js +1 -1
- package/src/utils/plugins/core-plugins.js +4 -0
- package/src/utils/plugins/plugin-capabilities.js +4 -5
- package/src/utils/print-help.js +3 -9
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/sync-generators.js +9 -14
- package/src/utils/task-history.d.ts +1 -1
- package/src/utils/task-history.js +2 -2
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/tasks-runners/default.d.ts +1 -0
- package/tasks-runners/default.js +5 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/import/utils/needs-install.d.ts +0 -3
- package/src/command-line/import/utils/needs-install.js +0 -31
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/daemon/server/plugins.d.ts +0 -3
- package/src/daemon/server/plugins.js +0 -32
- package/src/hasher/node-task-hasher-impl.d.ts +0 -48
- package/src/hasher/node-task-hasher-impl.js +0 -449
- package/src/migrations/update-15-0-0/migrate-to-inputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +0 -102
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.d.ts +0 -2
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +0 -21
- package/src/native/nx.ohos-arm64.node +0 -0
- package/src/project-graph/plugins/internal-api.d.ts +0 -29
- package/src/project-graph/plugins/internal-api.js +0 -134
- package/src/project-graph/plugins/loader.d.ts +0 -24
- package/src/project-graph/plugins/loader.js +0 -220
- package/src/utils/app-root.d.ts +0 -8
- package/src/utils/app-root.js +0 -12
- package/src/utils/nx-plugin.deprecated.d.ts +0 -31
- package/src/utils/nx-plugin.deprecated.js +0 -20
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
- package/src/utils/workspace-configuration-check.d.ts +0 -1
- package/src/utils/workspace-configuration-check.js +0 -36
|
@@ -4,7 +4,6 @@ exports.ForkedProcessTaskRunner = void 0;
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const chalk = require("chalk");
|
|
7
|
-
const logTransformer = require("strong-log-transformer");
|
|
8
7
|
const output_1 = require("../utils/output");
|
|
9
8
|
const utils_1 = require("./utils");
|
|
10
9
|
const path_1 = require("path");
|
|
@@ -21,6 +20,7 @@ class ForkedProcessTaskRunner {
|
|
|
21
20
|
this.cliPath = (0, utils_1.getCliPath)();
|
|
22
21
|
this.verbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
23
22
|
this.processes = new Set();
|
|
23
|
+
this.finishedProcesses = new Set();
|
|
24
24
|
this.pseudoTerminal = pseudo_terminal_1.PseudoTerminal.isSupported()
|
|
25
25
|
? (0, pseudo_terminal_1.getPseudoTerminal)()
|
|
26
26
|
: null;
|
|
@@ -32,8 +32,9 @@ class ForkedProcessTaskRunner {
|
|
|
32
32
|
this.setupProcessEventListeners();
|
|
33
33
|
}
|
|
34
34
|
// TODO: vsavkin delegate terminal output printing
|
|
35
|
-
forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }, fullTaskGraph, env) {
|
|
35
|
+
forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }, projectGraph, fullTaskGraph, env) {
|
|
36
36
|
return new Promise((res, rej) => {
|
|
37
|
+
let p;
|
|
37
38
|
try {
|
|
38
39
|
const count = Object.keys(batchTaskGraph.tasks).length;
|
|
39
40
|
if (count > 1) {
|
|
@@ -43,7 +44,7 @@ class ForkedProcessTaskRunner {
|
|
|
43
44
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(Object.values(batchTaskGraph.tasks)[0]);
|
|
44
45
|
output_1.output.logCommand(args.join(' '));
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
p = (0, child_process_1.fork)(workerPath, {
|
|
47
48
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
48
49
|
env,
|
|
49
50
|
});
|
|
@@ -53,20 +54,18 @@ class ForkedProcessTaskRunner {
|
|
|
53
54
|
if (code === null)
|
|
54
55
|
code = (0, exit_codes_1.signalToCode)(signal);
|
|
55
56
|
if (code !== 0) {
|
|
56
|
-
const results = {};
|
|
57
|
-
for (const rootTaskId of batchTaskGraph.roots) {
|
|
58
|
-
results[rootTaskId] = {
|
|
59
|
-
success: false,
|
|
60
|
-
terminalOutput: '',
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
57
|
rej(new Error(`"${executorName}" exited unexpectedly with code: ${code}`));
|
|
64
58
|
}
|
|
65
59
|
});
|
|
60
|
+
p.on('error', (err) => {
|
|
61
|
+
this.processes.delete(p);
|
|
62
|
+
rej(err || new Error(`"${executorName}" exited unexpectedly`));
|
|
63
|
+
});
|
|
66
64
|
p.on('message', (message) => {
|
|
67
65
|
switch (message.type) {
|
|
68
66
|
case batch_messages_1.BatchMessageType.CompleteBatchExecution: {
|
|
69
67
|
res(message.results);
|
|
68
|
+
this.finishedProcesses.add(p);
|
|
70
69
|
break;
|
|
71
70
|
}
|
|
72
71
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
|
@@ -84,15 +83,30 @@ class ForkedProcessTaskRunner {
|
|
|
84
83
|
p.send({
|
|
85
84
|
type: batch_messages_1.BatchMessageType.RunTasks,
|
|
86
85
|
executorName,
|
|
86
|
+
projectGraph,
|
|
87
87
|
batchTaskGraph,
|
|
88
88
|
fullTaskGraph,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
catch (e) {
|
|
92
92
|
rej(e);
|
|
93
|
+
if (p) {
|
|
94
|
+
this.processes.delete(p);
|
|
95
|
+
p.kill();
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
});
|
|
95
99
|
}
|
|
100
|
+
cleanUpBatchProcesses() {
|
|
101
|
+
if (this.finishedProcesses.size > 0) {
|
|
102
|
+
this.finishedProcesses.forEach((p) => {
|
|
103
|
+
if ('connected' in p ? p.connected : p.isAlive) {
|
|
104
|
+
p.kill();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
this.finishedProcesses.clear();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
96
110
|
async forkProcessLegacy(task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }) {
|
|
97
111
|
return pipeOutput
|
|
98
112
|
? await this.forkProcessPipeOutputCapture(task, {
|
|
@@ -157,6 +171,7 @@ class ForkedProcessTaskRunner {
|
|
|
157
171
|
});
|
|
158
172
|
return new Promise((res) => {
|
|
159
173
|
p.onExit((code) => {
|
|
174
|
+
this.processes.delete(p);
|
|
160
175
|
// If the exit code is greater than 128, it's a special exit code for a signal
|
|
161
176
|
if (code >= 128) {
|
|
162
177
|
process.exit(code);
|
|
@@ -208,16 +223,16 @@ class ForkedProcessTaskRunner {
|
|
|
208
223
|
const prefixText = `${task.target.project}:`;
|
|
209
224
|
p.stdout
|
|
210
225
|
.pipe(logClearLineToPrefixTransformer(color.bold(prefixText) + ' '))
|
|
211
|
-
.pipe(
|
|
226
|
+
.pipe(addPrefixTransformer(color.bold(prefixText)))
|
|
212
227
|
.pipe(process.stdout);
|
|
213
228
|
p.stderr
|
|
214
229
|
.pipe(logClearLineToPrefixTransformer(color(prefixText) + ' '))
|
|
215
|
-
.pipe(
|
|
230
|
+
.pipe(addPrefixTransformer(color(prefixText)))
|
|
216
231
|
.pipe(process.stderr);
|
|
217
232
|
}
|
|
218
233
|
else {
|
|
219
|
-
p.stdout.pipe(
|
|
220
|
-
p.stderr.pipe(
|
|
234
|
+
p.stdout.pipe(addPrefixTransformer()).pipe(process.stdout);
|
|
235
|
+
p.stderr.pipe(addPrefixTransformer()).pipe(process.stderr);
|
|
221
236
|
}
|
|
222
237
|
}
|
|
223
238
|
let outWithErr = [];
|
|
@@ -227,7 +242,7 @@ class ForkedProcessTaskRunner {
|
|
|
227
242
|
p.stderr.on('data', (chunk) => {
|
|
228
243
|
outWithErr.push(chunk.toString());
|
|
229
244
|
});
|
|
230
|
-
p.
|
|
245
|
+
p.once('exit', (code, signal) => {
|
|
231
246
|
this.processes.delete(p);
|
|
232
247
|
if (code === null)
|
|
233
248
|
code = (0, exit_codes_1.signalToCode)(signal);
|
|
@@ -272,7 +287,8 @@ class ForkedProcessTaskRunner {
|
|
|
272
287
|
taskGraph,
|
|
273
288
|
isVerbose: this.verbose,
|
|
274
289
|
});
|
|
275
|
-
p.
|
|
290
|
+
p.once('exit', (code, signal) => {
|
|
291
|
+
this.processes.delete(p);
|
|
276
292
|
if (code === null)
|
|
277
293
|
code = (0, exit_codes_1.signalToCode)(signal);
|
|
278
294
|
// we didn't print any output as we were running the command
|
|
@@ -317,8 +333,7 @@ class ForkedProcessTaskRunner {
|
|
|
317
333
|
process.send(message);
|
|
318
334
|
});
|
|
319
335
|
}
|
|
320
|
-
|
|
321
|
-
process.on('message', (message) => {
|
|
336
|
+
const messageHandler = (message) => {
|
|
322
337
|
// this.publisher.publish(message.toString());
|
|
323
338
|
if (this.pseudoTerminal) {
|
|
324
339
|
this.pseudoTerminal.sendMessageToChildren(message);
|
|
@@ -328,39 +343,34 @@ class ForkedProcessTaskRunner {
|
|
|
328
343
|
p.send(message);
|
|
329
344
|
}
|
|
330
345
|
});
|
|
331
|
-
}
|
|
332
|
-
//
|
|
333
|
-
process.on('
|
|
346
|
+
};
|
|
347
|
+
// When the nx process gets a message, it will be sent into the task's process
|
|
348
|
+
process.on('message', messageHandler);
|
|
349
|
+
const cleanUp = (signal) => {
|
|
334
350
|
this.processes.forEach((p) => {
|
|
335
351
|
if ('connected' in p ? p.connected : p.isAlive) {
|
|
336
|
-
p.kill();
|
|
352
|
+
p.kill(signal);
|
|
337
353
|
}
|
|
338
354
|
});
|
|
355
|
+
process.off('message', messageHandler);
|
|
356
|
+
this.cleanUpBatchProcesses();
|
|
357
|
+
};
|
|
358
|
+
// Terminate any task processes on exit
|
|
359
|
+
process.once('exit', () => {
|
|
360
|
+
cleanUp();
|
|
339
361
|
});
|
|
340
|
-
process.
|
|
341
|
-
|
|
342
|
-
if ('connected' in p ? p.connected : p.isAlive) {
|
|
343
|
-
p.kill('SIGTERM');
|
|
344
|
-
}
|
|
345
|
-
});
|
|
362
|
+
process.once('SIGINT', () => {
|
|
363
|
+
cleanUp('SIGTERM');
|
|
346
364
|
// we exit here because we don't need to write anything to cache.
|
|
347
365
|
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
|
348
366
|
});
|
|
349
|
-
process.
|
|
350
|
-
|
|
351
|
-
if ('connected' in p ? p.connected : p.isAlive) {
|
|
352
|
-
p.kill('SIGTERM');
|
|
353
|
-
}
|
|
354
|
-
});
|
|
367
|
+
process.once('SIGTERM', () => {
|
|
368
|
+
cleanUp('SIGTERM');
|
|
355
369
|
// no exit here because we expect child processes to terminate which
|
|
356
370
|
// will store results to the cache and will terminate this process
|
|
357
371
|
});
|
|
358
|
-
process.
|
|
359
|
-
|
|
360
|
-
if ('connected' in p ? p.connected : p.isAlive) {
|
|
361
|
-
p.kill('SIGTERM');
|
|
362
|
-
}
|
|
363
|
-
});
|
|
372
|
+
process.once('SIGHUP', () => {
|
|
373
|
+
cleanUp('SIGTERM');
|
|
364
374
|
// no exit here because we expect child processes to terminate which
|
|
365
375
|
// will store results to the cache and will terminate this process
|
|
366
376
|
});
|
|
@@ -403,3 +413,15 @@ function logClearLineToPrefixTransformer(prefix) {
|
|
|
403
413
|
},
|
|
404
414
|
});
|
|
405
415
|
}
|
|
416
|
+
function addPrefixTransformer(prefix) {
|
|
417
|
+
const newLineSeparator = process.platform.startsWith('win') ? '\r\n' : '\n';
|
|
418
|
+
return new stream_1.Transform({
|
|
419
|
+
transform(chunk, _encoding, callback) {
|
|
420
|
+
const list = chunk.toString().split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
|
|
421
|
+
list
|
|
422
|
+
.filter(Boolean)
|
|
423
|
+
.forEach((m) => this.push(prefix ? prefix + ' ' + m + newLineSeparator : m + newLineSeparator));
|
|
424
|
+
callback();
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initTasksRunner = initTasksRunner;
|
|
4
|
-
const workspace_configuration_check_1 = require("../utils/workspace-configuration-check");
|
|
5
4
|
const configuration_1 = require("../config/configuration");
|
|
6
5
|
const project_graph_1 = require("../project-graph/project-graph");
|
|
7
6
|
const run_command_1 = require("./run-command");
|
|
@@ -12,7 +11,6 @@ const dotenv_1 = require("../utils/dotenv");
|
|
|
12
11
|
async function initTasksRunner(nxArgs) {
|
|
13
12
|
perf_hooks_1.performance.mark('init-local');
|
|
14
13
|
(0, dotenv_1.loadRootEnvFiles)();
|
|
15
|
-
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
|
16
14
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
17
15
|
if (nxArgs.verbose) {
|
|
18
16
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { TaskStatus } from './tasks-runner';
|
|
2
2
|
import { Task } from '../config/task-graph';
|
|
3
|
+
/**
|
|
4
|
+
* The result of a completed {@link Task}
|
|
5
|
+
*/
|
|
3
6
|
export interface TaskResult {
|
|
4
7
|
task: Task;
|
|
5
8
|
status: TaskStatus;
|
|
6
9
|
code: number;
|
|
7
10
|
terminalOutput?: string;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A map of {@link TaskResult} keyed by the ID of the completed {@link Task}s
|
|
14
|
+
*/
|
|
15
|
+
export type TaskResults = Record<string, TaskResult>;
|
|
9
16
|
export interface TaskMetadata {
|
|
10
17
|
groupId: number;
|
|
11
18
|
}
|
|
@@ -3,7 +3,7 @@ import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
|
3
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
|
4
4
|
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
5
5
|
import { NxArgs } from '../utils/command-line-utils';
|
|
6
|
-
import { LifeCycle, TaskResult } from './life-cycle';
|
|
6
|
+
import { LifeCycle, TaskResult, TaskResults } from './life-cycle';
|
|
7
7
|
import { TasksRunner } from './tasks-runner';
|
|
8
8
|
export declare function runCommand(projectsToRun: ProjectGraphProjectNode[], currentProjectGraph: ProjectGraph, { nxJson }: {
|
|
9
9
|
nxJson: NxJsonConfiguration;
|
|
@@ -16,9 +16,7 @@ export declare function runCommandForTasks(projectsToRun: ProjectGraphProjectNod
|
|
|
16
16
|
}, nxArgs: NxArgs, overrides: any, initiatingProject: string | null, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, extraOptions: {
|
|
17
17
|
excludeTaskDependencies: boolean;
|
|
18
18
|
loadDotEnvFiles: boolean;
|
|
19
|
-
}): Promise<
|
|
20
|
-
[id: string]: TaskResult;
|
|
21
|
-
}>;
|
|
19
|
+
}): Promise<TaskResults>;
|
|
22
20
|
export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, }: {
|
|
23
21
|
tasks: Task[];
|
|
24
22
|
projectGraph: ProjectGraph;
|
|
@@ -36,7 +36,8 @@ const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle
|
|
|
36
36
|
const task_graph_utils_1 = require("./task-graph-utils");
|
|
37
37
|
const utils_1 = require("./utils");
|
|
38
38
|
const chalk = require("chalk");
|
|
39
|
-
const
|
|
39
|
+
const nx_key_1 = require("../utils/nx-key");
|
|
40
|
+
const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
|
|
40
41
|
async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {
|
|
41
42
|
const { runnerOptions } = getRunner(nxArgs, nxJson);
|
|
42
43
|
const isRunOne = initiatingProject != null;
|
|
@@ -102,10 +103,25 @@ function createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies,
|
|
|
102
103
|
}
|
|
103
104
|
async function runCommand(projectsToRun, currentProjectGraph, { nxJson }, nxArgs, overrides, initiatingProject, extraTargetDependencies, extraOptions) {
|
|
104
105
|
const status = await (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
await (0, tasks_execution_hooks_1.runPreTasksExecution)({
|
|
107
|
+
workspaceRoot: workspace_root_1.workspaceRoot,
|
|
108
|
+
nxJsonConfiguration: nxJson,
|
|
109
|
+
});
|
|
110
|
+
const taskResults = await runCommandForTasks(projectsToRun, currentProjectGraph, { nxJson }, {
|
|
111
|
+
...nxArgs,
|
|
112
|
+
skipNxCache: nxArgs.skipNxCache ||
|
|
113
|
+
process.env.NX_SKIP_NX_CACHE === 'true' ||
|
|
114
|
+
process.env.NX_DISABLE_NX_CACHE === 'true',
|
|
115
|
+
}, overrides, initiatingProject, extraTargetDependencies, extraOptions);
|
|
116
|
+
const result = Object.values(taskResults).some((taskResult) => taskResult.status === 'failure' || taskResult.status === 'skipped')
|
|
107
117
|
? 1
|
|
108
118
|
: 0;
|
|
119
|
+
await (0, tasks_execution_hooks_1.runPostTasksExecution)({
|
|
120
|
+
taskResults,
|
|
121
|
+
workspaceRoot: workspace_root_1.workspaceRoot,
|
|
122
|
+
nxJsonConfiguration: nxJson,
|
|
123
|
+
});
|
|
124
|
+
return result;
|
|
109
125
|
});
|
|
110
126
|
return status;
|
|
111
127
|
}
|
|
@@ -125,12 +141,12 @@ async function runCommandForTasks(projectsToRun, currentProjectGraph, { nxJson }
|
|
|
125
141
|
initiatingProject,
|
|
126
142
|
});
|
|
127
143
|
await renderIsDone;
|
|
128
|
-
await (0,
|
|
144
|
+
await (0, nx_key_1.printNxKey)();
|
|
129
145
|
return taskResults;
|
|
130
146
|
}
|
|
131
147
|
async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
|
|
132
148
|
let taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
|
|
133
|
-
if (nxArgs.skipSync) {
|
|
149
|
+
if (nxArgs.skipSync || (0, is_ci_1.isCI)()) {
|
|
134
150
|
return { projectGraph, taskGraph };
|
|
135
151
|
}
|
|
136
152
|
// collect unique syncGenerators from the tasks
|
|
@@ -149,10 +165,9 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
|
|
|
149
165
|
const failedSyncGeneratorsFixMessageLines = (0, sync_generators_1.getFailedSyncGeneratorsFixMessageLines)(results, nxArgs.verbose);
|
|
150
166
|
const outOfSyncTitle = 'The workspace is out of sync';
|
|
151
167
|
const resultBodyLines = (0, sync_generators_1.getSyncGeneratorSuccessResultsMessageLines)(results);
|
|
152
|
-
const fixMessage = '
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// If the user is running in CI or is running in a non-TTY environment we
|
|
168
|
+
const fixMessage = 'Make sure to run `nx sync` to apply the identified changes or set `sync.applyChanges` to `true` in your `nx.json` to apply them automatically when running tasks in interactive environments.';
|
|
169
|
+
if (!process.stdout.isTTY) {
|
|
170
|
+
// If the user is running a non-TTY environment we
|
|
156
171
|
// throw an error to stop the execution of the tasks.
|
|
157
172
|
if (areAllResultsFailures) {
|
|
158
173
|
output_1.output.error({
|
|
@@ -200,7 +215,6 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
|
|
|
200
215
|
...resultBodyLines,
|
|
201
216
|
'',
|
|
202
217
|
'Your workspace is set to not apply the identified changes automatically (`sync.applyChanges` is set to `false` in your `nx.json`).',
|
|
203
|
-
willErrorOnCiMessage,
|
|
204
218
|
fixMessage,
|
|
205
219
|
],
|
|
206
220
|
});
|
|
@@ -219,10 +233,12 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
|
|
|
219
233
|
title: outOfSyncTitle,
|
|
220
234
|
bodyLines: [
|
|
221
235
|
...resultBodyLines,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
236
|
+
...(nxJson.sync?.applyChanges === true
|
|
237
|
+
? [
|
|
238
|
+
'',
|
|
239
|
+
'Proceeding to sync the identified changes automatically (`sync.applyChanges` is set to `true` in your `nx.json`).',
|
|
240
|
+
]
|
|
241
|
+
: []),
|
|
226
242
|
],
|
|
227
243
|
});
|
|
228
244
|
const applyChanges = nxJson.sync?.applyChanges === true ||
|
|
@@ -298,7 +314,7 @@ async function promptForApplyingSyncGeneratorChanges() {
|
|
|
298
314
|
try {
|
|
299
315
|
const promptConfig = {
|
|
300
316
|
name: 'applyChanges',
|
|
301
|
-
type: '
|
|
317
|
+
type: 'autocomplete',
|
|
302
318
|
message: 'Would you like to sync the identified changes to get your workspace up to date?',
|
|
303
319
|
choices: [
|
|
304
320
|
{
|
|
@@ -322,7 +338,7 @@ async function confirmRunningTasksWithSyncFailures() {
|
|
|
322
338
|
try {
|
|
323
339
|
const promptConfig = {
|
|
324
340
|
name: 'runTasks',
|
|
325
|
-
type: '
|
|
341
|
+
type: 'autocomplete',
|
|
326
342
|
message: 'Would you like to ignore the sync failures and continue running the tasks?',
|
|
327
343
|
choices: [
|
|
328
344
|
{
|
|
@@ -511,12 +527,20 @@ function loadTasksRunner(modulePath) {
|
|
|
511
527
|
}
|
|
512
528
|
function getRunner(nxArgs, nxJson) {
|
|
513
529
|
let runner = nxArgs.runner;
|
|
514
|
-
runner = runner
|
|
530
|
+
runner = runner ?? 'default';
|
|
515
531
|
if (runner !== 'default' && !nxJson.tasksRunnerOptions?.[runner]) {
|
|
516
532
|
throw new Error(`Could not find runner configuration for ${runner}`);
|
|
517
533
|
}
|
|
518
534
|
const modulePath = getTasksRunnerPath(runner, nxJson);
|
|
519
535
|
try {
|
|
536
|
+
if (isCustomRunnerPath(modulePath)) {
|
|
537
|
+
output_1.output.warn({
|
|
538
|
+
title: `Custom task runners will be replaced by a new API starting with Nx 21.`,
|
|
539
|
+
bodyLines: [
|
|
540
|
+
`For more information, see https://nx.dev/deprecated/custom-tasks-runner`,
|
|
541
|
+
],
|
|
542
|
+
});
|
|
543
|
+
}
|
|
520
544
|
const tasksRunner = loadTasksRunner(modulePath);
|
|
521
545
|
return {
|
|
522
546
|
tasksRunner,
|
|
@@ -527,6 +551,7 @@ function getRunner(nxArgs, nxJson) {
|
|
|
527
551
|
throw new Error(`Could not find runner configuration for ${runner}`);
|
|
528
552
|
}
|
|
529
553
|
}
|
|
554
|
+
const defaultTasksRunnerPath = require.resolve('./default-tasks-runner');
|
|
530
555
|
function getTasksRunnerPath(runner, nxJson) {
|
|
531
556
|
let modulePath = nxJson.tasksRunnerOptions?.[runner]?.runner;
|
|
532
557
|
if (modulePath) {
|
|
@@ -544,7 +569,7 @@ function getTasksRunnerPath(runner, nxJson) {
|
|
|
544
569
|
process.env.NX_CLOUD_ACCESS_TOKEN ||
|
|
545
570
|
// Nx Cloud ID specified in nxJson
|
|
546
571
|
nxJson.nxCloudId;
|
|
547
|
-
return isCloudRunner ? 'nx-cloud' :
|
|
572
|
+
return isCloudRunner ? 'nx-cloud' : defaultTasksRunnerPath;
|
|
548
573
|
}
|
|
549
574
|
function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
|
550
575
|
const defaultCacheableOperations = [];
|
|
@@ -588,3 +613,11 @@ function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
|
|
588
613
|
}
|
|
589
614
|
return result;
|
|
590
615
|
}
|
|
616
|
+
function isCustomRunnerPath(modulePath) {
|
|
617
|
+
return ![
|
|
618
|
+
'nx-cloud',
|
|
619
|
+
'@nrwl/nx-cloud',
|
|
620
|
+
'nx/tasks-runners/default',
|
|
621
|
+
defaultTasksRunnerPath,
|
|
622
|
+
].includes(modulePath);
|
|
623
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { ProjectGraph } from '../config/project-graph';
|
|
2
2
|
import { TaskGraph } from '../config/task-graph';
|
|
3
|
+
/**
|
|
4
|
+
* This function finds a cycle in the graph.
|
|
5
|
+
* @returns the first cycle found, or null if no cycle is found.
|
|
6
|
+
*/
|
|
3
7
|
export declare function findCycle(graph: {
|
|
4
8
|
dependencies: Record<string, string[]>;
|
|
5
9
|
}): string[] | null;
|
|
10
|
+
/**
|
|
11
|
+
* This function finds all cycles in the graph.
|
|
12
|
+
* @returns a list of unique task ids in all cycles found, or null if no cycle is found.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findCycles(graph: {
|
|
15
|
+
dependencies: Record<string, string[]>;
|
|
16
|
+
}): Set<string> | null;
|
|
6
17
|
export declare function makeAcyclic(graph: {
|
|
7
18
|
roots: string[];
|
|
8
19
|
dependencies: Record<string, string[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findCycle = findCycle;
|
|
4
|
+
exports.findCycles = findCycles;
|
|
4
5
|
exports.makeAcyclic = makeAcyclic;
|
|
5
6
|
exports.validateNoAtomizedTasks = validateNoAtomizedTasks;
|
|
6
7
|
const output_1 = require("../utils/output");
|
|
@@ -17,6 +18,10 @@ function _findCycle(graph, id, visited, path) {
|
|
|
17
18
|
}
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* This function finds a cycle in the graph.
|
|
23
|
+
* @returns the first cycle found, or null if no cycle is found.
|
|
24
|
+
*/
|
|
20
25
|
function findCycle(graph) {
|
|
21
26
|
const visited = {};
|
|
22
27
|
for (const t of Object.keys(graph.dependencies)) {
|
|
@@ -29,6 +34,24 @@ function findCycle(graph) {
|
|
|
29
34
|
}
|
|
30
35
|
return null;
|
|
31
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* This function finds all cycles in the graph.
|
|
39
|
+
* @returns a list of unique task ids in all cycles found, or null if no cycle is found.
|
|
40
|
+
*/
|
|
41
|
+
function findCycles(graph) {
|
|
42
|
+
const visited = {};
|
|
43
|
+
const cycles = new Set();
|
|
44
|
+
for (const t of Object.keys(graph.dependencies)) {
|
|
45
|
+
visited[t] = false;
|
|
46
|
+
}
|
|
47
|
+
for (const t of Object.keys(graph.dependencies)) {
|
|
48
|
+
const cycle = _findCycle(graph, t, visited, [t]);
|
|
49
|
+
if (cycle) {
|
|
50
|
+
cycle.forEach((t) => cycles.add(t));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return cycles.size ? cycles : null;
|
|
54
|
+
}
|
|
32
55
|
function _makeAcyclic(graph, id, visited, path) {
|
|
33
56
|
if (visited[id])
|
|
34
57
|
return;
|
|
@@ -127,17 +127,20 @@ class TaskOrchestrator {
|
|
|
127
127
|
return res.filter((r) => r !== null);
|
|
128
128
|
}
|
|
129
129
|
async applyCachedResult(task) {
|
|
130
|
-
task.startTime = Date.now();
|
|
131
130
|
const cachedResult = await this.cache.get(task);
|
|
132
131
|
if (!cachedResult || cachedResult.code !== 0)
|
|
133
132
|
return null;
|
|
134
133
|
const outputs = task.outputs;
|
|
135
|
-
const shouldCopyOutputsFromCache =
|
|
134
|
+
const shouldCopyOutputsFromCache =
|
|
135
|
+
// No output files to restore
|
|
136
|
+
!!outputs.length &&
|
|
137
|
+
// Remote caches are restored to output dirs when applied and using db cache
|
|
138
|
+
(!cachedResult.remote || !(0, cache_1.dbCacheEnabled)(this.nxJson)) &&
|
|
139
|
+
// Output files have not been touched since last run
|
|
136
140
|
(await this.shouldCopyOutputsFromCache(outputs, task.hash));
|
|
137
141
|
if (shouldCopyOutputsFromCache) {
|
|
138
142
|
await this.cache.copyFilesFromCache(task.hash, cachedResult, outputs);
|
|
139
143
|
}
|
|
140
|
-
task.endTime = Date.now();
|
|
141
144
|
const status = cachedResult.remote
|
|
142
145
|
? 'remote-cache'
|
|
143
146
|
: shouldCopyOutputsFromCache
|
|
@@ -168,6 +171,7 @@ class TaskOrchestrator {
|
|
|
168
171
|
results.push(...batchResults);
|
|
169
172
|
}
|
|
170
173
|
await this.postRunSteps(tasks, results, doNotSkipCache, { groupId });
|
|
174
|
+
this.forkedProcessTaskRunner.cleanUpBatchProcesses();
|
|
171
175
|
const tasksCompleted = taskEntries.filter(([taskId]) => this.completedTasks[taskId]);
|
|
172
176
|
// Batch is still not done, run it again
|
|
173
177
|
if (tasksCompleted.length !== taskEntries.length) {
|
|
@@ -179,7 +183,7 @@ class TaskOrchestrator {
|
|
|
179
183
|
}
|
|
180
184
|
async runBatch(batch, env) {
|
|
181
185
|
try {
|
|
182
|
-
const results = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.taskGraph, env);
|
|
186
|
+
const results = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.projectGraph, this.taskGraph, env);
|
|
183
187
|
const batchResultEntries = Object.entries(results);
|
|
184
188
|
return batchResultEntries.map(([taskId, result]) => ({
|
|
185
189
|
...result,
|
|
@@ -333,10 +337,16 @@ class TaskOrchestrator {
|
|
|
333
337
|
// endregion Single Task
|
|
334
338
|
// region Lifecycle
|
|
335
339
|
async preRunSteps(tasks, metadata) {
|
|
340
|
+
const now = Date.now();
|
|
341
|
+
for (const task of tasks) {
|
|
342
|
+
task.startTime = now;
|
|
343
|
+
}
|
|
336
344
|
await this.options.lifeCycle.startTasks(tasks, metadata);
|
|
337
345
|
}
|
|
338
346
|
async postRunSteps(tasks, results, doNotSkipCache, { groupId }) {
|
|
347
|
+
const now = Date.now();
|
|
339
348
|
for (const task of tasks) {
|
|
349
|
+
task.endTime = now;
|
|
340
350
|
await this.recordOutputsHash(task);
|
|
341
351
|
}
|
|
342
352
|
if (doNotSkipCache) {
|
|
@@ -362,6 +362,8 @@ function getSerializedArgsForTask(task, isVerbose) {
|
|
|
362
362
|
function shouldStreamOutput(task, initiatingProject) {
|
|
363
363
|
if (process.env.NX_STREAM_OUTPUT === 'true')
|
|
364
364
|
return true;
|
|
365
|
+
if (process.env.NX_STREAM_OUTPUT === 'false')
|
|
366
|
+
return false;
|
|
365
367
|
if (longRunningTask(task))
|
|
366
368
|
return true;
|
|
367
369
|
if (task.target.project === initiatingProject)
|
package/src/utils/ab-testing.js
CHANGED
|
@@ -99,7 +99,7 @@ function shouldRecordStats() {
|
|
|
99
99
|
try {
|
|
100
100
|
const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, {
|
|
101
101
|
encoding: 'utf-8',
|
|
102
|
-
windowsHide:
|
|
102
|
+
windowsHide: false,
|
|
103
103
|
});
|
|
104
104
|
const url = new URL(stdout.trim());
|
|
105
105
|
// don't record stats when testing locally
|
|
@@ -75,6 +75,10 @@ function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDe
|
|
|
75
75
|
const projectName = implicit.startsWith('!')
|
|
76
76
|
? implicit.substring(1)
|
|
77
77
|
: implicit;
|
|
78
|
+
// Do not error on cross-workspace implicit dependency references
|
|
79
|
+
if (projectName.startsWith('nx-cloud:')) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
78
82
|
return !(projectConfigurations[projectName] ||
|
|
79
83
|
(0, find_matching_projects_1.findMatchingProjects)([implicit], projects).length);
|
|
80
84
|
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type ExecOptions, type ExecSyncOptions } from 'child_process';
|
|
2
|
+
import { PackageManagerCommands } from './package-manager';
|
|
2
3
|
import { ChildProcess } from '../native';
|
|
4
|
+
export declare function getRunNxBaseCommand(packageManagerCommand?: PackageManagerCommands, cwd?: string): string;
|
|
3
5
|
export declare function runNxSync(cmd: string, options?: ExecSyncOptions & {
|
|
4
6
|
cwd?: string;
|
|
7
|
+
packageManagerCommand?: PackageManagerCommands;
|
|
5
8
|
}): void;
|
|
6
9
|
export declare function runNxAsync(cmd: string, options?: ExecOptions & {
|
|
7
10
|
cwd?: string;
|
|
8
11
|
silent?: boolean;
|
|
12
|
+
packageManagerCommand?: PackageManagerCommands;
|
|
9
13
|
}): Promise<void>;
|
|
10
14
|
export declare class PseudoTtyProcess {
|
|
11
15
|
private childProcess;
|