nx 21.0.0-beta.6 → 21.0.0-beta.8
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/package.json +11 -11
- package/schemas/project-schema.json +5 -0
- package/src/command-line/init/configure-plugins.js +5 -3
- package/src/command-line/init/implementation/utils.d.ts +2 -1
- package/src/command-line/init/implementation/utils.js +2 -1
- package/src/command-line/init/init-v2.js +8 -7
- 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 +1 -1
- package/src/config/misc-interfaces.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +1 -2
- package/src/executors/run-commands/run-commands.impl.js +1 -1
- package/src/executors/run-commands/running-tasks.d.ts +5 -2
- package/src/executors/run-commands/running-tasks.js +42 -6
- package/src/native/index.d.ts +2 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/package-json/create-nodes.js +1 -1
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +29 -10
- package/src/tasks-runner/batch/run-batch.js +1 -1
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +0 -1
- package/src/tasks-runner/init-tasks-runner.d.ts +1 -1
- package/src/tasks-runner/init-tasks-runner.js +8 -2
- package/src/tasks-runner/life-cycle.d.ts +4 -0
- package/src/tasks-runner/life-cycle.js +14 -0
- 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 +8 -5
- 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 +29 -4
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +2 -0
- package/src/tasks-runner/run-command.d.ts +1 -0
- package/src/tasks-runner/run-command.js +4 -6
- package/src/tasks-runner/running-tasks/running-task.d.ts +1 -0
- package/src/tasks-runner/task-orchestrator.d.ts +2 -1
- package/src/tasks-runner/task-orchestrator.js +31 -12
- package/src/tasks-runner/utils.js +3 -1
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
@@ -8,7 +8,7 @@ const configuration_1 = require("../../config/configuration");
|
|
8
8
|
const async_iterator_1 = require("../../utils/async-iterator");
|
9
9
|
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
10
10
|
function getBatchExecutor(executorName, projects) {
|
11
|
-
const [nodeModule, exportName] =
|
11
|
+
const [nodeModule, exportName] = (0, executor_utils_1.parseExecutor)(executorName);
|
12
12
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, exportName, workspace_root_1.workspaceRoot, projects);
|
13
13
|
}
|
14
14
|
async function runTasks(executorName, projectGraph, batchTaskGraph, fullTaskGraph) {
|
@@ -40,4 +40,3 @@ export declare function filterDummyTasks(dependencies: {
|
|
40
40
|
export declare function getNonDummyDeps(currentTask: string, dependencies: {
|
41
41
|
[k: string]: string[];
|
42
42
|
}, cycles?: Set<string>, seen?: Set<string>): string[];
|
43
|
-
export declare function createTaskId(project: string, target: string, configuration: string | undefined): string;
|
@@ -5,7 +5,6 @@ exports.createTaskGraph = createTaskGraph;
|
|
5
5
|
exports.mapTargetDefaultsToDependencies = mapTargetDefaultsToDependencies;
|
6
6
|
exports.filterDummyTasks = filterDummyTasks;
|
7
7
|
exports.getNonDummyDeps = getNonDummyDeps;
|
8
|
-
exports.createTaskId = createTaskId;
|
9
8
|
const utils_1 = require("./utils");
|
10
9
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
11
10
|
const output_1 = require("../utils/output");
|
@@ -1,8 +1,8 @@
|
|
1
|
+
import type { NxJsonConfiguration } from '../config/nx-json';
|
1
2
|
import { NxArgs } from '../utils/command-line-utils';
|
2
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
3
4
|
import { LifeCycle, TaskResult } from './life-cycle';
|
4
5
|
import type { ProjectGraph } from '../config/project-graph';
|
5
|
-
import type { NxJsonConfiguration } from '../config/nx-json';
|
6
6
|
import { RunningTask } from './running-tasks/running-task';
|
7
7
|
/**
|
8
8
|
* This function is deprecated. Do not use this
|
@@ -99,9 +99,15 @@ async function createOrchestrator(tasks, projectGraph, taskGraphForHashing, nxJs
|
|
99
99
|
return acc;
|
100
100
|
}, {}),
|
101
101
|
};
|
102
|
-
const
|
102
|
+
const nxArgs = {
|
103
|
+
...options,
|
104
|
+
parallel: tasks.length,
|
105
|
+
lifeCycle: compositedLifeCycle,
|
106
|
+
};
|
107
|
+
(0, run_command_1.setEnvVarsBasedOnArgs)(nxArgs, true);
|
108
|
+
const orchestrator = new task_orchestrator_1.TaskOrchestrator(hasher, null, [], projectGraph, taskGraph, nxJson, nxArgs, false, client_1.daemonClient, undefined, taskGraphForHashing);
|
103
109
|
await orchestrator.init();
|
104
|
-
|
110
|
+
orchestrator.processTasks(tasks.map((task) => task.id));
|
105
111
|
return orchestrator;
|
106
112
|
}
|
107
113
|
async function runDiscreteTasks(tasks, projectGraph, taskGraphForHashing, nxJson, lifeCycle) {
|
@@ -37,6 +37,8 @@ export interface LifeCycle {
|
|
37
37
|
endTasks?(taskResults: TaskResult[], metadata: TaskMetadata): void | Promise<void>;
|
38
38
|
printTaskTerminalOutput?(task: Task, status: TaskStatus, output: string): void;
|
39
39
|
registerRunningTask?(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
40
|
+
registerRunningTaskWithEmptyParser?(taskId: string): void;
|
41
|
+
appendTaskOutput?(taskId: string, output: string): void;
|
40
42
|
setTaskStatus?(taskId: string, status: NativeTaskStatus): void;
|
41
43
|
registerForcedShutdownCallback?(callback: () => void): void;
|
42
44
|
}
|
@@ -52,6 +54,8 @@ export declare class CompositeLifeCycle implements LifeCycle {
|
|
52
54
|
endTasks(taskResults: TaskResult[], metadata: TaskMetadata): Promise<void>;
|
53
55
|
printTaskTerminalOutput(task: Task, status: TaskStatus, output: string): void;
|
54
56
|
registerRunningTask(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
57
|
+
registerRunningTaskWithEmptyParser(taskId: string): void;
|
58
|
+
appendTaskOutput(taskId: string, output: string): void;
|
55
59
|
setTaskStatus(taskId: string, status: NativeTaskStatus): void;
|
56
60
|
registerForcedShutdownCallback(callback: () => void): void;
|
57
61
|
}
|
@@ -74,6 +74,20 @@ class CompositeLifeCycle {
|
|
74
74
|
}
|
75
75
|
}
|
76
76
|
}
|
77
|
+
registerRunningTaskWithEmptyParser(taskId) {
|
78
|
+
for (let l of this.lifeCycles) {
|
79
|
+
if (l.registerRunningTaskWithEmptyParser) {
|
80
|
+
l.registerRunningTaskWithEmptyParser(taskId);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
appendTaskOutput(taskId, output) {
|
85
|
+
for (let l of this.lifeCycles) {
|
86
|
+
if (l.appendTaskOutput) {
|
87
|
+
l.appendTaskOutput(taskId, output);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
77
91
|
setTaskStatus(taskId, status) {
|
78
92
|
for (let l of this.lifeCycles) {
|
79
93
|
if (l.setTaskStatus) {
|
@@ -3,7 +3,9 @@ import { LifeCycle, TaskResult } from '../life-cycle';
|
|
3
3
|
export declare class LegacyTaskHistoryLifeCycle implements LifeCycle {
|
4
4
|
private startTimings;
|
5
5
|
private taskRuns;
|
6
|
+
private flakyTasks;
|
6
7
|
startTasks(tasks: Task[]): void;
|
7
8
|
endTasks(taskResults: TaskResult[]): Promise<void>;
|
8
9
|
endCommand(): Promise<void>;
|
10
|
+
printFlakyTasksMessage(): void;
|
9
11
|
}
|
@@ -31,24 +31,27 @@ class LegacyTaskHistoryLifeCycle {
|
|
31
31
|
async endCommand() {
|
32
32
|
await (0, legacy_task_history_1.writeTaskRunsToHistory)(this.taskRuns);
|
33
33
|
const history = await (0, legacy_task_history_1.getHistoryForHashes)(this.taskRuns.map((t) => t.hash));
|
34
|
-
|
34
|
+
this.flakyTasks = [];
|
35
35
|
// check if any hash has different exit codes => flaky
|
36
36
|
for (let hash in history) {
|
37
37
|
if (history[hash].length > 1 &&
|
38
38
|
history[hash].some((run) => run.code !== history[hash][0].code)) {
|
39
|
-
flakyTasks.push((0, serialize_target_1.serializeTarget)(history[hash][0].project, history[hash][0].target, history[hash][0].configuration));
|
39
|
+
this.flakyTasks.push((0, serialize_target_1.serializeTarget)(history[hash][0].project, history[hash][0].target, history[hash][0].configuration));
|
40
40
|
}
|
41
41
|
}
|
42
42
|
// Do not directly print output when using the TUI
|
43
43
|
if ((0, is_tui_enabled_1.isTuiEnabled)()) {
|
44
44
|
return;
|
45
45
|
}
|
46
|
-
|
46
|
+
this.printFlakyTasksMessage();
|
47
|
+
}
|
48
|
+
printFlakyTasksMessage() {
|
49
|
+
if (this.flakyTasks.length > 0) {
|
47
50
|
output_1.output.warn({
|
48
|
-
title: `Nx detected ${flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
51
|
+
title: `Nx detected ${this.flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
49
52
|
bodyLines: [
|
50
53
|
,
|
51
|
-
...flakyTasks.map((t) => ` ${t}`),
|
54
|
+
...this.flakyTasks.map((t) => ` ${t}`),
|
52
55
|
'',
|
53
56
|
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
|
54
57
|
],
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import { Task } from '../../config/task-graph';
|
2
2
|
import { LifeCycle, TaskResult } from '../life-cycle';
|
3
|
+
import { LegacyTaskHistoryLifeCycle } from './task-history-life-cycle-old';
|
4
|
+
export declare function getTasksHistoryLifeCycle(): TaskHistoryLifeCycle | LegacyTaskHistoryLifeCycle | null;
|
3
5
|
export declare class TaskHistoryLifeCycle implements LifeCycle {
|
4
6
|
private startTimings;
|
5
7
|
private taskRuns;
|
6
8
|
private taskHistory;
|
9
|
+
private flakyTasks;
|
10
|
+
constructor();
|
7
11
|
startTasks(tasks: Task[]): void;
|
8
12
|
endTasks(taskResults: TaskResult[]): Promise<void>;
|
9
13
|
endCommand(): Promise<void>;
|
14
|
+
printFlakyTasksMessage(): void;
|
10
15
|
}
|
@@ -1,15 +1,37 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TaskHistoryLifeCycle = void 0;
|
4
|
+
exports.getTasksHistoryLifeCycle = getTasksHistoryLifeCycle;
|
5
|
+
const native_1 = require("../../native");
|
4
6
|
const output_1 = require("../../utils/output");
|
5
7
|
const serialize_target_1 = require("../../utils/serialize-target");
|
6
8
|
const task_history_1 = require("../../utils/task-history");
|
7
9
|
const is_tui_enabled_1 = require("../is-tui-enabled");
|
10
|
+
const task_history_life_cycle_old_1 = require("./task-history-life-cycle-old");
|
11
|
+
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
12
|
+
const nx_json_1 = require("../../config/nx-json");
|
13
|
+
let tasksHistoryLifeCycle;
|
14
|
+
function getTasksHistoryLifeCycle() {
|
15
|
+
if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
16
|
+
if (!tasksHistoryLifeCycle) {
|
17
|
+
tasksHistoryLifeCycle =
|
18
|
+
process.env.NX_DISABLE_DB !== 'true' && !native_1.IS_WASM
|
19
|
+
? new TaskHistoryLifeCycle()
|
20
|
+
: new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle();
|
21
|
+
}
|
22
|
+
return tasksHistoryLifeCycle;
|
23
|
+
}
|
24
|
+
return null;
|
25
|
+
}
|
8
26
|
class TaskHistoryLifeCycle {
|
9
27
|
constructor() {
|
10
28
|
this.startTimings = {};
|
11
29
|
this.taskRuns = new Map();
|
12
30
|
this.taskHistory = (0, task_history_1.getTaskHistory)();
|
31
|
+
if (tasksHistoryLifeCycle) {
|
32
|
+
throw new Error('TaskHistoryLifeCycle is a singleton and should not be instantiated multiple times');
|
33
|
+
}
|
34
|
+
tasksHistoryLifeCycle = this;
|
13
35
|
}
|
14
36
|
startTasks(tasks) {
|
15
37
|
for (let task of tasks) {
|
@@ -36,17 +58,20 @@ class TaskHistoryLifeCycle {
|
|
36
58
|
return;
|
37
59
|
}
|
38
60
|
await this.taskHistory.recordTaskRuns(entries.map(([_, v]) => v));
|
39
|
-
|
61
|
+
this.flakyTasks = await this.taskHistory.getFlakyTasks(entries.map(([hash]) => hash));
|
40
62
|
// Do not directly print output when using the TUI
|
41
63
|
if ((0, is_tui_enabled_1.isTuiEnabled)()) {
|
42
64
|
return;
|
43
65
|
}
|
44
|
-
|
66
|
+
this.printFlakyTasksMessage();
|
67
|
+
}
|
68
|
+
printFlakyTasksMessage() {
|
69
|
+
if (this.flakyTasks.length > 0) {
|
45
70
|
output_1.output.warn({
|
46
|
-
title: `Nx detected ${flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
71
|
+
title: `Nx detected ${this.flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
47
72
|
bodyLines: [
|
48
73
|
,
|
49
|
-
...flakyTasks.map((hash) => {
|
74
|
+
...this.flakyTasks.map((hash) => {
|
50
75
|
const taskRun = this.taskRuns.get(hash);
|
51
76
|
return ` ${(0, serialize_target_1.serializeTarget)(taskRun.target.project, taskRun.target.target, taskRun.target.configuration)}`;
|
52
77
|
}),
|
@@ -7,6 +7,7 @@ const formatting_utils_1 = require("./formatting-utils");
|
|
7
7
|
const pretty_time_1 = require("./pretty-time");
|
8
8
|
const view_logs_utils_1 = require("./view-logs-utils");
|
9
9
|
const figures = require("figures");
|
10
|
+
const task_history_life_cycle_1 = require("./task-history-life-cycle");
|
10
11
|
const LEFT_PAD = ` `;
|
11
12
|
const SPACER = ` `;
|
12
13
|
const EXTENDED_LEFT_PAD = ` `;
|
@@ -78,6 +79,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides,
|
|
78
79
|
else {
|
79
80
|
printRunManySummary();
|
80
81
|
}
|
82
|
+
(0, task_history_life_cycle_1.getTasksHistoryLifeCycle)()?.printFlakyTasksMessage();
|
81
83
|
};
|
82
84
|
const printRunOneSummary = () => {
|
83
85
|
let lines = [];
|
@@ -17,6 +17,7 @@ export declare function runCommandForTasks(projectsToRun: ProjectGraphProjectNod
|
|
17
17
|
excludeTaskDependencies: boolean;
|
18
18
|
loadDotEnvFiles: boolean;
|
19
19
|
}): Promise<TaskResults>;
|
20
|
+
export declare function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean): void;
|
20
21
|
export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, }: {
|
21
22
|
tasks: Task[];
|
22
23
|
projectGraph: ProjectGraph;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.runCommand = runCommand;
|
4
4
|
exports.runCommandForTasks = runCommandForTasks;
|
5
|
+
exports.setEnvVarsBasedOnArgs = setEnvVarsBasedOnArgs;
|
5
6
|
exports.invokeTasksRunner = invokeTasksRunner;
|
6
7
|
exports.constructLifeCycles = constructLifeCycles;
|
7
8
|
exports.getRunner = getRunner;
|
@@ -14,7 +15,6 @@ const nx_json_1 = require("../config/nx-json");
|
|
14
15
|
const client_1 = require("../daemon/client/client");
|
15
16
|
const create_task_hasher_1 = require("../hasher/create-task-hasher");
|
16
17
|
const hash_task_1 = require("../hasher/hash-task");
|
17
|
-
const native_1 = require("../native");
|
18
18
|
const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
|
19
19
|
const project_graph_1 = require("../project-graph/project-graph");
|
20
20
|
const fileutils_1 = require("../utils/fileutils");
|
@@ -34,7 +34,6 @@ const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/stat
|
|
34
34
|
const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
|
35
35
|
const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
|
36
36
|
const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
|
37
|
-
const task_history_life_cycle_old_1 = require("./life-cycles/task-history-life-cycle-old");
|
38
37
|
const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
|
39
38
|
const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
|
40
39
|
const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
|
@@ -633,10 +632,9 @@ function constructLifeCycles(lifeCycle) {
|
|
633
632
|
if (process.env.NX_PROFILE) {
|
634
633
|
lifeCycles.push(new task_profiling_life_cycle_1.TaskProfilingLifeCycle(process.env.NX_PROFILE));
|
635
634
|
}
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
: new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle());
|
635
|
+
const historyLifeCycle = (0, task_history_life_cycle_1.getTasksHistoryLifeCycle)();
|
636
|
+
if (historyLifeCycle) {
|
637
|
+
lifeCycles.push(historyLifeCycle);
|
640
638
|
}
|
641
639
|
return lifeCycles;
|
642
640
|
}
|
@@ -6,5 +6,6 @@ export declare abstract class RunningTask {
|
|
6
6
|
}>;
|
7
7
|
abstract onExit(cb: (code: number) => void): void;
|
8
8
|
abstract kill(signal?: NodeJS.Signals | number): Promise<void> | void;
|
9
|
+
abstract onOutput?(cb: (output: string) => void): void;
|
9
10
|
abstract send?(message: Serializable): void;
|
10
11
|
}
|
@@ -42,7 +42,8 @@ export declare class TaskOrchestrator {
|
|
42
42
|
[id: string]: TaskStatus;
|
43
43
|
}>;
|
44
44
|
private executeNextBatchOfTasksUsingTaskSchedule;
|
45
|
-
|
45
|
+
processTasks(taskIds: string[]): void;
|
46
|
+
private processTask;
|
46
47
|
private processScheduledBatch;
|
47
48
|
private processAllScheduledTasks;
|
48
49
|
private applyCachedResults;
|
@@ -124,6 +124,14 @@ class TaskOrchestrator {
|
|
124
124
|
// block until some other task completes, then try again
|
125
125
|
return new Promise((res) => this.waitingForTasks.push(res)).then(() => this.executeNextBatchOfTasksUsingTaskSchedule());
|
126
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
|
+
}
|
127
135
|
// region Processing Scheduled Tasks
|
128
136
|
async processTask(taskId) {
|
129
137
|
const task = this.taskGraph.tasks[taskId];
|
@@ -147,12 +155,7 @@ class TaskOrchestrator {
|
|
147
155
|
for (const batch of scheduledBatches) {
|
148
156
|
this.processedBatches.set(batch, this.processScheduledBatch(batch));
|
149
157
|
}
|
150
|
-
|
151
|
-
// Task is already handled or being handled
|
152
|
-
if (!this.processedTasks.has(taskId)) {
|
153
|
-
this.processedTasks.set(taskId, this.processTask(taskId));
|
154
|
-
}
|
155
|
-
}
|
158
|
+
this.processTasks(scheduledTasks);
|
156
159
|
}
|
157
160
|
// endregion Processing Scheduled Tasks
|
158
161
|
// region Applying Cache
|
@@ -302,9 +305,17 @@ class TaskOrchestrator {
|
|
302
305
|
const runningTask = await (0, run_commands_impl_1.runCommands)(runCommandsOptions, {
|
303
306
|
root: workspace_root_1.workspaceRoot, // only root is needed in runCommands
|
304
307
|
});
|
305
|
-
if (this.tuiEnabled
|
306
|
-
|
307
|
-
|
308
|
+
if (this.tuiEnabled) {
|
309
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
310
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
311
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
312
|
+
}
|
313
|
+
else {
|
314
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
315
|
+
runningTask.onOutput((output) => {
|
316
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
317
|
+
});
|
318
|
+
}
|
308
319
|
}
|
309
320
|
if (!streamOutput) {
|
310
321
|
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
@@ -352,9 +363,17 @@ class TaskOrchestrator {
|
|
352
363
|
else {
|
353
364
|
// cache prep
|
354
365
|
const runningTask = await this.runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput);
|
355
|
-
if (this.tuiEnabled
|
356
|
-
|
357
|
-
|
366
|
+
if (this.tuiEnabled) {
|
367
|
+
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
368
|
+
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
369
|
+
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
370
|
+
}
|
371
|
+
else if ('onOutput' in runningTask) {
|
372
|
+
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
373
|
+
runningTask.onOutput((output) => {
|
374
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
375
|
+
});
|
376
|
+
}
|
358
377
|
}
|
359
378
|
return runningTask;
|
360
379
|
}
|
@@ -294,7 +294,7 @@ function getExecutorNameForTask(task, projectGraph) {
|
|
294
294
|
}
|
295
295
|
function getExecutorForTask(task, projectGraph) {
|
296
296
|
const executor = getExecutorNameForTask(task, projectGraph);
|
297
|
-
const [nodeModule, executorName] =
|
297
|
+
const [nodeModule, executorName] = (0, executor_utils_1.parseExecutor)(executor);
|
298
298
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects);
|
299
299
|
}
|
300
300
|
function getCustomHasher(task, projectGraph) {
|
@@ -374,6 +374,8 @@ function shouldStreamOutput(task, initiatingProject) {
|
|
374
374
|
return false;
|
375
375
|
if (process.env.NX_STREAM_OUTPUT === 'true')
|
376
376
|
return true;
|
377
|
+
if (process.env.NX_STREAM_OUTPUT === 'false')
|
378
|
+
return false;
|
377
379
|
if (longRunningTask(task))
|
378
380
|
return true;
|
379
381
|
if (task.target.project === initiatingProject)
|
@@ -74,7 +74,7 @@ export declare function readNxMigrateConfig(json: Partial<PackageJson>): NxMigra
|
|
74
74
|
export declare function buildTargetFromScript(script: string, scripts: Record<string, string>, packageManagerCommand: PackageManagerCommands): TargetConfiguration;
|
75
75
|
export declare function getMetadataFromPackageJson(packageJson: PackageJson, isInPackageManagerWorkspaces: boolean): ProjectMetadata;
|
76
76
|
export declare function getTagsFromPackageJson(packageJson: PackageJson): string[];
|
77
|
-
export declare function readTargetsFromPackageJson(packageJson: PackageJson, nxJson: NxJsonConfiguration): Record<string, TargetConfiguration<any>>;
|
77
|
+
export declare function readTargetsFromPackageJson(packageJson: PackageJson, nxJson: NxJsonConfiguration, projectRoot: string, workspaceRoot: string): Record<string, TargetConfiguration<any>>;
|
78
78
|
/**
|
79
79
|
* Uses `require.resolve` to read the package.json for a module.
|
80
80
|
*
|
@@ -83,7 +83,7 @@ function getTagsFromPackageJson(packageJson) {
|
|
83
83
|
}
|
84
84
|
return tags;
|
85
85
|
}
|
86
|
-
function readTargetsFromPackageJson(packageJson, nxJson) {
|
86
|
+
function readTargetsFromPackageJson(packageJson, nxJson, projectRoot, workspaceRoot) {
|
87
87
|
const { scripts, nx, private: isPrivate } = packageJson ?? {};
|
88
88
|
const res = {};
|
89
89
|
const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {});
|
@@ -102,7 +102,9 @@ function readTargetsFromPackageJson(packageJson, nxJson) {
|
|
102
102
|
* Any targetDefaults for the nx-release-publish target set by the user should
|
103
103
|
* be merged with the implicit target.
|
104
104
|
*/
|
105
|
-
if (!isPrivate &&
|
105
|
+
if (!isPrivate &&
|
106
|
+
!res['nx-release-publish'] &&
|
107
|
+
hasNxJsPlugin(projectRoot, workspaceRoot)) {
|
106
108
|
const nxReleasePublishTargetDefaults = nxJson?.targetDefaults?.['nx-release-publish'] ?? {};
|
107
109
|
res['nx-release-publish'] = {
|
108
110
|
executor: '@nx/js:release-publish',
|
@@ -119,6 +121,18 @@ function readTargetsFromPackageJson(packageJson, nxJson) {
|
|
119
121
|
}
|
120
122
|
return res;
|
121
123
|
}
|
124
|
+
function hasNxJsPlugin(projectRoot, workspaceRoot) {
|
125
|
+
try {
|
126
|
+
// nx-ignore-next-line
|
127
|
+
require.resolve('@nx/js', {
|
128
|
+
paths: [projectRoot, ...(0, installation_directory_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
129
|
+
});
|
130
|
+
return true;
|
131
|
+
}
|
132
|
+
catch {
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
}
|
122
136
|
/**
|
123
137
|
* Uses `require.resolve` to read the package.json for a module.
|
124
138
|
*
|