nx 21.0.0-rc.2 → 21.0.0-rc.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.
Binary file
@@ -17,3 +17,4 @@ export declare function verifyOrUpdateNxCloudClient(options: CloudTaskRunnerOpti
17
17
  nxCloudClient: NxCloudClient;
18
18
  version: string;
19
19
  } | null>;
20
+ export declare function getBundleInstallDefaultLocation(): string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NxCloudClientUnavailableError = exports.NxCloudEnterpriseOutdatedError = void 0;
4
4
  exports.verifyOrUpdateNxCloudClient = verifyOrUpdateNxCloudClient;
5
+ exports.getBundleInstallDefaultLocation = getBundleInstallDefaultLocation;
5
6
  const fs_1 = require("fs");
6
7
  const zlib_1 = require("zlib");
7
8
  const path_1 = require("path");
@@ -5,6 +5,6 @@ export declare class UnknownCommandError extends Error {
5
5
  constructor(command: string, availableCommands: string[]);
6
6
  }
7
7
  export declare function getCloudClient(options: CloudTaskRunnerOptions): Promise<{
8
- invoke: (command: string) => void;
8
+ invoke: (command: string, exit?: boolean) => void;
9
9
  availableCommands: string[];
10
10
  }>;
@@ -17,13 +17,20 @@ async function getCloudClient(options) {
17
17
  const paths = (0, resolution_helpers_1.findAncestorNodeModules)(__dirname, []);
18
18
  nxCloudClient.configureLightClientRequire()(paths);
19
19
  return {
20
- invoke: (command) => {
20
+ invoke: (command, exit = true) => {
21
21
  if (command in nxCloudClient.commands) {
22
22
  nxCloudClient.commands[command]()
23
- .then(() => process.exit(0))
23
+ .then(() => {
24
+ if (exit) {
25
+ process.exit(0);
26
+ }
27
+ })
24
28
  .catch((e) => {
25
29
  console.error(e);
26
- process.exit(1);
30
+ if (exit) {
31
+ process.exit(1);
32
+ }
33
+ throw e;
27
34
  });
28
35
  }
29
36
  else {
@@ -108,7 +108,7 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides,
108
108
  }
109
109
  lines = [output_1.output.colors.green(lines.join(node_os_1.EOL))];
110
110
  }
111
- else if (totalCompletedTasks + stoppedTasks.size === totalTasks) {
111
+ else if (inProgressTasks.size === 0) {
112
112
  let text = `Ran target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`;
113
113
  if (tasks.length > 1) {
114
114
  text += ` and ${output_1.output.bold(tasks.length - 1)} task(s) they depend on`;
@@ -122,22 +122,17 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides,
122
122
  .forEach((arg) => taskOverridesLines.push(arg));
123
123
  }
124
124
  const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
125
- lines = [
126
- output_1.output.colors.red([
127
- output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
128
- ...taskOverridesLines,
129
- '',
130
- `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
131
- `${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
132
- ...viewLogs,
133
- ].join(node_os_1.EOL)),
134
- ];
125
+ lines.push(output_1.output.colors.red([
126
+ output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
127
+ ...taskOverridesLines,
128
+ '',
129
+ `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
130
+ `${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
131
+ ...viewLogs,
132
+ ].join(node_os_1.EOL)));
135
133
  }
136
134
  else {
137
- lines = [
138
- ...output_1.output.getVerticalSeparatorLines('red'),
139
- 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})`)),
140
- ];
135
+ lines.push(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})`)));
141
136
  }
142
137
  // adds some vertical space after the summary to avoid bunching against terminal
143
138
  lines.push('');
@@ -145,12 +140,13 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides,
145
140
  };
146
141
  const printRunManySummary = () => {
147
142
  console.log('');
148
- const lines = [];
143
+ const lines = [''];
149
144
  const failure = totalSuccessfulTasks + stoppedTasks.size !== totalTasks;
150
145
  for (const taskId of taskIdsInOrderOfCompletion) {
151
146
  const { terminalOutput, taskStatus } = tasksToTerminalOutputs[taskId];
152
147
  if (taskStatus === 'failure') {
153
148
  output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
149
+ output_1.output.addNewline();
154
150
  lines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
155
151
  }
156
152
  else {
@@ -168,20 +168,14 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
168
168
  // The cloud client calls console.log when NX_VERBOSE_LOGGING is set to true
169
169
  console.log = createPatchedConsoleMethod(originalConsoleLog);
170
170
  console.error = createPatchedConsoleMethod(originalConsoleError);
171
- renderIsDone = new Promise((resolve) => {
172
- appLifeCycle.__init(() => {
173
- resolve();
174
- });
175
- })
176
- .then(() => {
171
+ globalThis.tuiOnProcessExit = () => {
177
172
  restoreTerminal();
178
- })
179
- .finally(() => {
180
173
  // Revert the patched methods
181
174
  process.stdout.write = originalStdoutWrite;
182
175
  process.stderr.write = originalStderrWrite;
183
176
  console.log = originalConsoleLog;
184
177
  console.error = originalConsoleError;
178
+ process.stdout.write('\n');
185
179
  // Print the intercepted Nx Cloud logs
186
180
  for (const log of interceptedNxCloudLogs) {
187
181
  const logString = log.toString().trimStart();
@@ -190,6 +184,18 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
190
184
  process.stdout.write('\n');
191
185
  }
192
186
  }
187
+ };
188
+ renderIsDone = new Promise((resolve) => {
189
+ appLifeCycle.__init(() => {
190
+ resolve();
191
+ });
192
+ }).finally(() => {
193
+ restoreTerminal();
194
+ // Revert the patched methods
195
+ process.stdout.write = originalStdoutWrite;
196
+ process.stderr.write = originalStderrWrite;
197
+ console.log = originalConsoleLog;
198
+ console.error = originalConsoleError;
193
199
  });
194
200
  }
195
201
  return {
@@ -575,7 +581,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
575
581
  ...runnerOptions,
576
582
  lifeCycle: compositedLifeCycle,
577
583
  }, {
578
- initiatingProject: nxArgs.outputStyle === 'compact' ? null : initiatingProject,
584
+ initiatingProject,
579
585
  initiatingTasks,
580
586
  projectGraph,
581
587
  nxJson,