nx 24.0.1 → 24.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/nx-cloud.js +9 -0
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +12 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +2 -2
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +34 -15
- package/dist/src/command-line/migrate/workspace-installation.d.ts +15 -0
- package/dist/src/command-line/migrate/workspace-installation.js +73 -0
- package/dist/src/command-line/nx-cloud/complete-run/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/fix-ci/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/logout/command-object.js +11 -2
- package/dist/src/command-line/nx-cloud/record/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/start-ci-run/command-object.js +1 -1
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +1 -1
- package/dist/src/command-line/release/changelog.js +6 -2
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/show/show-target/info.d.ts +1 -1
- package/dist/src/command-line/show/show-target/info.js +4 -4
- package/dist/src/core/graph/favicon.ico +0 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +4 -0
- package/dist/src/daemon/client/client.js +67 -12
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +3 -1
- package/dist/src/daemon/server/server.js +11 -0
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +14 -8
- package/dist/src/executors/run-commands/running-tasks.js +80 -31
- package/dist/src/executors/run-commands/schema.json +2 -2
- package/dist/src/native/index.js +12 -17
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.d.ts +2 -0
- package/dist/src/nx-cloud/utilities/client.d.ts +1 -0
- package/dist/src/nx-cloud/utilities/client.js +5 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -1
- package/dist/src/plugins/js/utils/register.js +3 -2
- package/dist/src/plugins/js/utils/typescript.js +3 -2
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +2 -2
- package/dist/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +34 -13
- package/dist/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +26 -5
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +6 -3
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +5 -2
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +8 -4
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +76 -39
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +2 -2
- package/dist/src/tasks-runner/running-tasks/batch-process.js +1 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +9 -5
- package/dist/src/tasks-runner/task-orchestrator.js +110 -36
- package/dist/src/utils/installation-directory.d.ts +8 -0
- package/dist/src/utils/installation-directory.js +13 -0
- package/dist/src/utils/output.d.ts +4 -3
- package/dist/src/utils/output.js +4 -3
- package/dist/src/utils/package-manager.d.ts +2 -1
- package/dist/src/utils/package-manager.js +42 -12
- package/package.json +12 -12
- package/schemas/nx-schema.json +6 -0
- package/schemas/project-schema.json +6 -0
|
@@ -41,10 +41,15 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
41
41
|
clearInterval(renderIntervalId);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
let stoppedBySignal = false;
|
|
45
|
+
const onSignal = () => {
|
|
46
|
+
stoppedBySignal = true;
|
|
47
|
+
clearRenderInterval();
|
|
48
|
+
};
|
|
44
49
|
process.on('exit', () => clearRenderInterval());
|
|
45
|
-
process.on('SIGINT',
|
|
46
|
-
process.on('SIGTERM',
|
|
47
|
-
process.on('SIGHUP',
|
|
50
|
+
process.on('SIGINT', onSignal);
|
|
51
|
+
process.on('SIGTERM', onSignal);
|
|
52
|
+
process.on('SIGHUP', onSignal);
|
|
48
53
|
const lifeCycle = {};
|
|
49
54
|
const isVerbose = overrides.verbose === true;
|
|
50
55
|
const start = process.hrtime();
|
|
@@ -58,6 +63,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
58
63
|
};
|
|
59
64
|
});
|
|
60
65
|
const failedTasks = new Set();
|
|
66
|
+
const stoppedTasks = new Set();
|
|
61
67
|
const tasksToTerminalOutputs = {};
|
|
62
68
|
const tasksToProcessStartTimes = {};
|
|
63
69
|
let hasTaskOutput = false;
|
|
@@ -273,20 +279,32 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
273
279
|
}
|
|
274
280
|
const numFailedToPrint = 5;
|
|
275
281
|
const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
|
|
282
|
+
const taskIdRows = (taskIds) => taskIds
|
|
283
|
+
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t)}`)
|
|
284
|
+
.join('\n');
|
|
276
285
|
const failureSummaryRows = [
|
|
277
286
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + pc.dim(pc.white(` (${timeTakenText})`))),
|
|
278
287
|
...taskOverridesRows,
|
|
279
|
-
'',
|
|
280
|
-
output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
|
|
281
|
-
'',
|
|
282
|
-
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
|
|
283
|
-
'',
|
|
284
|
-
`${failedTasksForPrinting
|
|
285
|
-
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
286
|
-
.join('\n')}`,
|
|
287
288
|
];
|
|
288
|
-
if (
|
|
289
|
-
failureSummaryRows.push(output_1.output.dim(`${
|
|
289
|
+
if (totalSuccessfulTasks > 0) {
|
|
290
|
+
failureSummaryRows.push('', output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
|
|
291
|
+
}
|
|
292
|
+
if (totalFailedTasks > 0) {
|
|
293
|
+
failureSummaryRows.push('', `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} targets failed, including the following:`, '', taskIdRows(failedTasksForPrinting));
|
|
294
|
+
if (failedTasks.size > numFailedToPrint) {
|
|
295
|
+
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (stoppedTasks.size > 0) {
|
|
299
|
+
failureSummaryRows.push('', `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${stoppedTasks.size}/${totalTasks} targets were in progress, including the following:`, '', taskIdRows(Array.from(stoppedTasks)));
|
|
300
|
+
}
|
|
301
|
+
const notRunTasks = totalTasks - totalCompletedTasks;
|
|
302
|
+
// After a signal, the tasks that never ran include ones the run
|
|
303
|
+
// stopped before reaching, which "skipped" would mislabel
|
|
304
|
+
if (notRunTasks > 0) {
|
|
305
|
+
failureSummaryRows.push('', output_1.output.dim(stoppedBySignal
|
|
306
|
+
? `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${notRunTasks}/${totalTasks} targets had not started.`
|
|
307
|
+
: `${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${notRunTasks}/${totalTasks} targets were skipped.`));
|
|
290
308
|
}
|
|
291
309
|
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
|
292
310
|
renderPinnedFooter(failureSummaryRows, 'red');
|
|
@@ -330,6 +348,9 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
|
330
348
|
totalFailedTasks++;
|
|
331
349
|
failedTasks.add(t.task.id);
|
|
332
350
|
break;
|
|
351
|
+
case 'stopped':
|
|
352
|
+
stoppedTasks.add(t.task.id);
|
|
353
|
+
break;
|
|
333
354
|
}
|
|
334
355
|
printTaskResult(t.task, t.status);
|
|
335
356
|
}
|
|
@@ -41,10 +41,15 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
41
41
|
clearInterval(renderDependentTargetsIntervalId);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
let stoppedBySignal = false;
|
|
45
|
+
const onSignal = () => {
|
|
46
|
+
stoppedBySignal = true;
|
|
47
|
+
clearRenderInterval();
|
|
48
|
+
};
|
|
44
49
|
process.on('exit', () => clearRenderInterval());
|
|
45
|
-
process.on('SIGINT',
|
|
46
|
-
process.on('SIGTERM',
|
|
47
|
-
process.on('SIGHUP',
|
|
50
|
+
process.on('SIGINT', onSignal);
|
|
51
|
+
process.on('SIGTERM', onSignal);
|
|
52
|
+
process.on('SIGHUP', onSignal);
|
|
48
53
|
const lifeCycle = {};
|
|
49
54
|
const start = process.hrtime();
|
|
50
55
|
const figures = await (0, handle_import_1.handleImport)('figures');
|
|
@@ -60,6 +65,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
60
65
|
let totalCompletedTasks = 0;
|
|
61
66
|
let totalSuccessfulTasks = 0;
|
|
62
67
|
let totalFailedTasks = 0;
|
|
68
|
+
let totalStoppedTasks = 0;
|
|
63
69
|
let totalCachedTasks = 0;
|
|
64
70
|
// Used to control the rendering of the spinner
|
|
65
71
|
let dependentTargetsCurrentFrame = 0;
|
|
@@ -175,6 +181,9 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
175
181
|
output_1.output.logCommandOutput(t.task.id, t.status, tasksToTerminalOutputs[t.task.id]);
|
|
176
182
|
}
|
|
177
183
|
break;
|
|
184
|
+
case 'stopped':
|
|
185
|
+
totalStoppedTasks++;
|
|
186
|
+
break;
|
|
178
187
|
}
|
|
179
188
|
delete tasksToTerminalOutputs[t.task.id];
|
|
180
189
|
}
|
|
@@ -223,12 +232,24 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
|
|
|
223
232
|
.forEach((arg) => taskOverridesLines.push(arg));
|
|
224
233
|
}
|
|
225
234
|
const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
|
|
235
|
+
const notRunTasks = totalTasks - totalCompletedTasks;
|
|
236
|
+
// After a signal, the tasks that never ran include ones the run
|
|
237
|
+
// stopped before reaching, which "skipped" would mislabel
|
|
238
|
+
const notRunLine = stoppedBySignal
|
|
239
|
+
? `${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${notRunTasks}/${totalTasks} had not started`
|
|
240
|
+
: `${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${notRunTasks}/${totalTasks} skipped`;
|
|
226
241
|
renderLines([
|
|
227
242
|
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
|
|
228
243
|
...taskOverridesLines,
|
|
229
244
|
'',
|
|
230
|
-
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${
|
|
231
|
-
`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${
|
|
245
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} failed`,
|
|
246
|
+
`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
|
|
247
|
+
...(totalStoppedTasks > 0
|
|
248
|
+
? [
|
|
249
|
+
`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${totalStoppedTasks}/${totalTasks} were in progress`,
|
|
250
|
+
]
|
|
251
|
+
: []),
|
|
252
|
+
...(notRunTasks > 0 ? [notRunLine] : []),
|
|
232
253
|
...viewLogs,
|
|
233
254
|
], 'red');
|
|
234
255
|
}
|
|
@@ -61,8 +61,11 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
61
61
|
}
|
|
62
62
|
// A stopped task was killed mid-flight, so the run did not complete even
|
|
63
63
|
// though nothing outright failed. `didCommandComplete` already treats it
|
|
64
|
-
// that way; reporting "Successfully ran" here would contradict it.
|
|
65
|
-
|
|
64
|
+
// that way; reporting "Successfully ran" here would contradict it. A
|
|
65
|
+
// discrete task that never reported was skipped, which fails the run too.
|
|
66
|
+
if (this.failedTasks.length === 0 &&
|
|
67
|
+
this.stoppedTasks.length === 0 &&
|
|
68
|
+
!this.skippedTasks().some((t) => !t.continuous)) {
|
|
66
69
|
output_1.output.addVerticalSeparatorWithoutNewLines('green');
|
|
67
70
|
const bodyLines = this.cachedTasks.length > 0
|
|
68
71
|
? [
|
|
@@ -81,7 +84,7 @@ class StaticRunManyTerminalOutputLifeCycle {
|
|
|
81
84
|
const bodyLines = [];
|
|
82
85
|
const skippedTasks = this.skippedTasks();
|
|
83
86
|
if (skippedTasks.length > 0) {
|
|
84
|
-
bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed
|
|
87
|
+
bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed, --nx-bail=true, or their batch ended before reaching them:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
85
88
|
}
|
|
86
89
|
if (this.stoppedTasks.length > 0) {
|
|
87
90
|
bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
@@ -71,7 +71,10 @@ class StaticRunOneTerminalOutputLifeCycle {
|
|
|
71
71
|
output_1.output.addNewline();
|
|
72
72
|
// A stopped task was killed mid-flight, so the run did not complete even
|
|
73
73
|
// though nothing outright failed — matching run-many and didCommandComplete.
|
|
74
|
-
|
|
74
|
+
// A discrete task that never reported was skipped, which fails the run too.
|
|
75
|
+
if (this.failedTasks.length === 0 &&
|
|
76
|
+
this.stoppedTasks.length === 0 &&
|
|
77
|
+
!this.skippedTasks().some((t) => !t.continuous)) {
|
|
75
78
|
output_1.output.addVerticalSeparatorWithoutNewLines('green');
|
|
76
79
|
const bodyLines = this.cachedTasks.length > 0
|
|
77
80
|
? [
|
|
@@ -90,7 +93,7 @@ class StaticRunOneTerminalOutputLifeCycle {
|
|
|
90
93
|
const bodyLines = [];
|
|
91
94
|
const skippedTasks = this.skippedTasks();
|
|
92
95
|
if (skippedTasks.length > 0) {
|
|
93
|
-
bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed
|
|
96
|
+
bodyLines.push(output_1.output.dim('Tasks not run because their dependencies failed, --nx-bail=true, or their batch ended before reaching them:'), '', ...skippedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
94
97
|
}
|
|
95
98
|
if (this.stoppedTasks.length > 0) {
|
|
96
99
|
bodyLines.push(output_1.output.dim('Tasks stopped before they finished:'), '', ...this.stoppedTasks.map((task) => `${output_1.output.dim('-')} ${task.id}`), '');
|
|
@@ -22,13 +22,13 @@ class SummaryTerminalOutputLifeCycle {
|
|
|
22
22
|
this.completed = new Set();
|
|
23
23
|
this.succeeded = 0;
|
|
24
24
|
this.cached = 0;
|
|
25
|
-
this.batchLogs =
|
|
25
|
+
this.batchLogs = [];
|
|
26
26
|
}
|
|
27
27
|
setCloudLink(label, url) {
|
|
28
28
|
this.cloudLink = { label, url };
|
|
29
29
|
}
|
|
30
30
|
batchOutputAvailable(batchId, path) {
|
|
31
|
-
this.batchLogs.
|
|
31
|
+
this.batchLogs.push([batchId, path]);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Nothing is printed as tasks complete. A summary that interleaved with
|
|
@@ -87,7 +87,7 @@ class SummaryTerminalOutputLifeCycle {
|
|
|
87
87
|
: [line];
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
90
|
-
if (this.batchLogs.
|
|
90
|
+
if (this.batchLogs.length > 0) {
|
|
91
91
|
// One line per worker, not per task: a batch's log explains the whole
|
|
92
92
|
// batch, and no task's own output file contains it.
|
|
93
93
|
bodyLines.push('', output_1.output.dim('Batch worker logs:'));
|
|
@@ -100,7 +100,11 @@ class SummaryTerminalOutputLifeCycle {
|
|
|
100
100
|
}
|
|
101
101
|
bodyLines.push('', output_1.output.dim('Re-run with --output-style=static to inline logs.'));
|
|
102
102
|
const title = this.countsLine(skipped);
|
|
103
|
-
|
|
103
|
+
// A discrete task that never reported was skipped, which fails the run; a
|
|
104
|
+
// continuous one nothing needed is never started
|
|
105
|
+
if (this.failed.length > 0 ||
|
|
106
|
+
this.stopped.length > 0 ||
|
|
107
|
+
this.tasks.some((t) => !t.continuous && !this.completed.has(t.id))) {
|
|
104
108
|
output_1.output.error({ title, bodyLines });
|
|
105
109
|
}
|
|
106
110
|
else {
|
|
@@ -25,6 +25,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
25
25
|
let totalCompletedTasks = 0;
|
|
26
26
|
let timeTakenText;
|
|
27
27
|
const failedTasks = new Set();
|
|
28
|
+
const skippedTasks = new Set();
|
|
28
29
|
const inProgressTasks = new Set();
|
|
29
30
|
// Tasks ended with 'stopped' status (interrupted, didn't finish — counts as failure)
|
|
30
31
|
const stoppedTasks = new Set();
|
|
@@ -35,12 +36,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
35
36
|
// Finalized output strings set on task completion — read by summary print functions
|
|
36
37
|
const tasksToTerminalOutputs = {};
|
|
37
38
|
const tasksToTaskStatus = {};
|
|
38
|
-
const
|
|
39
|
+
const batchWorkerLogs = [];
|
|
40
|
+
const taskIdsInTheOrderTheyStart = new Set();
|
|
39
41
|
const getTerminalOutput = (taskId) => tasksToTerminalOutputs[taskId] ?? taskOutputChunks[taskId]?.join('') ?? '';
|
|
40
42
|
lifeCycle.startTasks = (tasks) => {
|
|
41
43
|
for (let t of tasks) {
|
|
42
44
|
taskOutputChunks[t.id] ??= [];
|
|
43
|
-
taskIdsInTheOrderTheyStart.
|
|
45
|
+
taskIdsInTheOrderTheyStart.add(t.id);
|
|
44
46
|
inProgressTasks.add(t.id);
|
|
45
47
|
}
|
|
46
48
|
};
|
|
@@ -71,6 +73,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
71
73
|
// Skipped tasks don't get an endTasks() call; clear them here so the run
|
|
72
74
|
// summary doesn't treat them as still-in-progress and report Cancelled.
|
|
73
75
|
tasksToTaskStatus[taskId] = 'skipped';
|
|
76
|
+
skippedTasks.add(taskId);
|
|
74
77
|
inProgressTasks.delete(taskId);
|
|
75
78
|
}
|
|
76
79
|
};
|
|
@@ -78,6 +81,9 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
78
81
|
for (const { task, status, terminalOutput } of taskResults) {
|
|
79
82
|
totalCompletedTasks++;
|
|
80
83
|
inProgressTasks.delete(task.id);
|
|
84
|
+
// A batch that crashes after reporting the task skipped still ends it
|
|
85
|
+
// here, as failed or stopped
|
|
86
|
+
skippedTasks.delete(task.id);
|
|
81
87
|
tasksToTaskStatus[task.id] = status;
|
|
82
88
|
if (status === 'stopped') {
|
|
83
89
|
stoppedTasks.add(task.id);
|
|
@@ -107,10 +113,18 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
};
|
|
116
|
+
lifeCycle.batchOutputAvailable = (batchId, path) => {
|
|
117
|
+
batchWorkerLogs.push([batchId, path]);
|
|
118
|
+
};
|
|
110
119
|
lifeCycle.endCommand = () => {
|
|
111
120
|
timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(start));
|
|
112
121
|
resolveRenderIsDonePromise();
|
|
113
122
|
};
|
|
123
|
+
const batchWorkerLogRows = () => [
|
|
124
|
+
`${LEFT_PAD}${output_1.output.dim('Batch worker logs:')}`,
|
|
125
|
+
'',
|
|
126
|
+
...batchWorkerLogs.map(([batchId, path]) => `${EXTENDED_LEFT_PAD}${output_1.output.dim(`- ${batchId}: ${path}`)}`),
|
|
127
|
+
];
|
|
114
128
|
const printSummary = () => {
|
|
115
129
|
const isRunOne = initiatingProject && targets?.length === 1;
|
|
116
130
|
// Handles when the user interrupts the process
|
|
@@ -138,7 +152,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
138
152
|
(0, task_history_life_cycle_1.getTasksHistoryLifeCycle)().printFlakyTasksMessage();
|
|
139
153
|
};
|
|
140
154
|
const printRunOneSummary = ({ failure, cancelled, }) => {
|
|
141
|
-
// Print task outputs in
|
|
155
|
+
// Print task outputs in start order above the summary.
|
|
142
156
|
for (const taskId of taskIdsInTheOrderTheyStart) {
|
|
143
157
|
const taskStatus = tasksToTaskStatus[taskId];
|
|
144
158
|
// Skipped tasks never ran; don't print a misleading `> nx run` header.
|
|
@@ -195,15 +209,27 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
195
209
|
.forEach((arg) => messageLines.push(arg));
|
|
196
210
|
}
|
|
197
211
|
messageLines.push('');
|
|
198
|
-
messageLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${
|
|
199
|
-
messageLines.push(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${
|
|
212
|
+
messageLines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} failed`);
|
|
213
|
+
messageLines.push(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
|
|
214
|
+
if (skippedTasks.size > 0) {
|
|
215
|
+
messageLines.push(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${skippedTasks.size}/${totalTasks} skipped`);
|
|
216
|
+
}
|
|
217
|
+
if (batchWorkerLogs.length > 0) {
|
|
218
|
+
messageLines.push('', ...batchWorkerLogRows());
|
|
219
|
+
}
|
|
200
220
|
const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
|
|
201
221
|
messageLines.push(...viewLogs);
|
|
202
222
|
// Print the entire failure message block with red color
|
|
203
223
|
console.log(output_1.output.colors.red(messageLines.join(node_os_1.EOL)));
|
|
204
224
|
}
|
|
205
225
|
else {
|
|
206
|
-
|
|
226
|
+
const messageLines = [
|
|
227
|
+
output_1.output.applyNxPrefix('red', output_1.output.colors.red(`Cancelled running target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`) + output_1.output.dim(` (${timeTakenText})`)),
|
|
228
|
+
];
|
|
229
|
+
if (batchWorkerLogs.length > 0) {
|
|
230
|
+
messageLines.push('', ...batchWorkerLogRows());
|
|
231
|
+
}
|
|
232
|
+
console.log(messageLines.join(node_os_1.EOL));
|
|
207
233
|
}
|
|
208
234
|
// adds some vertical space after the summary to avoid bunching against terminal
|
|
209
235
|
console.log('');
|
|
@@ -212,8 +238,11 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
212
238
|
console.log('');
|
|
213
239
|
// Collect checklist lines to print after task outputs
|
|
214
240
|
const checklistLines = [];
|
|
215
|
-
// Sort tasks by status: successful tasks first, failed tasks at the end
|
|
216
|
-
|
|
241
|
+
// Sort tasks by status: successful tasks first, failed tasks at the end.
|
|
242
|
+
// A task skipped before it started never reached startTasks.
|
|
243
|
+
const sortedTaskIds = [
|
|
244
|
+
...new Set([...taskIdsInTheOrderTheyStart, ...skippedTasks]),
|
|
245
|
+
].sort((a, b) => {
|
|
217
246
|
const statusA = tasksToTaskStatus[a];
|
|
218
247
|
const statusB = tasksToTaskStatus[b];
|
|
219
248
|
const isFailureA = statusA === 'failure' || !statusA ? 1 : 0;
|
|
@@ -224,7 +253,9 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
224
253
|
for (const taskId of sortedTaskIds) {
|
|
225
254
|
const taskStatus = tasksToTaskStatus[taskId];
|
|
226
255
|
const terminalOutput = getTerminalOutput(taskId);
|
|
227
|
-
if (displayStoppedTasks.has(taskId) ||
|
|
256
|
+
if (displayStoppedTasks.has(taskId) ||
|
|
257
|
+
!taskStatus ||
|
|
258
|
+
taskStatus === 'stopped') {
|
|
228
259
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
|
229
260
|
output_1.output.addNewline();
|
|
230
261
|
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
@@ -246,8 +277,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
246
277
|
else if (taskStatus === 'success') {
|
|
247
278
|
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
248
279
|
}
|
|
280
|
+
else if (taskStatus === 'skipped') {
|
|
281
|
+
checklistLines.push(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
282
|
+
}
|
|
249
283
|
else {
|
|
250
|
-
|
|
284
|
+
const unhandled = taskStatus;
|
|
285
|
+
void unhandled;
|
|
286
|
+
checklistLines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
|
251
287
|
}
|
|
252
288
|
}
|
|
253
289
|
// Print all checklist lines together
|
|
@@ -296,40 +332,41 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
|
296
332
|
.forEach((arg) => failureSummaryRows.push(arg));
|
|
297
333
|
}
|
|
298
334
|
failureSummaryRows.push('');
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
335
|
+
// For display purposes, treat stopped tasks as in-progress
|
|
336
|
+
// (they were running when the process was interrupted)
|
|
337
|
+
const displayCompleted = totalCompletedTasks - stoppedTasks.size;
|
|
338
|
+
const displayInProgress = new Set([...inProgressTasks, ...stoppedTasks]);
|
|
339
|
+
if (totalSuccessfulTasks > 0) {
|
|
340
|
+
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`), '');
|
|
341
|
+
}
|
|
342
|
+
if (totalFailedTasks > 0) {
|
|
343
|
+
const numFailedToPrint = 5;
|
|
344
|
+
const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
|
|
345
|
+
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalTasks}`} targets failed, including the following:`, '', `${failedTasksForPrinting
|
|
346
|
+
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
347
|
+
.join('\n')}`, '');
|
|
348
|
+
if (failedTasks.size > numFailedToPrint) {
|
|
349
|
+
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
|
309
350
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
351
|
+
}
|
|
352
|
+
if (skippedTasks.size > 0) {
|
|
353
|
+
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${pc.yellow('⏭')}${SPACER}${skippedTasks.size}/${totalTasks} targets were skipped.`), '');
|
|
354
|
+
}
|
|
355
|
+
if (displayCompleted !== totalTasks) {
|
|
356
|
+
const remainingTasks = totalTasks - displayCompleted - skippedTasks.size;
|
|
357
|
+
if (displayInProgress.size) {
|
|
358
|
+
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${displayInProgress.size}${`/${totalTasks}`} targets were in progress, including the following:`, '', `${Array.from(displayInProgress)
|
|
314
359
|
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
315
|
-
.join(
|
|
316
|
-
if (failedTasks.size > numFailedToPrint) {
|
|
317
|
-
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
|
318
|
-
}
|
|
360
|
+
.join(node_os_1.EOL)}`, '');
|
|
319
361
|
}
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
if (displayInProgress.size) {
|
|
323
|
-
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${displayInProgress.size}${`/${totalTasks}`} targets were in progress, including the following:`, '', `${Array.from(displayInProgress)
|
|
324
|
-
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
|
325
|
-
.join(node_os_1.EOL)}`, '');
|
|
326
|
-
}
|
|
327
|
-
if (remainingTasks - displayInProgress.size > 0) {
|
|
328
|
-
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${remainingTasks - displayInProgress.size}${`/${totalTasks}`} targets had not started.`), '');
|
|
329
|
-
}
|
|
362
|
+
if (remainingTasks - displayInProgress.size > 0) {
|
|
363
|
+
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${remainingTasks - displayInProgress.size}${`/${totalTasks}`} targets had not started.`), '');
|
|
330
364
|
}
|
|
331
|
-
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
|
332
365
|
}
|
|
366
|
+
if (batchWorkerLogs.length > 0) {
|
|
367
|
+
failureSummaryRows.push(...batchWorkerLogRows(), '');
|
|
368
|
+
}
|
|
369
|
+
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
|
333
370
|
console.log(output_1.output.colors.red(failureSummaryRows.join(node_os_1.EOL)));
|
|
334
371
|
}
|
|
335
372
|
// adds some vertical space after the summary to avoid bunching against terminal
|
|
@@ -5,7 +5,7 @@ export declare class BatchProcess {
|
|
|
5
5
|
private childProcess;
|
|
6
6
|
private executorName;
|
|
7
7
|
/**
|
|
8
|
-
* Whether the
|
|
8
|
+
* Whether the worker's output is written to the terminal as it streams.
|
|
9
9
|
* `summary` does not, and its life cycle cannot enforce that here: this
|
|
10
10
|
* class writes to `output` directly from a stream handler, so without being
|
|
11
11
|
* told it would print a whole batch into a run that asked for log paths.
|
|
@@ -79,7 +79,7 @@ export declare class BatchProcess {
|
|
|
79
79
|
private readonly captureNonce;
|
|
80
80
|
constructor(childProcess: ChildProcess, executorName: string,
|
|
81
81
|
/**
|
|
82
|
-
* Whether the
|
|
82
|
+
* Whether the worker's output is written to the terminal as it streams.
|
|
83
83
|
* `summary` does not, and its life cycle cannot enforce that here: this
|
|
84
84
|
* class writes to `output` directly from a stream handler, so without being
|
|
85
85
|
* told it would print a whole batch into a run that asked for log paths.
|
|
@@ -12,7 +12,7 @@ const batch_messages_1 = require("../batch/batch-messages");
|
|
|
12
12
|
class BatchProcess {
|
|
13
13
|
constructor(childProcess, executorName,
|
|
14
14
|
/**
|
|
15
|
-
* Whether the
|
|
15
|
+
* Whether the worker's output is written to the terminal as it streams.
|
|
16
16
|
* `summary` does not, and its life cycle cannot enforce that here: this
|
|
17
17
|
* class writes to `output` directly from a stream handler, so without being
|
|
18
18
|
* told it would print a whole batch into a run that asked for log paths.
|
|
@@ -73,8 +73,6 @@ export declare class TaskOrchestrator {
|
|
|
73
73
|
private cleanupPromise;
|
|
74
74
|
private signalHandlers;
|
|
75
75
|
private tasksWithPersistedOutput;
|
|
76
|
-
/** Batches whose worker log was handed to the life cycle, so it must survive. */
|
|
77
|
-
private announcedBatchLogs;
|
|
78
76
|
constructor(hasher: TaskHasher, initiatingProject: string | undefined, initiatingTasks: Task[], projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: NxArgs & DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient,
|
|
79
77
|
/** What the user named; undefined means they named nothing. */
|
|
80
78
|
specifiedOutputStyle: OutputStyle | undefined,
|
|
@@ -162,9 +160,14 @@ export declare class TaskOrchestrator {
|
|
|
162
160
|
applyFromCacheOrRunBatch(doNotSkipCache: boolean, batch: Batch, groupId: number): Promise<TaskResult[]>;
|
|
163
161
|
private runBatchWave;
|
|
164
162
|
private runBatch;
|
|
163
|
+
/**
|
|
164
|
+
* Under the TUI, batch worker output reaches only the batch's pane, which
|
|
165
|
+
* closes with the batch (or the TUI, if pinned), so it is captured instead.
|
|
166
|
+
*/
|
|
167
|
+
private printsBatchOutput;
|
|
165
168
|
/**
|
|
166
169
|
* Tells the life cycle where the batch worker's own log is, when something
|
|
167
|
-
* failed and
|
|
170
|
+
* failed and its output was not printed as it streamed.
|
|
168
171
|
*
|
|
169
172
|
* The path is announced rather than the bytes copied into a task: one worker
|
|
170
173
|
* produces one log, it explains the batch rather than any single task, and a
|
|
@@ -197,8 +200,9 @@ export declare class TaskOrchestrator {
|
|
|
197
200
|
* those per-project summaries to the worker's stdio at all.
|
|
198
201
|
*
|
|
199
202
|
* The worker's whole captured log is rendered as a fold above them when the
|
|
200
|
-
* run asked for full output, or when any task failed
|
|
201
|
-
*
|
|
203
|
+
* run asked for full output, or when any task failed, was stopped or was
|
|
204
|
+
* never reached.
|
|
205
|
+
* A diagnostic that explains a failure is routinely one no task claimed:
|
|
202
206
|
* `@nx/maven`'s batch impl writes its exit-code dump and failed-task outputs
|
|
203
207
|
* to the worker's stderr via `console.error`, and the Maven JVM it spawns
|
|
204
208
|
* points slf4j at `System.out` because its own stderr carries the result
|