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
|
@@ -40,6 +40,28 @@ const utils_1 = require("./utils");
|
|
|
40
40
|
function resolveBatchTaskStatus(result) {
|
|
41
41
|
return result.status ?? (result.success ? 'success' : 'failure');
|
|
42
42
|
}
|
|
43
|
+
function batchWorkerLogExplains(status) {
|
|
44
|
+
switch (status) {
|
|
45
|
+
case 'failure':
|
|
46
|
+
case 'stopped':
|
|
47
|
+
// The worker never reached it, e.g. `@nx/gradle` after a build failure
|
|
48
|
+
// outside the batch's own tasks
|
|
49
|
+
case 'skipped':
|
|
50
|
+
return true;
|
|
51
|
+
case 'success':
|
|
52
|
+
case 'local-cache':
|
|
53
|
+
case 'local-cache-kept-existing':
|
|
54
|
+
case 'remote-cache':
|
|
55
|
+
return false;
|
|
56
|
+
default: {
|
|
57
|
+
const unhandled = status;
|
|
58
|
+
void unhandled;
|
|
59
|
+
// Batch executors report their statuses untyped, so an unknown one can
|
|
60
|
+
// still arrive here. Nx can't tell it succeeded, so its log is shown
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
43
65
|
/** Whether a path names a file with bytes in it. */
|
|
44
66
|
function hasContent(path) {
|
|
45
67
|
try {
|
|
@@ -173,8 +195,6 @@ class TaskOrchestrator {
|
|
|
173
195
|
// exit, and the paths that never spawn one write it inline. The backstop in
|
|
174
196
|
// postRunSteps consults this so a task's output is written exactly once.
|
|
175
197
|
this.tasksWithPersistedOutput = new Set();
|
|
176
|
-
/** Batches whose worker log was handed to the life cycle, so it must survive. */
|
|
177
|
-
this.announcedBatchLogs = new Set();
|
|
178
198
|
}
|
|
179
199
|
async init() {
|
|
180
200
|
this.setupSignalHandlers();
|
|
@@ -253,8 +273,24 @@ class TaskOrchestrator {
|
|
|
253
273
|
*/
|
|
254
274
|
async executeCoordinatorLoop(doNotSkipCache, parallelism) {
|
|
255
275
|
while (true) {
|
|
256
|
-
if (this.
|
|
276
|
+
if (this.stopRequested)
|
|
277
|
+
break;
|
|
278
|
+
// On bail, start nothing new but let running tasks finish. Skip unstarted
|
|
279
|
+
// discrete tasks unless stopped, so the run still reads as interrupted
|
|
280
|
+
if (this.bailed) {
|
|
281
|
+
await Promise.allSettled(this.pendingDiscreteWorkers);
|
|
282
|
+
if (this.stopRequested)
|
|
283
|
+
break;
|
|
284
|
+
for (const task of Object.values(this.taskGraph.tasks)) {
|
|
285
|
+
if (!task.continuous && !this.completedTasks.has(task.id)) {
|
|
286
|
+
this.completedTasks.set(task.id, 'skipped');
|
|
287
|
+
if (this.tuiEnabled) {
|
|
288
|
+
this.options.lifeCycle.setTaskStatus(task.id, 2 /* NativeTaskStatus.Skipped */);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
257
292
|
break;
|
|
293
|
+
}
|
|
258
294
|
await this.scheduleAfterReadiness();
|
|
259
295
|
// 1. Hash BEFORE processAll so processTask sees hashes set, and so
|
|
260
296
|
// resolveCachedTasksBulk can look them up in the cache. Each task
|
|
@@ -298,6 +334,9 @@ class TaskOrchestrator {
|
|
|
298
334
|
this.openGroup(groupId);
|
|
299
335
|
continue;
|
|
300
336
|
}
|
|
337
|
+
// A task may have failed during one of the awaits above
|
|
338
|
+
if (this.bailed)
|
|
339
|
+
continue;
|
|
301
340
|
// 5. Dispatch cache misses as individual workers
|
|
302
341
|
while (this.pendingDiscreteWorkers.size < parallelism) {
|
|
303
342
|
const task = this.tasksSchedule.nextTask((t) => !t.continuous);
|
|
@@ -744,8 +783,9 @@ class TaskOrchestrator {
|
|
|
744
783
|
async runBatch(batch, env, groupId) {
|
|
745
784
|
const runBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:start');
|
|
746
785
|
let batchProcess;
|
|
786
|
+
let workerLogAnnounced = false;
|
|
747
787
|
try {
|
|
748
|
-
batchProcess = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.projectGraph, this.fullTaskGraph, env,
|
|
788
|
+
batchProcess = await this.forkedProcessTaskRunner.forkProcessForBatch(batch, this.projectGraph, this.fullTaskGraph, env, this.printsBatchOutput());
|
|
749
789
|
// Stream output from batch process to the batch
|
|
750
790
|
batchProcess.onOutput((output) => {
|
|
751
791
|
this.options.lifeCycle.appendBatchOutput?.(batch.id, output);
|
|
@@ -767,7 +807,8 @@ class TaskOrchestrator {
|
|
|
767
807
|
// When the batch is being folded, printing is deferred to batch end
|
|
768
808
|
// (printGroupedBatchOutput), which always renders each task through the
|
|
769
809
|
// life cycle and adds the worker's whole log as a fold when the run
|
|
770
|
-
// asked for full output or any task failed or was
|
|
810
|
+
// asked for full output or any task failed, was stopped or was never
|
|
811
|
+
// reached.
|
|
771
812
|
if (status !== 'skipped' && !(0, output_1.shouldGroupBatchOutput)()) {
|
|
772
813
|
this.options.lifeCycle.printTaskTerminalOutput(task, status, result.terminalOutput ?? '');
|
|
773
814
|
}
|
|
@@ -798,7 +839,7 @@ class TaskOrchestrator {
|
|
|
798
839
|
if ((0, output_1.shouldGroupBatchOutput)()) {
|
|
799
840
|
this.renderBatchOutputSafely(batch.id, () => this.printGroupedBatchOutput(batch, taskResults, batchProcess.getCapturedOutputPath()));
|
|
800
841
|
}
|
|
801
|
-
this.announceBatchWorkerLog(batch.id, taskResults, batchProcess.getCapturedOutputPath());
|
|
842
|
+
workerLogAnnounced = this.announceBatchWorkerLog(batch.id, taskResults, batchProcess.getCapturedOutputPath());
|
|
802
843
|
return taskResults;
|
|
803
844
|
}
|
|
804
845
|
catch (e) {
|
|
@@ -816,7 +857,7 @@ class TaskOrchestrator {
|
|
|
816
857
|
};
|
|
817
858
|
});
|
|
818
859
|
await batchProcess?.flushCapturedOutput();
|
|
819
|
-
this.announceBatchWorkerLog(batch.id, taskResults, batchProcess?.getCapturedOutputPath());
|
|
860
|
+
workerLogAnnounced = this.announceBatchWorkerLog(batch.id, taskResults, batchProcess?.getCapturedOutputPath());
|
|
820
861
|
// The worker died without reporting results, so nothing was attributed to
|
|
821
862
|
// a task and no per-task output ran. Everything it wrote went to
|
|
822
863
|
// stdout/stderr, held back under grouping - surface it as one fold. Under
|
|
@@ -843,38 +884,45 @@ class TaskOrchestrator {
|
|
|
843
884
|
// Kept only when something failed and the log was announced; an all-green
|
|
844
885
|
// batch's chatter explains nothing and would sit in `batchOutputs/` until
|
|
845
886
|
// the sweep.
|
|
846
|
-
if (!
|
|
887
|
+
if (!workerLogAnnounced) {
|
|
847
888
|
batchProcess?.discardCapturedOutput();
|
|
848
889
|
}
|
|
849
890
|
const runBatchEnd = perf_hooks_1.performance.mark('TaskOrchestrator-run-batch:end');
|
|
850
891
|
perf_hooks_1.performance.measure('TaskOrchestrator-run-batch', runBatchStart.name, runBatchEnd.name);
|
|
851
892
|
}
|
|
852
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* Under the TUI, batch worker output reaches only the batch's pane, which
|
|
896
|
+
* closes with the batch (or the TUI, if pinned), so it is captured instead.
|
|
897
|
+
*/
|
|
898
|
+
printsBatchOutput() {
|
|
899
|
+
return (0, output_1.printsTaskOutput)(this.resolvedOutputStyle) && !this.tuiEnabled;
|
|
900
|
+
}
|
|
853
901
|
/**
|
|
854
902
|
* Tells the life cycle where the batch worker's own log is, when something
|
|
855
|
-
* failed and
|
|
903
|
+
* failed and its output was not printed as it streamed.
|
|
856
904
|
*
|
|
857
905
|
* The path is announced rather than the bytes copied into a task: one worker
|
|
858
906
|
* produces one log, it explains the batch rather than any single task, and a
|
|
859
907
|
* task's own output file is read back verbatim on a cache hit.
|
|
860
908
|
*/
|
|
861
909
|
announceBatchWorkerLog(batchId, results, capturedOutputPath) {
|
|
862
|
-
if (!capturedOutputPath ||
|
|
863
|
-
return;
|
|
910
|
+
if (!capturedOutputPath || this.printsBatchOutput()) {
|
|
911
|
+
return false;
|
|
864
912
|
}
|
|
865
|
-
const failed = results.some((r) => r.status
|
|
913
|
+
const failed = results.some((r) => batchWorkerLogExplains(r.status));
|
|
866
914
|
if (!failed) {
|
|
867
|
-
return;
|
|
915
|
+
return false;
|
|
868
916
|
}
|
|
869
917
|
// The path is minted when the file is opened, before any byte reaches it,
|
|
870
918
|
// so a capture that failed on its first write leaves one that exists and is
|
|
871
919
|
// empty. Announcing that offers the reader an address holding nothing.
|
|
872
920
|
// Checked after the flush, so the size is what a reader will actually see.
|
|
873
921
|
if (!hasContent(capturedOutputPath)) {
|
|
874
|
-
return;
|
|
922
|
+
return false;
|
|
875
923
|
}
|
|
876
|
-
this.announcedBatchLogs.add(batchId);
|
|
877
924
|
this.options.lifeCycle.batchOutputAvailable?.(batchId, capturedOutputPath);
|
|
925
|
+
return true;
|
|
878
926
|
}
|
|
879
927
|
/**
|
|
880
928
|
* Rendering a batch's output must never change the batch's results. A throw
|
|
@@ -912,8 +960,9 @@ class TaskOrchestrator {
|
|
|
912
960
|
* those per-project summaries to the worker's stdio at all.
|
|
913
961
|
*
|
|
914
962
|
* The worker's whole captured log is rendered as a fold above them when the
|
|
915
|
-
* run asked for full output, or when any task failed
|
|
916
|
-
*
|
|
963
|
+
* run asked for full output, or when any task failed, was stopped or was
|
|
964
|
+
* never reached.
|
|
965
|
+
* A diagnostic that explains a failure is routinely one no task claimed:
|
|
917
966
|
* `@nx/maven`'s batch impl writes its exit-code dump and failed-task outputs
|
|
918
967
|
* to the worker's stderr via `console.error`, and the Maven JVM it spawns
|
|
919
968
|
* points slf4j at `System.out` because its own stderr carries the result
|
|
@@ -949,7 +998,7 @@ class TaskOrchestrator {
|
|
|
949
998
|
verbose: this.options.verbose,
|
|
950
999
|
outputStyle: this.resolvedOutputStyle,
|
|
951
1000
|
});
|
|
952
|
-
const batchOwnsTheDiagnostic = taskResults.some((r) => r.status
|
|
1001
|
+
const batchOwnsTheDiagnostic = taskResults.some((r) => batchWorkerLogExplains(r.status));
|
|
953
1002
|
if ((0, output_1.printsTaskOutput)(this.resolvedOutputStyle) &&
|
|
954
1003
|
(printsFullOutput || batchOwnsTheDiagnostic) &&
|
|
955
1004
|
capturedOutputPath) {
|
|
@@ -983,7 +1032,9 @@ class TaskOrchestrator {
|
|
|
983
1032
|
? 'failure'
|
|
984
1033
|
: taskResults.some((r) => r.status === 'stopped')
|
|
985
1034
|
? 'stopped'
|
|
986
|
-
: '
|
|
1035
|
+
: taskResults.some((r) => r.status === 'skipped')
|
|
1036
|
+
? 'skipped'
|
|
1037
|
+
: 'success';
|
|
987
1038
|
output_1.output.logBatchGroup(label, body, worst);
|
|
988
1039
|
if (!redirectLines) {
|
|
989
1040
|
return;
|
|
@@ -1065,7 +1116,7 @@ class TaskOrchestrator {
|
|
|
1065
1116
|
async handleDiscreteWorkerFailure(doNotSkipCache, task, groupId, e) {
|
|
1066
1117
|
if (this.completedTasks.has(task.id))
|
|
1067
1118
|
return;
|
|
1068
|
-
const terminalOutput = e?.message ??
|
|
1119
|
+
const terminalOutput = e?.message ?? String(e);
|
|
1069
1120
|
// The worker rejected, so whatever the runner was going to leave on disk
|
|
1070
1121
|
// either never landed or can't be trusted. Hand the file back to
|
|
1071
1122
|
// postRunSteps so the failure itself is what the task's output path holds.
|
|
@@ -1122,29 +1173,52 @@ class TaskOrchestrator {
|
|
|
1122
1173
|
let resolveDiscreteExit;
|
|
1123
1174
|
const discreteExitHandled = new Promise((r) => (resolveDiscreteExit = r));
|
|
1124
1175
|
this.discreteTaskExitHandled.set(task.id, discreteExitHandled);
|
|
1125
|
-
this.detectTaskInvocationLoop(task);
|
|
1126
|
-
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
1127
|
-
this.runningDiscreteTasks.set(task.id, {
|
|
1128
|
-
runningTask: childProcess,
|
|
1129
|
-
stopping: false,
|
|
1130
|
-
});
|
|
1131
|
-
const { code, terminalOutput } = await childProcess.getResults();
|
|
1132
|
-
const isStopping = this.runningDiscreteTasks.get(task.id)?.stopping ?? false;
|
|
1133
|
-
this.runningDiscreteTasks.delete(task.id);
|
|
1134
|
-
const result = {
|
|
1135
|
-
task,
|
|
1136
|
-
code,
|
|
1137
|
-
status: isStopping ? 'stopped' : code === 0 ? 'success' : 'failure',
|
|
1138
|
-
terminalOutput,
|
|
1139
|
-
};
|
|
1140
1176
|
try {
|
|
1177
|
+
let result;
|
|
1178
|
+
try {
|
|
1179
|
+
this.detectTaskInvocationLoop(task);
|
|
1180
|
+
const childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
1181
|
+
this.runningDiscreteTasks.set(task.id, {
|
|
1182
|
+
runningTask: childProcess,
|
|
1183
|
+
stopping: false,
|
|
1184
|
+
});
|
|
1185
|
+
// Rejects if run-commands cannot start or a forked child died before
|
|
1186
|
+
// writing its log, so postRunSteps writes the log instead
|
|
1187
|
+
const { code, terminalOutput } = await childProcess
|
|
1188
|
+
.getResults()
|
|
1189
|
+
.catch((e) => {
|
|
1190
|
+
this.tasksWithPersistedOutput.delete(task.id);
|
|
1191
|
+
return { code: 1, terminalOutput: e?.message ?? String(e) };
|
|
1192
|
+
});
|
|
1193
|
+
const isStopping = this.runningDiscreteTasks.get(task.id)?.stopping ?? false;
|
|
1194
|
+
this.runningDiscreteTasks.delete(task.id);
|
|
1195
|
+
result = {
|
|
1196
|
+
task,
|
|
1197
|
+
code,
|
|
1198
|
+
status: isStopping ? 'stopped' : code === 0 ? 'success' : 'failure',
|
|
1199
|
+
terminalOutput,
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
catch (e) {
|
|
1203
|
+
// Record the failure before the exit settles, since cleanup awaits the
|
|
1204
|
+
// exit to let endTasks finish before run() returns
|
|
1205
|
+
await this.handleDiscreteWorkerFailure(doNotSkipCache, task, groupId, e);
|
|
1206
|
+
return {
|
|
1207
|
+
task,
|
|
1208
|
+
code: 1,
|
|
1209
|
+
status: 'failure',
|
|
1210
|
+
terminalOutput: e?.message ?? String(e),
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
// A failed postRunSteps rejects to the caller. dispatchDiscreteWorker
|
|
1214
|
+
// handles it, and handling it here too prints the failure twice
|
|
1141
1215
|
await this.postRunSteps([result], doNotSkipCache, groupId);
|
|
1216
|
+
return result;
|
|
1142
1217
|
}
|
|
1143
1218
|
finally {
|
|
1144
1219
|
this.discreteTaskExitHandled.delete(task.id);
|
|
1145
1220
|
resolveDiscreteExit();
|
|
1146
1221
|
}
|
|
1147
|
-
return result;
|
|
1148
1222
|
}
|
|
1149
1223
|
async runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput) {
|
|
1150
1224
|
const shouldPrefix = streamOutput &&
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export declare function getNxInstallationPath(root?: string): string;
|
|
2
2
|
export declare function getNxRequirePaths(root?: string): string[];
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a package the workspace provides (typescript, a release version
|
|
5
|
+
* actions implementation, ...) from the workspace first, then from this nx
|
|
6
|
+
* installation. A package manager's global or content-addressed store links nx
|
|
7
|
+
* only to its own dependencies, so resolving from nx's location alone cannot
|
|
8
|
+
* see what the workspace installs.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveFromWorkspace(specifier: string, root?: string): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNxInstallationPath = getNxInstallationPath;
|
|
4
4
|
exports.getNxRequirePaths = getNxRequirePaths;
|
|
5
|
+
exports.resolveFromWorkspace = resolveFromWorkspace;
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const workspace_root_1 = require("./workspace-root");
|
|
7
8
|
function getNxInstallationPath(root = workspace_root_1.workspaceRoot) {
|
|
@@ -10,3 +11,15 @@ function getNxInstallationPath(root = workspace_root_1.workspaceRoot) {
|
|
|
10
11
|
function getNxRequirePaths(root = workspace_root_1.workspaceRoot) {
|
|
11
12
|
return [getNxInstallationPath(root), root];
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a package the workspace provides (typescript, a release version
|
|
16
|
+
* actions implementation, ...) from the workspace first, then from this nx
|
|
17
|
+
* installation. A package manager's global or content-addressed store links nx
|
|
18
|
+
* only to its own dependencies, so resolving from nx's location alone cannot
|
|
19
|
+
* see what the workspace installs.
|
|
20
|
+
*/
|
|
21
|
+
function resolveFromWorkspace(specifier, root = workspace_root_1.workspaceRoot) {
|
|
22
|
+
return require.resolve(specifier, {
|
|
23
|
+
paths: [...getNxRequirePaths(root), __dirname],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -224,9 +224,10 @@ declare class CLIOutput {
|
|
|
224
224
|
* The batch's own output is copied straight from the file it was captured
|
|
225
225
|
* into, so an arbitrarily long log costs a fixed amount of memory here.
|
|
226
226
|
* Nothing is withheld: this rendering is chosen because the whole log was
|
|
227
|
-
* asked for, because no task claimed any of it, or because a task failed
|
|
228
|
-
* was stopped — in which case repeating claimed bytes
|
|
229
|
-
* blocks is deliberate (see
|
|
227
|
+
* asked for, because no task claimed any of it, or because a task failed,
|
|
228
|
+
* was stopped or was never reached — in which case repeating claimed bytes
|
|
229
|
+
* beside the per-task blocks is deliberate (see
|
|
230
|
+
* TaskOrchestrator.printGroupedBatchOutput).
|
|
230
231
|
*/
|
|
231
232
|
logBatchGroup(label: string, body: {
|
|
232
233
|
capturedOutputPath?: string;
|
package/dist/src/utils/output.js
CHANGED
|
@@ -422,9 +422,10 @@ class CLIOutput {
|
|
|
422
422
|
* The batch's own output is copied straight from the file it was captured
|
|
423
423
|
* into, so an arbitrarily long log costs a fixed amount of memory here.
|
|
424
424
|
* Nothing is withheld: this rendering is chosen because the whole log was
|
|
425
|
-
* asked for, because no task claimed any of it, or because a task failed
|
|
426
|
-
* was stopped — in which case repeating claimed bytes
|
|
427
|
-
* blocks is deliberate (see
|
|
425
|
+
* asked for, because no task claimed any of it, or because a task failed,
|
|
426
|
+
* was stopped or was never reached — in which case repeating claimed bytes
|
|
427
|
+
* beside the per-task blocks is deliberate (see
|
|
428
|
+
* TaskOrchestrator.printGroupedBatchOutput).
|
|
428
429
|
*/
|
|
429
430
|
logBatchGroup(label, body, taskStatus) {
|
|
430
431
|
const grouped = isLogGroupingEnabled();
|
|
@@ -25,7 +25,8 @@ export interface PackageManagerCommands {
|
|
|
25
25
|
ignoreScriptsFlag?: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Detects
|
|
28
|
+
* Detects the package manager from the CLI override or directory lockfiles.
|
|
29
|
+
* Project directories in the current workspace can fall back to its root lockfile.
|
|
29
30
|
*/
|
|
30
31
|
export declare function detectPackageManager(dir?: string): PackageManager;
|
|
31
32
|
/**
|
|
@@ -65,20 +65,50 @@ function execPackageManagerSync(pm, args, options) {
|
|
|
65
65
|
return (0, child_process_1.execFileSync)(pm, args, options);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Detects
|
|
68
|
+
* Detects the package manager from the CLI override or directory lockfiles.
|
|
69
|
+
* Project directories in the current workspace can fall back to its root lockfile.
|
|
69
70
|
*/
|
|
70
|
-
function detectPackageManager(dir =
|
|
71
|
+
function detectPackageManager(dir = workspace_root_1.workspaceRoot) {
|
|
71
72
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
if (nxJson.cli?.packageManager) {
|
|
74
|
+
return nxJson.cli.packageManager;
|
|
75
|
+
}
|
|
76
|
+
const dirsToCheck = isCurrentWorkspaceSubdirectory(dir)
|
|
77
|
+
? [dir, workspace_root_1.workspaceRoot]
|
|
78
|
+
: [dir];
|
|
79
|
+
for (const directory of dirsToCheck) {
|
|
80
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(directory, 'bun.lockb')) ||
|
|
81
|
+
(0, fs_1.existsSync)((0, path_1.join)(directory, 'bun.lock'))) {
|
|
82
|
+
return 'bun';
|
|
83
|
+
}
|
|
84
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(directory, 'yarn.lock'))) {
|
|
85
|
+
return 'yarn';
|
|
86
|
+
}
|
|
87
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(directory, 'pnpm-lock.yaml'))) {
|
|
88
|
+
return 'pnpm';
|
|
89
|
+
}
|
|
90
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(directory, 'package-lock.json'))) {
|
|
91
|
+
return 'npm';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return detectInvokedPackageManager();
|
|
95
|
+
}
|
|
96
|
+
function isCurrentWorkspaceSubdirectory(dir) {
|
|
97
|
+
let directory = (0, path_1.resolve)(dir);
|
|
98
|
+
const relativePath = (0, path_1.relative)(workspace_root_1.workspaceRoot, directory);
|
|
99
|
+
if (!relativePath ||
|
|
100
|
+
relativePath === '..' ||
|
|
101
|
+
relativePath.startsWith(`..${path_1.sep}`) ||
|
|
102
|
+
(0, path_1.isAbsolute)(relativePath)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
while ((0, path_1.relative)(workspace_root_1.workspaceRoot, directory) !== '') {
|
|
106
|
+
if (['nx.json', 'nx', 'nx.bat'].some((file) => (0, fileutils_1.fileExists)((0, path_1.join)(directory, file)))) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
directory = (0, path_1.dirname)(directory);
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
82
112
|
}
|
|
83
113
|
/**
|
|
84
114
|
* Detects which package manager was used to invoke the current command
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "24.0.
|
|
3
|
+
"version": "24.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"tmp": "0.2.7",
|
|
127
127
|
"tsconfig-paths": "4.2.0",
|
|
128
128
|
"tslib": "2.8.1",
|
|
129
|
-
"undici": "7.
|
|
129
|
+
"undici": "7.30.1",
|
|
130
130
|
"util-deprecate": "1.0.2",
|
|
131
131
|
"wcwidth": "1.0.1",
|
|
132
132
|
"which": "3.0.1",
|
|
@@ -150,16 +150,16 @@
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
"optionalDependencies": {
|
|
153
|
-
"@nx/nx-darwin-arm64": "24.0.
|
|
154
|
-
"@nx/nx-darwin-x64": "24.0.
|
|
155
|
-
"@nx/nx-freebsd-x64": "24.0.
|
|
156
|
-
"@nx/nx-linux-arm-gnueabihf": "24.0.
|
|
157
|
-
"@nx/nx-linux-arm64-gnu": "24.0.
|
|
158
|
-
"@nx/nx-linux-arm64-musl": "24.0.
|
|
159
|
-
"@nx/nx-linux-x64-gnu": "24.0.
|
|
160
|
-
"@nx/nx-linux-x64-musl": "24.0.
|
|
161
|
-
"@nx/nx-win32-arm64-msvc": "24.0.
|
|
162
|
-
"@nx/nx-win32-x64-msvc": "24.0.
|
|
153
|
+
"@nx/nx-darwin-arm64": "24.0.3",
|
|
154
|
+
"@nx/nx-darwin-x64": "24.0.3",
|
|
155
|
+
"@nx/nx-freebsd-x64": "24.0.3",
|
|
156
|
+
"@nx/nx-linux-arm-gnueabihf": "24.0.3",
|
|
157
|
+
"@nx/nx-linux-arm64-gnu": "24.0.3",
|
|
158
|
+
"@nx/nx-linux-arm64-musl": "24.0.3",
|
|
159
|
+
"@nx/nx-linux-x64-gnu": "24.0.3",
|
|
160
|
+
"@nx/nx-linux-x64-musl": "24.0.3",
|
|
161
|
+
"@nx/nx-win32-arm64-msvc": "24.0.3",
|
|
162
|
+
"@nx/nx-win32-x64-msvc": "24.0.3"
|
|
163
163
|
},
|
|
164
164
|
"nx-migrations": {
|
|
165
165
|
"migrations": "./migrations.json",
|
package/schemas/nx-schema.json
CHANGED
|
@@ -1122,6 +1122,12 @@
|
|
|
1122
1122
|
"enum": ["ignore", "forward"],
|
|
1123
1123
|
"default": "ignore"
|
|
1124
1124
|
},
|
|
1125
|
+
"options": {
|
|
1126
|
+
"type": "string",
|
|
1127
|
+
"description": "Whether to forward task options to the dependency target.",
|
|
1128
|
+
"enum": ["ignore", "forward"],
|
|
1129
|
+
"default": "ignore"
|
|
1130
|
+
},
|
|
1125
1131
|
"inputs": {
|
|
1126
1132
|
"type": "boolean",
|
|
1127
1133
|
"description": "Set to false to keep a continuous dependency's inputs out of this target's hash and affected calculation. Has no effect on dependencies that are not continuous.",
|
|
@@ -103,6 +103,12 @@
|
|
|
103
103
|
"enum": ["ignore", "forward"],
|
|
104
104
|
"default": "ignore"
|
|
105
105
|
},
|
|
106
|
+
"options": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "Whether to forward task options to the dependency target.",
|
|
109
|
+
"enum": ["ignore", "forward"],
|
|
110
|
+
"default": "ignore"
|
|
111
|
+
},
|
|
106
112
|
"inputs": {
|
|
107
113
|
"type": "boolean",
|
|
108
114
|
"description": "Set to false to keep a continuous dependency's inputs out of this target's hash and affected calculation. Has no effect on dependencies that are not continuous.",
|