nx 21.0.0-beta.0 → 21.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +5 -1
- package/migrations.json +5 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +182 -35
- package/schemas/project-schema.json +5 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +52 -38
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +6 -2
- package/src/command-line/init/implementation/utils.js +110 -45
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +70 -39
- package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
- package/src/command-line/migrate/migrate-ui-api.js +227 -0
- package/src/command-line/migrate/migrate.d.ts +16 -3
- package/src/command-line/migrate/migrate.js +134 -101
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.js +18 -15
- package/src/command-line/release/command-object.d.ts +8 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +139 -45
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/index.d.ts +4 -0
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +252 -0
- package/src/command-line/release/version/release-group-processor.js +1057 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +93 -0
- package/src/command-line/release/version/test-utils.js +415 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +171 -0
- package/src/command-line/release/version/version-actions.js +195 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +84 -262
- package/src/command-line/repair/repair.js +0 -1
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +2 -2
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/config/misc-interfaces.d.ts +11 -1
- package/src/config/nx-json.d.ts +160 -16
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.js +15 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-internals.d.ts +3 -2
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +9 -4
- package/src/executors/run-commands/running-tasks.js +103 -30
- package/src/executors/run-script/run-script.impl.js +4 -3
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/native/index.d.ts +98 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +7 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +8 -6
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.d.ts +1 -1
- package/src/plugins/package-json/create-nodes.js +4 -2
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- package/src/project-graph/nx-deps-cache.js +7 -2
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/loaded-nx-plugin.js +3 -7
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +5 -2
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
- package/src/project-graph/utils/project-configuration-utils.js +54 -21
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +3 -4
- package/src/tasks-runner/cache.d.ts +20 -6
- package/src/tasks-runner/cache.js +104 -20
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +11 -11
- package/src/tasks-runner/default-tasks-runner.js +5 -14
- package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
- package/src/tasks-runner/forked-process-task-runner.js +59 -46
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +62 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +64 -0
- package/src/tasks-runner/life-cycle.d.ts +14 -3
- package/src/tasks-runner/life-cycle.js +37 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
- package/src/tasks-runner/pseudo-terminal.js +37 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +220 -42
- package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
- package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
- package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-orchestrator.d.ts +26 -10
- package/src/tasks-runner/task-orchestrator.js +212 -57
- package/src/tasks-runner/tasks-runner.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +9 -0
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +18 -12
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/git-utils.d.ts +1 -1
- package/src/utils/git-utils.js +8 -3
- package/src/utils/handle-errors.js +15 -0
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isTuiEnabled = isTuiEnabled;
|
4
|
+
const devkit_internals_1 = require("../devkit-internals");
|
5
|
+
const is_ci_1 = require("../utils/is-ci");
|
6
|
+
let tuiEnabled = undefined;
|
7
|
+
function isTuiEnabled(nxJson, skipCapableCheck = false) {
|
8
|
+
if (tuiEnabled !== undefined) {
|
9
|
+
return tuiEnabled;
|
10
|
+
}
|
11
|
+
// If the current terminal/environment is not capable of displaying the TUI, we don't run it
|
12
|
+
const isWindows = process.platform === 'win32';
|
13
|
+
const isCapable = skipCapableCheck || (process.stderr.isTTY && isUnicodeSupported());
|
14
|
+
if (!isCapable) {
|
15
|
+
tuiEnabled = false;
|
16
|
+
process.env.NX_TUI = 'false';
|
17
|
+
return tuiEnabled;
|
18
|
+
}
|
19
|
+
// The environment variable takes precedence over the nx.json config
|
20
|
+
if (typeof process.env.NX_TUI === 'string') {
|
21
|
+
tuiEnabled = process.env.NX_TUI === 'true';
|
22
|
+
return tuiEnabled;
|
23
|
+
}
|
24
|
+
// Windows is not working well right now, temporarily disable it on Windows even if it has been specified as enabled
|
25
|
+
// TODO(@JamesHenry): Remove this check once Windows issues are fixed.
|
26
|
+
if ((0, is_ci_1.isCI)() || isWindows) {
|
27
|
+
tuiEnabled = false;
|
28
|
+
process.env.NX_TUI = 'false';
|
29
|
+
return tuiEnabled;
|
30
|
+
}
|
31
|
+
// Only read from disk if nx.json config is not already provided (and we have not been able to determine tuiEnabled based on the above checks)
|
32
|
+
if (!nxJson) {
|
33
|
+
nxJson = (0, devkit_internals_1.readNxJsonFromDisk)();
|
34
|
+
}
|
35
|
+
// Respect user config
|
36
|
+
if (typeof nxJson.tui?.enabled === 'boolean') {
|
37
|
+
tuiEnabled = Boolean(nxJson.tui?.enabled);
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
// Default to enabling the TUI if the system is capable of displaying it
|
41
|
+
tuiEnabled = true;
|
42
|
+
}
|
43
|
+
// Also set the environment variable for consistency and ease of checking on the rust side, for example
|
44
|
+
process.env.NX_TUI = tuiEnabled.toString();
|
45
|
+
return tuiEnabled;
|
46
|
+
}
|
47
|
+
// Credit to https://github.com/sindresorhus/is-unicode-supported/blob/e0373335038856c63034c8eef6ac43ee3827a601/index.js
|
48
|
+
function isUnicodeSupported() {
|
49
|
+
const { env } = process;
|
50
|
+
const { TERM, TERM_PROGRAM } = env;
|
51
|
+
if (process.platform !== 'win32') {
|
52
|
+
return TERM !== 'linux'; // Linux console (kernel)
|
53
|
+
}
|
54
|
+
return (Boolean(env.WT_SESSION) || // Windows Terminal
|
55
|
+
Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
56
|
+
env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder
|
57
|
+
TERM_PROGRAM === 'Terminus-Sublime' ||
|
58
|
+
TERM_PROGRAM === 'vscode' ||
|
59
|
+
TERM === 'xterm-256color' ||
|
60
|
+
TERM === 'alacritty' ||
|
61
|
+
TERM === 'rxvt-unicode' ||
|
62
|
+
TERM === 'rxvt-unicode-256color' ||
|
63
|
+
env.TERMINAL_EMULATOR === 'JetBrains-JediTerm');
|
64
|
+
}
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { TaskStatus } from './tasks-runner';
|
2
1
|
import { Task } from '../config/task-graph';
|
2
|
+
import { ExternalObject, TaskStatus as NativeTaskStatus } from '../native';
|
3
|
+
import { TaskStatus } from './tasks-runner';
|
3
4
|
/**
|
4
5
|
* The result of a completed {@link Task}
|
5
6
|
*/
|
@@ -17,7 +18,7 @@ export interface TaskMetadata {
|
|
17
18
|
groupId: number;
|
18
19
|
}
|
19
20
|
export interface LifeCycle {
|
20
|
-
startCommand?(): void | Promise<void>;
|
21
|
+
startCommand?(parallel?: number): void | Promise<void>;
|
21
22
|
endCommand?(): void | Promise<void>;
|
22
23
|
scheduleTask?(task: Task): void | Promise<void>;
|
23
24
|
/**
|
@@ -35,11 +36,16 @@ export interface LifeCycle {
|
|
35
36
|
startTasks?(task: Task[], metadata: TaskMetadata): void | Promise<void>;
|
36
37
|
endTasks?(taskResults: TaskResult[], metadata: TaskMetadata): void | Promise<void>;
|
37
38
|
printTaskTerminalOutput?(task: Task, status: TaskStatus, output: string): void;
|
39
|
+
registerRunningTask?(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
40
|
+
registerRunningTaskWithEmptyParser?(taskId: string): void;
|
41
|
+
appendTaskOutput?(taskId: string, output: string): void;
|
42
|
+
setTaskStatus?(taskId: string, status: NativeTaskStatus): void;
|
43
|
+
registerForcedShutdownCallback?(callback: () => void): void;
|
38
44
|
}
|
39
45
|
export declare class CompositeLifeCycle implements LifeCycle {
|
40
46
|
private readonly lifeCycles;
|
41
47
|
constructor(lifeCycles: LifeCycle[]);
|
42
|
-
startCommand(): Promise<void>;
|
48
|
+
startCommand(parallel?: number): Promise<void>;
|
43
49
|
endCommand(): Promise<void>;
|
44
50
|
scheduleTask(task: Task): Promise<void>;
|
45
51
|
startTask(task: Task): void;
|
@@ -47,4 +53,9 @@ export declare class CompositeLifeCycle implements LifeCycle {
|
|
47
53
|
startTasks(tasks: Task[], metadata: TaskMetadata): Promise<void>;
|
48
54
|
endTasks(taskResults: TaskResult[], metadata: TaskMetadata): Promise<void>;
|
49
55
|
printTaskTerminalOutput(task: Task, status: TaskStatus, output: string): void;
|
56
|
+
registerRunningTask(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
57
|
+
registerRunningTaskWithEmptyParser(taskId: string): void;
|
58
|
+
appendTaskOutput(taskId: string, output: string): void;
|
59
|
+
setTaskStatus(taskId: string, status: NativeTaskStatus): void;
|
60
|
+
registerForcedShutdownCallback(callback: () => void): void;
|
50
61
|
}
|
@@ -5,10 +5,10 @@ class CompositeLifeCycle {
|
|
5
5
|
constructor(lifeCycles) {
|
6
6
|
this.lifeCycles = lifeCycles;
|
7
7
|
}
|
8
|
-
async startCommand() {
|
8
|
+
async startCommand(parallel) {
|
9
9
|
for (let l of this.lifeCycles) {
|
10
10
|
if (l.startCommand) {
|
11
|
-
await l.startCommand();
|
11
|
+
await l.startCommand(parallel);
|
12
12
|
}
|
13
13
|
}
|
14
14
|
}
|
@@ -67,5 +67,40 @@ class CompositeLifeCycle {
|
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|
70
|
+
registerRunningTask(taskId, parserAndWriter) {
|
71
|
+
for (let l of this.lifeCycles) {
|
72
|
+
if (l.registerRunningTask) {
|
73
|
+
l.registerRunningTask(taskId, parserAndWriter);
|
74
|
+
}
|
75
|
+
}
|
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
|
+
}
|
91
|
+
setTaskStatus(taskId, status) {
|
92
|
+
for (let l of this.lifeCycles) {
|
93
|
+
if (l.setTaskStatus) {
|
94
|
+
l.setTaskStatus(taskId, status);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
registerForcedShutdownCallback(callback) {
|
99
|
+
for (let l of this.lifeCycles) {
|
100
|
+
if (l.registerForcedShutdownCallback) {
|
101
|
+
l.registerForcedShutdownCallback(callback);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
70
105
|
}
|
71
106
|
exports.CompositeLifeCycle = CompositeLifeCycle;
|
@@ -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
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.LegacyTaskHistoryLifeCycle = void 0;
|
4
|
-
const serialize_target_1 = require("../../utils/serialize-target");
|
5
|
-
const output_1 = require("../../utils/output");
|
6
4
|
const legacy_task_history_1 = require("../../utils/legacy-task-history");
|
5
|
+
const output_1 = require("../../utils/output");
|
6
|
+
const serialize_target_1 = require("../../utils/serialize-target");
|
7
|
+
const is_tui_enabled_1 = require("../is-tui-enabled");
|
7
8
|
class LegacyTaskHistoryLifeCycle {
|
8
9
|
constructor() {
|
9
10
|
this.startTimings = {};
|
@@ -30,20 +31,27 @@ class LegacyTaskHistoryLifeCycle {
|
|
30
31
|
async endCommand() {
|
31
32
|
await (0, legacy_task_history_1.writeTaskRunsToHistory)(this.taskRuns);
|
32
33
|
const history = await (0, legacy_task_history_1.getHistoryForHashes)(this.taskRuns.map((t) => t.hash));
|
33
|
-
|
34
|
+
this.flakyTasks = [];
|
34
35
|
// check if any hash has different exit codes => flaky
|
35
36
|
for (let hash in history) {
|
36
37
|
if (history[hash].length > 1 &&
|
37
38
|
history[hash].some((run) => run.code !== history[hash][0].code)) {
|
38
|
-
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));
|
39
40
|
}
|
40
41
|
}
|
41
|
-
|
42
|
+
// Do not directly print output when using the TUI
|
43
|
+
if ((0, is_tui_enabled_1.isTuiEnabled)()) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
this.printFlakyTasksMessage();
|
47
|
+
}
|
48
|
+
printFlakyTasksMessage() {
|
49
|
+
if (this.flakyTasks.length > 0) {
|
42
50
|
output_1.output.warn({
|
43
|
-
title: `Nx detected ${flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
51
|
+
title: `Nx detected ${this.flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
44
52
|
bodyLines: [
|
45
53
|
,
|
46
|
-
...flakyTasks.map((t) => ` ${t}`),
|
54
|
+
...this.flakyTasks.map((t) => ` ${t}`),
|
47
55
|
'',
|
48
56
|
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
|
49
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,14 +1,37 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TaskHistoryLifeCycle = void 0;
|
4
|
-
|
4
|
+
exports.getTasksHistoryLifeCycle = getTasksHistoryLifeCycle;
|
5
|
+
const native_1 = require("../../native");
|
5
6
|
const output_1 = require("../../utils/output");
|
7
|
+
const serialize_target_1 = require("../../utils/serialize-target");
|
6
8
|
const task_history_1 = require("../../utils/task-history");
|
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
|
+
}
|
7
26
|
class TaskHistoryLifeCycle {
|
8
27
|
constructor() {
|
9
28
|
this.startTimings = {};
|
10
29
|
this.taskRuns = new Map();
|
11
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;
|
12
35
|
}
|
13
36
|
startTasks(tasks) {
|
14
37
|
for (let task of tasks) {
|
@@ -35,13 +58,20 @@ class TaskHistoryLifeCycle {
|
|
35
58
|
return;
|
36
59
|
}
|
37
60
|
await this.taskHistory.recordTaskRuns(entries.map(([_, v]) => v));
|
38
|
-
|
39
|
-
|
61
|
+
this.flakyTasks = await this.taskHistory.getFlakyTasks(entries.map(([hash]) => hash));
|
62
|
+
// Do not directly print output when using the TUI
|
63
|
+
if ((0, is_tui_enabled_1.isTuiEnabled)()) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
this.printFlakyTasksMessage();
|
67
|
+
}
|
68
|
+
printFlakyTasksMessage() {
|
69
|
+
if (this.flakyTasks.length > 0) {
|
40
70
|
output_1.output.warn({
|
41
|
-
title: `Nx detected ${flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
71
|
+
title: `Nx detected ${this.flakyTasks.length === 1 ? 'a flaky task' : ' flaky tasks'}`,
|
42
72
|
bodyLines: [
|
43
73
|
,
|
44
|
-
...flakyTasks.map((hash) => {
|
74
|
+
...this.flakyTasks.map((hash) => {
|
45
75
|
const taskRun = this.taskRuns.get(hash);
|
46
76
|
return ` ${(0, serialize_target_1.serializeTarget)(taskRun.target.project, taskRun.target.target, taskRun.target.configuration)}`;
|
47
77
|
}),
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Task } from '../../config/task-graph';
|
2
|
+
import type { LifeCycle } from '../life-cycle';
|
3
|
+
export declare function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides, initiatingProject, initiatingTasks, resolveRenderIsDonePromise, }: {
|
4
|
+
projectNames: string[];
|
5
|
+
tasks: Task[];
|
6
|
+
args: {
|
7
|
+
targets?: string[];
|
8
|
+
configuration?: string;
|
9
|
+
parallel?: number;
|
10
|
+
};
|
11
|
+
overrides: Record<string, unknown>;
|
12
|
+
initiatingProject: string;
|
13
|
+
initiatingTasks: Task[];
|
14
|
+
resolveRenderIsDonePromise: (value: void) => void;
|
15
|
+
}): {
|
16
|
+
lifeCycle: Partial<LifeCycle>;
|
17
|
+
printSummary: () => void;
|
18
|
+
};
|
@@ -0,0 +1,229 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getTuiTerminalSummaryLifeCycle = getTuiTerminalSummaryLifeCycle;
|
4
|
+
const node_os_1 = require("node:os");
|
5
|
+
const output_1 = require("../../utils/output");
|
6
|
+
const formatting_utils_1 = require("./formatting-utils");
|
7
|
+
const pretty_time_1 = require("./pretty-time");
|
8
|
+
const view_logs_utils_1 = require("./view-logs-utils");
|
9
|
+
const figures = require("figures");
|
10
|
+
const task_history_life_cycle_1 = require("./task-history-life-cycle");
|
11
|
+
const LEFT_PAD = ` `;
|
12
|
+
const SPACER = ` `;
|
13
|
+
const EXTENDED_LEFT_PAD = ` `;
|
14
|
+
function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, args, overrides, initiatingProject, initiatingTasks, resolveRenderIsDonePromise, }) {
|
15
|
+
const lifeCycle = {};
|
16
|
+
const start = process.hrtime();
|
17
|
+
const targets = args.targets;
|
18
|
+
const totalTasks = tasks.length;
|
19
|
+
let totalCachedTasks = 0;
|
20
|
+
let totalSuccessfulTasks = 0;
|
21
|
+
let totalFailedTasks = 0;
|
22
|
+
let totalCompletedTasks = 0;
|
23
|
+
let totalStoppedTasks = 0;
|
24
|
+
let timeTakenText;
|
25
|
+
const failedTasks = new Set();
|
26
|
+
const inProgressTasks = new Set();
|
27
|
+
const tasksToTerminalOutputs = {};
|
28
|
+
const taskIdsInOrderOfCompletion = [];
|
29
|
+
lifeCycle.startTasks = (tasks) => {
|
30
|
+
for (let t of tasks) {
|
31
|
+
inProgressTasks.add(t.id);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
lifeCycle.printTaskTerminalOutput = (task, taskStatus, terminalOutput) => {
|
35
|
+
taskIdsInOrderOfCompletion.push(task.id);
|
36
|
+
tasksToTerminalOutputs[task.id] = { terminalOutput, taskStatus };
|
37
|
+
};
|
38
|
+
lifeCycle.setTaskStatus = (taskId, taskStatus) => {
|
39
|
+
if (taskStatus === 9 /* NativeTaskStatus.Stopped */) {
|
40
|
+
totalStoppedTasks++;
|
41
|
+
}
|
42
|
+
};
|
43
|
+
lifeCycle.endTasks = (taskResults) => {
|
44
|
+
for (const { task, status } of taskResults) {
|
45
|
+
totalCompletedTasks++;
|
46
|
+
inProgressTasks.delete(task.id);
|
47
|
+
switch (status) {
|
48
|
+
case 'remote-cache':
|
49
|
+
case 'local-cache':
|
50
|
+
case 'local-cache-kept-existing':
|
51
|
+
totalCachedTasks++;
|
52
|
+
totalSuccessfulTasks++;
|
53
|
+
break;
|
54
|
+
case 'success':
|
55
|
+
totalSuccessfulTasks++;
|
56
|
+
break;
|
57
|
+
case 'failure':
|
58
|
+
totalFailedTasks++;
|
59
|
+
failedTasks.add(task.id);
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
};
|
64
|
+
lifeCycle.endCommand = () => {
|
65
|
+
timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(start));
|
66
|
+
resolveRenderIsDonePromise();
|
67
|
+
};
|
68
|
+
const printSummary = () => {
|
69
|
+
const isRunOne = initiatingProject && targets?.length === 1;
|
70
|
+
// Handles when the user interrupts the process
|
71
|
+
timeTakenText ??= (0, pretty_time_1.prettyTime)(process.hrtime(start));
|
72
|
+
if (totalTasks === 0) {
|
73
|
+
console.log(`\n${output_1.output.applyNxPrefix('gray', 'No tasks were run')}\n`);
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
if (isRunOne) {
|
77
|
+
printRunOneSummary();
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
printRunManySummary();
|
81
|
+
}
|
82
|
+
(0, task_history_life_cycle_1.getTasksHistoryLifeCycle)()?.printFlakyTasksMessage();
|
83
|
+
};
|
84
|
+
const printRunOneSummary = () => {
|
85
|
+
let lines = [];
|
86
|
+
const failure = totalSuccessfulTasks + totalStoppedTasks !== totalTasks;
|
87
|
+
// Prints task outputs in the order they were completed
|
88
|
+
// above the summary, since run-one should print all task results.
|
89
|
+
for (const taskId of taskIdsInOrderOfCompletion) {
|
90
|
+
const { terminalOutput, taskStatus } = tasksToTerminalOutputs[taskId];
|
91
|
+
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
92
|
+
}
|
93
|
+
lines.push(...output_1.output.getVerticalSeparatorLines(failure ? 'red' : 'green'));
|
94
|
+
if (!failure) {
|
95
|
+
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)([initiatingProject], targets, tasks)}`;
|
96
|
+
const taskOverridesLines = [];
|
97
|
+
if (Object.keys(overrides).length > 0) {
|
98
|
+
taskOverridesLines.push('');
|
99
|
+
taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
100
|
+
Object.entries(overrides)
|
101
|
+
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
102
|
+
.forEach((arg) => taskOverridesLines.push(arg));
|
103
|
+
}
|
104
|
+
lines.push(output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim(` (${timeTakenText})`)), ...taskOverridesLines);
|
105
|
+
if (totalCachedTasks > 0) {
|
106
|
+
lines.push(output_1.output.dim(`${node_os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
107
|
+
}
|
108
|
+
lines = [output_1.output.colors.green(lines.join(node_os_1.EOL))];
|
109
|
+
}
|
110
|
+
else if (totalCompletedTasks + totalStoppedTasks === totalTasks) {
|
111
|
+
let text = `Ran target ${output_1.output.bold(targets[0])} for project ${output_1.output.bold(initiatingProject)}`;
|
112
|
+
if (tasks.length > 1) {
|
113
|
+
text += ` and ${output_1.output.bold(tasks.length - 1)} task(s) they depend on`;
|
114
|
+
}
|
115
|
+
const taskOverridesLines = [];
|
116
|
+
if (Object.keys(overrides).length > 0) {
|
117
|
+
taskOverridesLines.push('');
|
118
|
+
taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
119
|
+
Object.entries(overrides)
|
120
|
+
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
121
|
+
.forEach((arg) => taskOverridesLines.push(arg));
|
122
|
+
}
|
123
|
+
const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
|
124
|
+
lines = [
|
125
|
+
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
|
+
]),
|
133
|
+
];
|
134
|
+
}
|
135
|
+
else {
|
136
|
+
lines = [
|
137
|
+
...output_1.output.getVerticalSeparatorLines('red'),
|
138
|
+
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})`)),
|
139
|
+
];
|
140
|
+
}
|
141
|
+
// adds some vertical space after the summary to avoid bunching against terminal
|
142
|
+
lines.push('');
|
143
|
+
console.log(lines.join(node_os_1.EOL));
|
144
|
+
};
|
145
|
+
const printRunManySummary = () => {
|
146
|
+
console.log('');
|
147
|
+
const lines = [];
|
148
|
+
const failure = totalSuccessfulTasks + totalStoppedTasks !== totalTasks;
|
149
|
+
for (const taskId of taskIdsInOrderOfCompletion) {
|
150
|
+
const { terminalOutput, taskStatus } = tasksToTerminalOutputs[taskId];
|
151
|
+
if (taskStatus === 'failure') {
|
152
|
+
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
153
|
+
lines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
lines.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
157
|
+
}
|
158
|
+
}
|
159
|
+
lines.push(...output_1.output.getVerticalSeparatorLines(failure ? 'red' : 'green'));
|
160
|
+
if (totalSuccessfulTasks + totalStoppedTasks === totalTasks) {
|
161
|
+
const successSummaryRows = [];
|
162
|
+
const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
163
|
+
const taskOverridesRows = [];
|
164
|
+
if (Object.keys(overrides).length > 0) {
|
165
|
+
taskOverridesRows.push('');
|
166
|
+
taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
|
167
|
+
Object.entries(overrides)
|
168
|
+
.map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
169
|
+
.forEach((arg) => taskOverridesRows.push(arg));
|
170
|
+
}
|
171
|
+
successSummaryRows.push(...[
|
172
|
+
output_1.output.applyNxPrefix('green', output_1.output.colors.green(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
173
|
+
...taskOverridesRows,
|
174
|
+
]);
|
175
|
+
if (totalCachedTasks > 0) {
|
176
|
+
successSummaryRows.push(output_1.output.dim(`${node_os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
|
177
|
+
}
|
178
|
+
lines.push(successSummaryRows.join(node_os_1.EOL));
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
const text = `${inProgressTasks.size ? 'Cancelled while running' : 'Ran'} ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
|
182
|
+
const taskOverridesRows = [];
|
183
|
+
if (Object.keys(overrides).length > 0) {
|
184
|
+
taskOverridesRows.push('');
|
185
|
+
taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
|
186
|
+
Object.entries(overrides)
|
187
|
+
.map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
|
188
|
+
.forEach((arg) => taskOverridesRows.push(arg));
|
189
|
+
}
|
190
|
+
const numFailedToPrint = 5;
|
191
|
+
const failedTasksForPrinting = Array.from(failedTasks).slice(0, numFailedToPrint);
|
192
|
+
const failureSummaryRows = [
|
193
|
+
output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
|
194
|
+
...taskOverridesRows,
|
195
|
+
'',
|
196
|
+
];
|
197
|
+
if (totalCompletedTasks > 0) {
|
198
|
+
if (totalSuccessfulTasks > 0) {
|
199
|
+
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`), '');
|
200
|
+
}
|
201
|
+
if (totalFailedTasks > 0) {
|
202
|
+
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`, '', `${failedTasksForPrinting
|
203
|
+
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
204
|
+
.join('\n')}`, '');
|
205
|
+
if (failedTasks.size > numFailedToPrint) {
|
206
|
+
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
207
|
+
}
|
208
|
+
}
|
209
|
+
if (totalCompletedTasks !== totalTasks) {
|
210
|
+
const remainingTasks = totalTasks - totalCompletedTasks;
|
211
|
+
if (inProgressTasks.size) {
|
212
|
+
failureSummaryRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${inProgressTasks.size}${`/${totalTasks}`} targets were in progress, including the following:`, '', `${Array.from(inProgressTasks)
|
213
|
+
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
214
|
+
.join(node_os_1.EOL)}`, '');
|
215
|
+
}
|
216
|
+
if (remainingTasks - inProgressTasks.size > 0) {
|
217
|
+
failureSummaryRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.ellipsis)}${SPACER}${remainingTasks - inProgressTasks.size}${`/${totalTasks}`} targets had not started.`), '');
|
218
|
+
}
|
219
|
+
}
|
220
|
+
failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
|
221
|
+
lines.push(output_1.output.colors.red(failureSummaryRows.join(node_os_1.EOL)));
|
222
|
+
}
|
223
|
+
}
|
224
|
+
// adds some vertical space after the summary to avoid bunching against terminal
|
225
|
+
lines.push('');
|
226
|
+
console.log(lines.join(node_os_1.EOL));
|
227
|
+
};
|
228
|
+
return { lifeCycle, printSummary };
|
229
|
+
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import { Serializable } from 'child_process';
|
1
2
|
import { ChildProcess, RustPseudoTerminal } from '../native';
|
2
3
|
import { PseudoIPCServer } from './pseudo-ipc';
|
3
|
-
import {
|
4
|
-
export declare function
|
4
|
+
import { RunningTask } from './running-tasks/running-task';
|
5
|
+
export declare function createPseudoTerminal(skipSupportCheck?: boolean): PseudoTerminal;
|
5
6
|
export declare class PseudoTerminal {
|
6
7
|
private rustPseudoTerminal;
|
7
8
|
private pseudoIPCPath;
|
@@ -10,6 +11,7 @@ export declare class PseudoTerminal {
|
|
10
11
|
static isSupported(): boolean;
|
11
12
|
constructor(rustPseudoTerminal: RustPseudoTerminal);
|
12
13
|
init(): Promise<void>;
|
14
|
+
shutdown(): void;
|
13
15
|
runCommand(command: string, { cwd, execArgv, jsEnv, quiet, tty, }?: {
|
14
16
|
cwd?: string;
|
15
17
|
execArgv?: string[];
|
@@ -25,16 +27,15 @@ export declare class PseudoTerminal {
|
|
25
27
|
}): Promise<PseudoTtyProcessWithSend>;
|
26
28
|
sendMessageToChildren(message: Serializable): void;
|
27
29
|
onMessageFromChildren(callback: (message: Serializable) => void): void;
|
28
|
-
private setupProcessListeners;
|
29
|
-
private shutdownPseudoIPC;
|
30
30
|
}
|
31
|
-
export declare class PseudoTtyProcess {
|
31
|
+
export declare class PseudoTtyProcess implements RunningTask {
|
32
|
+
rustPseudoTerminal: RustPseudoTerminal;
|
32
33
|
private childProcess;
|
33
34
|
isAlive: boolean;
|
34
35
|
private exitCallbacks;
|
35
36
|
private outputCallbacks;
|
36
37
|
private terminalOutput;
|
37
|
-
constructor(childProcess: ChildProcess);
|
38
|
+
constructor(rustPseudoTerminal: RustPseudoTerminal, childProcess: ChildProcess);
|
38
39
|
getResults(): Promise<{
|
39
40
|
code: number;
|
40
41
|
terminalOutput: string;
|
@@ -42,10 +43,12 @@ export declare class PseudoTtyProcess {
|
|
42
43
|
onExit(callback: (code: number) => void): void;
|
43
44
|
onOutput(callback: (message: string) => void): void;
|
44
45
|
kill(): void;
|
46
|
+
getParserAndWriter(): import("../native").ExternalObject<[ParserArc, WriterArc]>;
|
45
47
|
}
|
46
48
|
export declare class PseudoTtyProcessWithSend extends PseudoTtyProcess {
|
49
|
+
rustPseudoTerminal: RustPseudoTerminal;
|
47
50
|
private id;
|
48
51
|
private pseudoIpc;
|
49
|
-
constructor(_childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer);
|
52
|
+
constructor(rustPseudoTerminal: RustPseudoTerminal, _childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer);
|
50
53
|
send(message: Serializable): void;
|
51
54
|
}
|