nx 21.0.0-beta.1 → 21.0.0-beta.11
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 +5 -1
- package/migrations.json +15 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +187 -35
- package/schemas/project-schema.json +5 -0
- package/src/adapter/angular-json.js +11 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +52 -38
- 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/check-compatible-with-plugins.js +7 -1
- 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/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- 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 +110 -45
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +70 -39
- package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
- package/src/command-line/migrate/migrate-ui-api.js +227 -0
- package/src/command-line/migrate/migrate.d.ts +23 -4
- package/src/command-line/migrate/migrate.js +138 -86
- package/src/command-line/nx-commands.js +19 -5
- 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.js +18 -15
- package/src/command-line/release/command-object.d.ts +8 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +139 -45
- 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/index.d.ts +4 -0
- 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 +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- 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 +252 -0
- package/src/command-line/release/version/release-group-processor.js +1057 -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 +93 -0
- package/src/command-line/release/version/test-utils.js +415 -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 +171 -0
- package/src/command-line/release/version/version-actions.js +195 -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 +84 -262
- package/src/command-line/repair/repair.js +8 -3
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +2 -2
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/config/misc-interfaces.d.ts +20 -2
- package/src/config/nx-json.d.ts +158 -18
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -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 +2 -0
- package/src/daemon/client/client.js +15 -0
- 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/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/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-exports.d.ts +1 -1
- package/src/devkit-internals.d.ts +3 -2
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +9 -4
- package/src/executors/run-commands/running-tasks.js +103 -30
- package/src/executors/run-script/run-script.impl.js +4 -3
- 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/migrations/update-21-0-0/release-version-config-changes.d.ts +2 -0
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/migrations/update-21-0-0/remove-custom-tasks-runner.d.ts +2 -0
- package/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +38 -0
- package/src/migrations/{update-18-0-0/disable-crystal-for-existing-workspaces.js → update-21-0-0/remove-legacy-cache.js} +10 -4
- package/src/native/index.d.ts +98 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +7 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/index.d.ts +2 -1
- package/src/plugins/js/index.js +8 -1
- 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 +8 -6
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- 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 +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.d.ts +1 -1
- package/src/plugins/package-json/create-nodes.js +4 -2
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/loaded-nx-plugin.js +1 -5
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
- package/src/project-graph/utils/project-configuration-utils.js +54 -21
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +4 -5
- package/src/tasks-runner/cache.d.ts +21 -8
- package/src/tasks-runner/cache.js +106 -38
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +11 -11
- package/src/tasks-runner/default-tasks-runner.js +5 -14
- package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
- package/src/tasks-runner/forked-process-task-runner.js +59 -46
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +62 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +64 -0
- package/src/tasks-runner/life-cycle.d.ts +14 -3
- package/src/tasks-runner/life-cycle.js +37 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +230 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +11 -7
- package/src/tasks-runner/pseudo-terminal.js +47 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +219 -63
- package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
- package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
- package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-graph-utils.d.ts +3 -0
- package/src/tasks-runner/task-graph-utils.js +31 -2
- package/src/tasks-runner/task-orchestrator.d.ts +26 -10
- package/src/tasks-runner/task-orchestrator.js +221 -57
- package/src/tasks-runner/tasks-runner.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +9 -0
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +18 -12
- 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 +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/git-utils.d.ts +1 -1
- package/src/utils/git-utils.js +8 -3
- package/src/utils/handle-errors.js +15 -0
- 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-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -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/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/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
- /package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/remove-legacy-cache.d.ts} +0 -0
@@ -1,26 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TaskOrchestrator = void 0;
|
4
|
+
exports.getThreadCount = getThreadCount;
|
4
5
|
const events_1 = require("events");
|
5
|
-
const perf_hooks_1 = require("perf_hooks");
|
6
|
-
const path_1 = require("path");
|
7
6
|
const fs_1 = require("fs");
|
7
|
+
const path_1 = require("path");
|
8
|
+
const perf_hooks_1 = require("perf_hooks");
|
8
9
|
const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
|
9
|
-
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
10
|
-
const cache_1 = require("./cache");
|
11
|
-
const utils_1 = require("./utils");
|
12
|
-
const tasks_schedule_1 = require("./tasks-schedule");
|
13
10
|
const hash_task_1 = require("../hasher/hash-task");
|
14
|
-
const
|
15
|
-
const
|
11
|
+
const native_1 = require("../native");
|
12
|
+
const db_connection_1 = require("../utils/db-connection");
|
16
13
|
const output_1 = require("../utils/output");
|
17
14
|
const params_1 = require("../utils/params");
|
15
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
16
|
+
const cache_1 = require("./cache");
|
17
|
+
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
18
|
+
const is_tui_enabled_1 = require("./is-tui-enabled");
|
19
|
+
const pseudo_terminal_1 = require("./pseudo-terminal");
|
18
20
|
const noop_child_process_1 = require("./running-tasks/noop-child-process");
|
21
|
+
const task_env_1 = require("./task-env");
|
22
|
+
const tasks_schedule_1 = require("./tasks-schedule");
|
23
|
+
const utils_1 = require("./utils");
|
24
|
+
const shared_running_task_1 = require("./running-tasks/shared-running-task");
|
19
25
|
class TaskOrchestrator {
|
20
26
|
// endregion internal state
|
21
|
-
constructor(hasher, initiatingProject, projectGraph, taskGraph, nxJson, options, bail, daemon, outputStyle) {
|
27
|
+
constructor(hasher, initiatingProject, initiatingTasks, projectGraph, taskGraph, nxJson, options, bail, daemon, outputStyle, taskGraphForHashing = taskGraph) {
|
22
28
|
this.hasher = hasher;
|
23
29
|
this.initiatingProject = initiatingProject;
|
30
|
+
this.initiatingTasks = initiatingTasks;
|
24
31
|
this.projectGraph = projectGraph;
|
25
32
|
this.taskGraph = taskGraph;
|
26
33
|
this.nxJson = nxJson;
|
@@ -28,13 +35,17 @@ class TaskOrchestrator {
|
|
28
35
|
this.bail = bail;
|
29
36
|
this.daemon = daemon;
|
30
37
|
this.outputStyle = outputStyle;
|
38
|
+
this.taskGraphForHashing = taskGraphForHashing;
|
31
39
|
this.taskDetails = (0, hash_task_1.getTaskDetails)();
|
32
40
|
this.cache = (0, cache_1.getCache)(this.options);
|
33
|
-
this.
|
41
|
+
this.tuiEnabled = (0, is_tui_enabled_1.isTuiEnabled)(this.nxJson);
|
42
|
+
this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options, this.tuiEnabled);
|
43
|
+
this.runningTasksService = new native_1.RunningTasksService((0, db_connection_1.getDbConnection)());
|
34
44
|
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
|
35
45
|
// region internal state
|
36
46
|
this.batchEnv = (0, task_env_1.getEnvVariablesForBatchProcess)(this.options.skipNxCache, this.options.captureStderr);
|
37
47
|
this.reverseTaskDeps = (0, utils_1.calculateReverseDeps)(this.taskGraph);
|
48
|
+
this.initializingTaskIds = new Set(this.initiatingTasks.map((t) => t.id));
|
38
49
|
this.processedTasks = new Map();
|
39
50
|
this.processedBatches = new Map();
|
40
51
|
this.completedTasks = {};
|
@@ -42,20 +53,21 @@ class TaskOrchestrator {
|
|
42
53
|
this.groups = [];
|
43
54
|
this.bailed = false;
|
44
55
|
this.runningContinuousTasks = new Map();
|
45
|
-
this.cleaningUp = false;
|
46
56
|
}
|
47
|
-
async
|
57
|
+
async init() {
|
48
58
|
// Init the ForkedProcessTaskRunner, TasksSchedule, and Cache
|
49
59
|
await Promise.all([
|
50
60
|
this.forkedProcessTaskRunner.init(),
|
51
61
|
this.tasksSchedule.init(),
|
52
62
|
'init' in this.cache ? this.cache.init() : null,
|
53
63
|
]);
|
64
|
+
}
|
65
|
+
async run() {
|
66
|
+
await this.init();
|
54
67
|
// initial scheduling
|
55
68
|
await this.tasksSchedule.scheduleNextTasks();
|
56
69
|
perf_hooks_1.performance.mark('task-execution:start');
|
57
|
-
const threadCount = this.options.
|
58
|
-
Object.values(this.taskGraph.tasks).filter((t) => t.continuous).length;
|
70
|
+
const threadCount = getThreadCount(this.options, this.taskGraph);
|
59
71
|
const threads = [];
|
60
72
|
process.stdout.setMaxListeners(threadCount + events_1.defaultMaxListeners);
|
61
73
|
process.stderr.setMaxListeners(threadCount + events_1.defaultMaxListeners);
|
@@ -63,7 +75,19 @@ class TaskOrchestrator {
|
|
63
75
|
for (let i = 0; i < threadCount; ++i) {
|
64
76
|
threads.push(this.executeNextBatchOfTasksUsingTaskSchedule());
|
65
77
|
}
|
66
|
-
await Promise.
|
78
|
+
await Promise.race([
|
79
|
+
Promise.all(threads),
|
80
|
+
...(this.tuiEnabled
|
81
|
+
? [
|
82
|
+
new Promise((resolve) => {
|
83
|
+
this.options.lifeCycle.registerForcedShutdownCallback(() => {
|
84
|
+
// The user force quit the TUI with ctrl+c, so proceed onto cleanup
|
85
|
+
resolve(undefined);
|
86
|
+
});
|
87
|
+
}),
|
88
|
+
]
|
89
|
+
: []),
|
90
|
+
]);
|
67
91
|
perf_hooks_1.performance.mark('task-execution:end');
|
68
92
|
perf_hooks_1.performance.measure('task-execution', 'task-execution:start', 'task-execution:end');
|
69
93
|
this.cache.removeOldCacheRecords();
|
@@ -100,12 +124,20 @@ class TaskOrchestrator {
|
|
100
124
|
// block until some other task completes, then try again
|
101
125
|
return new Promise((res) => this.waitingForTasks.push(res)).then(() => this.executeNextBatchOfTasksUsingTaskSchedule());
|
102
126
|
}
|
127
|
+
processTasks(taskIds) {
|
128
|
+
for (const taskId of taskIds) {
|
129
|
+
// Task is already handled or being handled
|
130
|
+
if (!this.processedTasks.has(taskId)) {
|
131
|
+
this.processedTasks.set(taskId, this.processTask(taskId));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
103
135
|
// region Processing Scheduled Tasks
|
104
|
-
async
|
136
|
+
async processTask(taskId) {
|
105
137
|
const task = this.taskGraph.tasks[taskId];
|
106
138
|
const taskSpecificEnv = (0, task_env_1.getTaskSpecificEnv)(task);
|
107
139
|
if (!task.hash) {
|
108
|
-
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.
|
140
|
+
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.taskGraphForHashing, task, taskSpecificEnv, this.taskDetails);
|
109
141
|
}
|
110
142
|
await this.options.lifeCycle.scheduleTask(task);
|
111
143
|
return taskSpecificEnv;
|
@@ -113,7 +145,7 @@ class TaskOrchestrator {
|
|
113
145
|
async processScheduledBatch(batch) {
|
114
146
|
await Promise.all(Object.values(batch.taskGraph.tasks).map(async (task) => {
|
115
147
|
if (!task.hash) {
|
116
|
-
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.
|
148
|
+
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.taskGraphForHashing, task, this.batchEnv, this.taskDetails);
|
117
149
|
}
|
118
150
|
await this.options.lifeCycle.scheduleTask(task);
|
119
151
|
}));
|
@@ -123,12 +155,7 @@ class TaskOrchestrator {
|
|
123
155
|
for (const batch of scheduledBatches) {
|
124
156
|
this.processedBatches.set(batch, this.processScheduledBatch(batch));
|
125
157
|
}
|
126
|
-
|
127
|
-
// Task is already handled or being handled
|
128
|
-
if (!this.processedTasks.has(taskId)) {
|
129
|
-
this.processedTasks.set(taskId, this.processScheduledTask(taskId));
|
130
|
-
}
|
131
|
-
}
|
158
|
+
this.processTasks(scheduledTasks);
|
132
159
|
}
|
133
160
|
// endregion Processing Scheduled Tasks
|
134
161
|
// region Applying Cache
|
@@ -142,7 +169,12 @@ class TaskOrchestrator {
|
|
142
169
|
if (!cachedResult || cachedResult.code !== 0)
|
143
170
|
return null;
|
144
171
|
const outputs = task.outputs;
|
145
|
-
const shouldCopyOutputsFromCache =
|
172
|
+
const shouldCopyOutputsFromCache =
|
173
|
+
// No output files to restore
|
174
|
+
!!outputs.length &&
|
175
|
+
// Remote caches are restored to output dirs when applied and using db cache
|
176
|
+
(!cachedResult.remote || !(0, cache_1.dbCacheEnabled)()) &&
|
177
|
+
// Output files have not been touched since last run
|
146
178
|
(await this.shouldCopyOutputsFromCache(outputs, task.hash));
|
147
179
|
if (shouldCopyOutputsFromCache) {
|
148
180
|
await this.cache.copyFilesFromCache(task.hash, cachedResult, outputs);
|
@@ -154,6 +186,7 @@ class TaskOrchestrator {
|
|
154
186
|
: 'local-cache-kept-existing';
|
155
187
|
this.options.lifeCycle.printTaskTerminalOutput(task, status, cachedResult.terminalOutput);
|
156
188
|
return {
|
189
|
+
code: cachedResult.code,
|
157
190
|
task,
|
158
191
|
status,
|
159
192
|
};
|
@@ -161,6 +194,7 @@ class TaskOrchestrator {
|
|
161
194
|
// endregion Applying Cache
|
162
195
|
// region Batch
|
163
196
|
async applyFromCacheOrRunBatch(doNotSkipCache, batch, groupId) {
|
197
|
+
const applyFromCacheOrRunBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-apply-from-cache-or-run-batch:start');
|
164
198
|
const taskEntries = Object.entries(batch.taskGraph.tasks);
|
165
199
|
const tasks = taskEntries.map(([, task]) => task);
|
166
200
|
// Wait for batch to be processed
|
@@ -177,6 +211,7 @@ class TaskOrchestrator {
|
|
177
211
|
results.push(...batchResults);
|
178
212
|
}
|
179
213
|
await this.postRunSteps(tasks, results, doNotSkipCache, { groupId });
|
214
|
+
this.forkedProcessTaskRunner.cleanUpBatchProcesses();
|
180
215
|
const tasksCompleted = taskEntries.filter(([taskId]) => this.completedTasks[taskId]);
|
181
216
|
// Batch is still not done, run it again
|
182
217
|
if (tasksCompleted.length !== taskEntries.length) {
|
@@ -185,10 +220,14 @@ class TaskOrchestrator {
|
|
185
220
|
taskGraph: (0, utils_1.removeTasksFromTaskGraph)(batch.taskGraph, tasksCompleted.map(([taskId]) => taskId)),
|
186
221
|
}, groupId);
|
187
222
|
}
|
223
|
+
// Batch is done, mark it as completed
|
224
|
+
const applyFromCacheOrRunBatchEnd = perf_hooks_1.performance.mark('TaskOrchestrator-apply-from-cache-or-run-batch:end');
|
225
|
+
perf_hooks_1.performance.measure('TaskOrchestrator-apply-from-cache-or-run-batch', applyFromCacheOrRunBatchStart.name, applyFromCacheOrRunBatchEnd.name);
|
188
226
|
}
|
189
227
|
async runBatch(batch, env) {
|
228
|
+
const runBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:start');
|
190
229
|
try {
|
191
|
-
const batchProcess = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.taskGraph, env);
|
230
|
+
const batchProcess = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.projectGraph, this.taskGraph, env);
|
192
231
|
const results = await batchProcess.getResults();
|
193
232
|
const batchResultEntries = Object.entries(results);
|
194
233
|
return batchResultEntries.map(([taskId, result]) => ({
|
@@ -208,6 +247,10 @@ class TaskOrchestrator {
|
|
208
247
|
status: 'failure',
|
209
248
|
}));
|
210
249
|
}
|
250
|
+
finally {
|
251
|
+
const runBatchEnd = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:end');
|
252
|
+
perf_hooks_1.performance.measure('TaskOrchestrator-run-batch', runBatchStart.name, runBatchEnd.name);
|
253
|
+
}
|
211
254
|
}
|
212
255
|
// endregion Batch
|
213
256
|
// region Single Task
|
@@ -233,11 +276,13 @@ class TaskOrchestrator {
|
|
233
276
|
const { code, terminalOutput } = await childProcess.getResults();
|
234
277
|
results.push({
|
235
278
|
task,
|
279
|
+
code,
|
236
280
|
status: code === 0 ? 'success' : 'failure',
|
237
281
|
terminalOutput,
|
238
282
|
});
|
239
283
|
}
|
240
284
|
await this.postRunSteps([task], results, doNotSkipCache, { groupId });
|
285
|
+
return results[0];
|
241
286
|
}
|
242
287
|
async runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput) {
|
243
288
|
const shouldPrefix = streamOutput && process.env.NX_PREFIX_OUTPUT === 'true';
|
@@ -247,7 +292,6 @@ class TaskOrchestrator {
|
|
247
292
|
!shouldPrefix) {
|
248
293
|
try {
|
249
294
|
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
250
|
-
const isRunOne = this.initiatingProject != null;
|
251
295
|
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
252
296
|
if (combinedOptions.env) {
|
253
297
|
env = {
|
@@ -259,22 +303,48 @@ class TaskOrchestrator {
|
|
259
303
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
260
304
|
output_1.output.logCommand(args.join(' '));
|
261
305
|
}
|
262
|
-
const
|
306
|
+
const runCommandsOptions = {
|
263
307
|
...combinedOptions,
|
264
308
|
env,
|
265
|
-
usePty:
|
266
|
-
!this.tasksSchedule.hasTasks() &&
|
267
|
-
|
309
|
+
usePty: this.tuiEnabled ||
|
310
|
+
(!this.tasksSchedule.hasTasks() &&
|
311
|
+
this.runningContinuousTasks.size === 0),
|
268
312
|
streamOutput,
|
269
|
-
}
|
313
|
+
};
|
314
|
+
const runningTask = await (0, run_commands_impl_1.runCommands)(runCommandsOptions, {
|
270
315
|
root: workspace_root_1.workspaceRoot, // only root is needed in runCommands
|
271
316
|
});
|
272
|
-
|
273
|
-
if (
|
274
|
-
|
275
|
-
(
|
317
|
+
if (this.tuiEnabled) {
|
318
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
319
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
320
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
276
321
|
}
|
277
|
-
|
322
|
+
else {
|
323
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
324
|
+
runningTask.onOutput((output) => {
|
325
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
326
|
+
});
|
327
|
+
}
|
328
|
+
}
|
329
|
+
if (!streamOutput) {
|
330
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
331
|
+
// TODO: shouldn't this be checking if the task is continuous before writing anything to disk or calling printTaskTerminalOutput?
|
332
|
+
let terminalOutput = '';
|
333
|
+
runningTask.onOutput((data) => {
|
334
|
+
terminalOutput += data;
|
335
|
+
});
|
336
|
+
runningTask.onExit((code) => {
|
337
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, code === 0 ? 'success' : 'failure', terminalOutput);
|
338
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
339
|
+
});
|
340
|
+
}
|
341
|
+
else {
|
342
|
+
runningTask.onExit((code, terminalOutput) => {
|
343
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, code === 0 ? 'success' : 'failure', terminalOutput);
|
344
|
+
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
345
|
+
});
|
346
|
+
}
|
347
|
+
}
|
278
348
|
return runningTask;
|
279
349
|
}
|
280
350
|
catch (e) {
|
@@ -286,6 +356,10 @@ class TaskOrchestrator {
|
|
286
356
|
}
|
287
357
|
const terminalOutput = e.stack ?? e.message ?? '';
|
288
358
|
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput);
|
359
|
+
return new noop_child_process_1.NoopChildProcess({
|
360
|
+
code: 1,
|
361
|
+
terminalOutput,
|
362
|
+
});
|
289
363
|
}
|
290
364
|
}
|
291
365
|
else if (targetConfiguration.executor === 'nx:noop') {
|
@@ -297,14 +371,27 @@ class TaskOrchestrator {
|
|
297
371
|
}
|
298
372
|
else {
|
299
373
|
// cache prep
|
300
|
-
|
374
|
+
const runningTask = await this.runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput);
|
375
|
+
if (this.tuiEnabled) {
|
376
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
377
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
378
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
379
|
+
}
|
380
|
+
else if ('onOutput' in runningTask) {
|
381
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
382
|
+
runningTask.onOutput((output) => {
|
383
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
384
|
+
});
|
385
|
+
}
|
386
|
+
}
|
387
|
+
return runningTask;
|
301
388
|
}
|
302
389
|
}
|
303
390
|
async runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput) {
|
304
391
|
try {
|
305
392
|
const usePtyFork = process.env.NX_NATIVE_COMMAND_RUNNER !== 'false';
|
306
393
|
// Disable the pseudo terminal if this is a run-many or when running a continuous task as part of a run-one
|
307
|
-
const disablePseudoTerminal = !this.initiatingProject || task.continuous;
|
394
|
+
const disablePseudoTerminal = !this.tuiEnabled && (!this.initiatingProject || task.continuous);
|
308
395
|
// execution
|
309
396
|
const childProcess = usePtyFork
|
310
397
|
? await this.forkedProcessTaskRunner.forkProcess(task, {
|
@@ -335,6 +422,36 @@ class TaskOrchestrator {
|
|
335
422
|
}
|
336
423
|
}
|
337
424
|
async startContinuousTask(task, groupId) {
|
425
|
+
if (this.runningTasksService.getRunningTasks([task.id]).length) {
|
426
|
+
await this.preRunSteps([task], { groupId });
|
427
|
+
if (this.tuiEnabled) {
|
428
|
+
this.options.lifeCycle.setTaskStatus(task.id, 8 /* NativeTaskStatus.Shared */);
|
429
|
+
}
|
430
|
+
const runningTask = new shared_running_task_1.SharedRunningTask(this.runningTasksService, task.id);
|
431
|
+
this.runningContinuousTasks.set(task.id, runningTask);
|
432
|
+
runningTask.onExit(() => {
|
433
|
+
if (this.tuiEnabled) {
|
434
|
+
this.options.lifeCycle.setTaskStatus(task.id, 9 /* NativeTaskStatus.Stopped */);
|
435
|
+
}
|
436
|
+
this.runningContinuousTasks.delete(task.id);
|
437
|
+
});
|
438
|
+
// task is already running by another process, we schedule the next tasks
|
439
|
+
// and release the threads
|
440
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
441
|
+
if (this.initializingTaskIds.has(task.id)) {
|
442
|
+
await new Promise((res) => {
|
443
|
+
runningTask.onExit((code) => {
|
444
|
+
if (!this.tuiEnabled) {
|
445
|
+
if (code > 128) {
|
446
|
+
process.exit(code);
|
447
|
+
}
|
448
|
+
}
|
449
|
+
res();
|
450
|
+
});
|
451
|
+
});
|
452
|
+
}
|
453
|
+
return runningTask;
|
454
|
+
}
|
338
455
|
const taskSpecificEnv = await this.processedTasks.get(task.id);
|
339
456
|
await this.preRunSteps([task], { groupId });
|
340
457
|
const pipeOutput = await this.pipeOutputCapture(task);
|
@@ -349,25 +466,27 @@ class TaskOrchestrator {
|
|
349
466
|
: process.env.FORCE_COLOR, this.options.skipNxCache, this.options.captureStderr, null, null)
|
350
467
|
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
351
468
|
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
469
|
+
this.runningTasksService.addRunningTask(task.id);
|
352
470
|
this.runningContinuousTasks.set(task.id, childProcess);
|
353
|
-
childProcess.onExit((
|
354
|
-
if (
|
355
|
-
|
356
|
-
this.cleanup().then(() => {
|
357
|
-
process.exit(1);
|
358
|
-
});
|
471
|
+
childProcess.onExit(() => {
|
472
|
+
if (this.tuiEnabled) {
|
473
|
+
this.options.lifeCycle.setTaskStatus(task.id, 9 /* NativeTaskStatus.Stopped */);
|
359
474
|
}
|
475
|
+
this.runningTasksService.removeRunningTask(task.id);
|
476
|
+
this.runningContinuousTasks.delete(task.id);
|
360
477
|
});
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
478
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
479
|
+
if (this.initializingTaskIds.has(task.id)) {
|
480
|
+
await new Promise((res) => {
|
481
|
+
childProcess.onExit((code) => {
|
482
|
+
if (!this.tuiEnabled) {
|
483
|
+
if (code > 128) {
|
484
|
+
process.exit(code);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
res();
|
488
|
+
});
|
489
|
+
});
|
371
490
|
}
|
372
491
|
return childProcess;
|
373
492
|
}
|
@@ -430,6 +549,9 @@ class TaskOrchestrator {
|
|
430
549
|
status,
|
431
550
|
};
|
432
551
|
}));
|
552
|
+
await this.scheduleNextTasksAndReleaseThreads();
|
553
|
+
}
|
554
|
+
async scheduleNextTasksAndReleaseThreads() {
|
433
555
|
await this.tasksSchedule.scheduleNextTasks();
|
434
556
|
// release blocked threads
|
435
557
|
this.waitingForTasks.forEach((f) => f(null));
|
@@ -437,9 +559,13 @@ class TaskOrchestrator {
|
|
437
559
|
}
|
438
560
|
complete(taskResults) {
|
439
561
|
this.tasksSchedule.complete(taskResults.map(({ taskId }) => taskId));
|
562
|
+
this.cleanUpUnneededContinuousTasks();
|
440
563
|
for (const { taskId, status } of taskResults) {
|
441
564
|
if (this.completedTasks[taskId] === undefined) {
|
442
565
|
this.completedTasks[taskId] = status;
|
566
|
+
if (this.tuiEnabled) {
|
567
|
+
this.options.lifeCycle.setTaskStatus(taskId, (0, native_1.parseTaskStatus)(status));
|
568
|
+
}
|
443
569
|
if (status === 'failure' || status === 'skipped') {
|
444
570
|
if (this.bail) {
|
445
571
|
// mark the execution as bailed which will stop all further execution
|
@@ -503,15 +629,53 @@ class TaskOrchestrator {
|
|
503
629
|
}
|
504
630
|
// endregion utils
|
505
631
|
async cleanup() {
|
506
|
-
this.cleaningUp = true;
|
507
632
|
await Promise.all(Array.from(this.runningContinuousTasks).map(async ([taskId, t]) => {
|
508
633
|
try {
|
509
|
-
|
634
|
+
await t.kill();
|
635
|
+
this.options.lifeCycle.setTaskStatus(taskId, 9 /* NativeTaskStatus.Stopped */);
|
510
636
|
}
|
511
637
|
catch (e) {
|
512
638
|
console.error(`Unable to terminate ${taskId}\nError:`, e);
|
513
639
|
}
|
640
|
+
finally {
|
641
|
+
this.runningTasksService.removeRunningTask(taskId);
|
642
|
+
}
|
514
643
|
}));
|
515
644
|
}
|
645
|
+
cleanUpUnneededContinuousTasks() {
|
646
|
+
const incompleteTasks = this.tasksSchedule.getIncompleteTasks();
|
647
|
+
const neededContinuousTasks = new Set(this.initializingTaskIds);
|
648
|
+
for (const task of incompleteTasks) {
|
649
|
+
const continuousDependencies = this.taskGraph.continuousDependencies[task.id];
|
650
|
+
for (const continuousDependency of continuousDependencies) {
|
651
|
+
neededContinuousTasks.add(continuousDependency);
|
652
|
+
}
|
653
|
+
}
|
654
|
+
for (const taskId of this.runningContinuousTasks.keys()) {
|
655
|
+
if (!neededContinuousTasks.has(taskId)) {
|
656
|
+
const runningTask = this.runningContinuousTasks.get(taskId);
|
657
|
+
if (runningTask) {
|
658
|
+
runningTask.kill();
|
659
|
+
this.options.lifeCycle.setTaskStatus(taskId, 9 /* NativeTaskStatus.Stopped */);
|
660
|
+
}
|
661
|
+
}
|
662
|
+
}
|
663
|
+
}
|
516
664
|
}
|
517
665
|
exports.TaskOrchestrator = TaskOrchestrator;
|
666
|
+
function getThreadCount(options, taskGraph) {
|
667
|
+
if (options['parallel'] === 'false' ||
|
668
|
+
options['parallel'] === false) {
|
669
|
+
options['parallel'] = 1;
|
670
|
+
}
|
671
|
+
else if (options['parallel'] === 'true' ||
|
672
|
+
options['parallel'] === true ||
|
673
|
+
options['parallel'] === undefined ||
|
674
|
+
options['parallel'] === '') {
|
675
|
+
options['parallel'] = Number(options['maxParallel'] || 3);
|
676
|
+
}
|
677
|
+
const maxParallel = options['parallel'] +
|
678
|
+
Object.values(taskGraph.tasks).filter((t) => t.continuous).length;
|
679
|
+
const totalTasks = Object.keys(taskGraph.tasks).length;
|
680
|
+
return Math.min(maxParallel, totalTasks);
|
681
|
+
}
|
@@ -12,6 +12,7 @@ export type TaskStatus = 'success' | 'failure' | 'skipped' | 'local-cache-kept-e
|
|
12
12
|
export type TasksRunner<T = unknown> = (tasks: Task[], options: T, context?: {
|
13
13
|
target?: string;
|
14
14
|
initiatingProject?: string | null;
|
15
|
+
initiatingTasks: Task[];
|
15
16
|
projectGraph: ProjectGraph;
|
16
17
|
nxJson: NxJsonConfiguration;
|
17
18
|
nxArgs: NxArgs;
|
@@ -68,6 +68,15 @@ class TasksSchedule {
|
|
68
68
|
? this.scheduledBatches.shift()
|
69
69
|
: null;
|
70
70
|
}
|
71
|
+
getIncompleteTasks() {
|
72
|
+
const incompleteTasks = [];
|
73
|
+
for (const taskId in this.taskGraph.tasks) {
|
74
|
+
if (!this.completedTasks.has(taskId)) {
|
75
|
+
incompleteTasks.push(this.taskGraph.tasks[taskId]);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return incompleteTasks;
|
79
|
+
}
|
71
80
|
async scheduleTasks() {
|
72
81
|
if (this.options.batch || process.env.NX_BATCH_MODE === 'true') {
|
73
82
|
await this.scheduleBatches();
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
2
2
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
3
|
+
import { Task, TaskGraph } from '../config/task-graph';
|
3
4
|
import { TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
4
|
-
import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
5
5
|
export type NormalizedTargetDependencyConfig = TargetDependencyConfig & {
|
6
6
|
projects: string[];
|
7
7
|
};
|
@@ -24,19 +24,20 @@ exports.getSerializedArgsForTask = getSerializedArgsForTask;
|
|
24
24
|
exports.shouldStreamOutput = shouldStreamOutput;
|
25
25
|
exports.isCacheableTask = isCacheableTask;
|
26
26
|
exports.unparse = unparse;
|
27
|
-
const
|
28
|
-
const
|
29
|
-
const
|
30
|
-
const path_2 = require("../utils/path");
|
31
|
-
const fileutils_1 = require("../utils/fileutils");
|
32
|
-
const serialize_overrides_into_command_line_1 = require("../utils/serialize-overrides-into-command-line");
|
33
|
-
const split_target_1 = require("../utils/split-target");
|
27
|
+
const minimatch_1 = require("minimatch");
|
28
|
+
const node_path_1 = require("node:path");
|
29
|
+
const posix_1 = require("node:path/posix");
|
34
30
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
31
|
+
const native_1 = require("../native");
|
35
32
|
const project_graph_1 = require("../project-graph/project-graph");
|
33
|
+
const fileutils_1 = require("../utils/fileutils");
|
36
34
|
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
37
|
-
const minimatch_1 = require("minimatch");
|
38
35
|
const globs_1 = require("../utils/globs");
|
39
|
-
const
|
36
|
+
const path_1 = require("../utils/path");
|
37
|
+
const serialize_overrides_into_command_line_1 = require("../utils/serialize-overrides-into-command-line");
|
38
|
+
const split_target_1 = require("../utils/split-target");
|
39
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
40
|
+
const is_tui_enabled_1 = require("./is-tui-enabled");
|
40
41
|
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) {
|
41
42
|
const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
42
43
|
// This is passed into `run-command` from programmatic invocations
|
@@ -193,10 +194,10 @@ function transformLegacyOutputs(projectRoot, outputs) {
|
|
193
194
|
: [false, output];
|
194
195
|
const relativePath = (0, fileutils_1.isRelativePath)(outputPath)
|
195
196
|
? output
|
196
|
-
: (0,
|
197
|
+
: (0, node_path_1.relative)(projectRoot, outputPath);
|
197
198
|
const isWithinProject = !relativePath.startsWith('..');
|
198
199
|
return ((isNegated ? '!' : '') +
|
199
|
-
(0,
|
200
|
+
(0, path_1.joinPathFragments)(isWithinProject ? '{projectRoot}' : '{workspaceRoot}', isWithinProject ? relativePath : outputPath));
|
200
201
|
});
|
201
202
|
}
|
202
203
|
/**
|
@@ -293,7 +294,7 @@ function getExecutorNameForTask(task, projectGraph) {
|
|
293
294
|
}
|
294
295
|
function getExecutorForTask(task, projectGraph) {
|
295
296
|
const executor = getExecutorNameForTask(task, projectGraph);
|
296
|
-
const [nodeModule, executorName] =
|
297
|
+
const [nodeModule, executorName] = (0, executor_utils_1.parseExecutor)(executor);
|
297
298
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects);
|
298
299
|
}
|
299
300
|
function getCustomHasher(task, projectGraph) {
|
@@ -368,8 +369,13 @@ function getSerializedArgsForTask(task, isVerbose) {
|
|
368
369
|
];
|
369
370
|
}
|
370
371
|
function shouldStreamOutput(task, initiatingProject) {
|
372
|
+
// For now, disable streaming output on the JS side when running the TUI
|
373
|
+
if ((0, is_tui_enabled_1.isTuiEnabled)())
|
374
|
+
return false;
|
371
375
|
if (process.env.NX_STREAM_OUTPUT === 'true')
|
372
376
|
return true;
|
377
|
+
if (process.env.NX_STREAM_OUTPUT === 'false')
|
378
|
+
return false;
|
373
379
|
if (longRunningTask(task))
|
374
380
|
return true;
|
375
381
|
if (task.target.project === initiatingProject)
|
@@ -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;
|