nx 21.0.0-beta.1 → 21.0.0-beta.11
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 +15 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +187 -35
- package/schemas/project-schema.json +5 -0
- package/src/adapter/angular-json.js +11 -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 +23 -4
- package/src/command-line/migrate/migrate.js +138 -86
- 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 +8 -3
- 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 +20 -2
- package/src/config/nx-json.d.ts +158 -18
- 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-exports.d.ts +1 -1
- 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-21-0-0/release-version-config-changes.d.ts +2 -0
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/migrations/update-21-0-0/remove-custom-tasks-runner.d.ts +2 -0
- package/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +38 -0
- package/src/migrations/{update-18-0-0/disable-crystal-for-existing-workspaces.js → update-21-0-0/remove-legacy-cache.js} +10 -4
- 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/index.d.ts +2 -1
- package/src/plugins/js/index.js +8 -1
- 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/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 +1 -5
- 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 +1 -1
- 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 +4 -5
- package/src/tasks-runner/cache.d.ts +21 -8
- package/src/tasks-runner/cache.js +106 -38
- 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 +230 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +11 -7
- package/src/tasks-runner/pseudo-terminal.js +47 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +219 -63
- 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-graph-utils.d.ts +3 -0
- package/src/tasks-runner/task-graph-utils.js +31 -2
- package/src/tasks-runner/task-orchestrator.d.ts +26 -10
- package/src/tasks-runner/task-orchestrator.js +221 -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/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
- /package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/remove-legacy-cache.d.ts} +0 -0
@@ -1,6 +1,5 @@
|
|
1
1
|
import { DefaultTasksRunnerOptions, RemoteCache } from './default-tasks-runner';
|
2
2
|
import { Task } from '../config/task-graph';
|
3
|
-
import { NxJsonConfiguration } from '../config/nx-json';
|
4
3
|
export type CachedResult = {
|
5
4
|
terminalOutput: string;
|
6
5
|
outputsPath: string;
|
@@ -11,10 +10,11 @@ export type TaskWithCachedResult = {
|
|
11
10
|
task: Task;
|
12
11
|
cachedResult: CachedResult;
|
13
12
|
};
|
14
|
-
export declare function dbCacheEnabled(
|
13
|
+
export declare function dbCacheEnabled(): boolean;
|
15
14
|
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
16
15
|
export declare class DbCache {
|
17
16
|
private readonly options;
|
17
|
+
private nxJson;
|
18
18
|
private cache;
|
19
19
|
private remoteCache;
|
20
20
|
private remoteCachePromise;
|
@@ -25,18 +25,20 @@ export declare class DbCache {
|
|
25
25
|
});
|
26
26
|
init(): Promise<void>;
|
27
27
|
get(task: Task): Promise<CachedResult | null>;
|
28
|
+
getUsedCacheSpace(): number;
|
28
29
|
private applyRemoteCacheResults;
|
29
30
|
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
|
30
|
-
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<
|
31
|
+
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<number>;
|
31
32
|
removeOldCacheRecords(): void;
|
32
33
|
temporaryOutputPath(task: Task): string;
|
33
34
|
private getRemoteCache;
|
34
35
|
private _getRemoteCache;
|
35
|
-
private
|
36
|
-
private
|
37
|
-
private
|
38
|
-
private
|
39
|
-
private
|
36
|
+
private getS3Cache;
|
37
|
+
private getSharedCache;
|
38
|
+
private getGcsCache;
|
39
|
+
private getAzureCache;
|
40
|
+
private getHttpCache;
|
41
|
+
private resolveRemoteCache;
|
40
42
|
private resolvePackage;
|
41
43
|
private assertCacheIsValid;
|
42
44
|
}
|
@@ -66,3 +68,14 @@ export declare class Cache {
|
|
66
68
|
private createCacheDir;
|
67
69
|
private createTerminalOutputsDir;
|
68
70
|
}
|
71
|
+
/**
|
72
|
+
* Converts a string representation of a max cache size to a number.
|
73
|
+
*
|
74
|
+
* e.g. '1GB' -> 1024 * 1024 * 1024
|
75
|
+
* '1MB' -> 1024 * 1024
|
76
|
+
* '1KB' -> 1024
|
77
|
+
*
|
78
|
+
* @param maxCacheSize Max cache size as specified in nx.json
|
79
|
+
*/
|
80
|
+
export declare function parseMaxCacheSize(maxCacheSize: string | number): number | undefined;
|
81
|
+
export declare function formatCacheSize(maxCacheSize: number, decimals?: number): string;
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cache = exports.DbCache = void 0;
|
4
4
|
exports.dbCacheEnabled = dbCacheEnabled;
|
5
5
|
exports.getCache = getCache;
|
6
|
+
exports.parseMaxCacheSize = parseMaxCacheSize;
|
7
|
+
exports.formatCacheSize = formatCacheSize;
|
6
8
|
const workspace_root_1 = require("../utils/workspace-root");
|
7
9
|
const path_1 = require("path");
|
8
10
|
const perf_hooks_1 = require("perf_hooks");
|
@@ -22,23 +24,7 @@ const is_ci_1 = require("../utils/is-ci");
|
|
22
24
|
const output_1 = require("../utils/output");
|
23
25
|
const logger_1 = require("../utils/logger");
|
24
26
|
// This function is called once during tasks runner initialization. It checks if the db cache is enabled and logs a warning if it is not.
|
25
|
-
function dbCacheEnabled(
|
26
|
-
// If the user has explicitly disabled the db cache, we can warn...
|
27
|
-
if (nxJson.useLegacyCache ||
|
28
|
-
process.env.NX_DISABLE_DB === 'true' ||
|
29
|
-
process.env.NX_DB_CACHE === 'false') {
|
30
|
-
let readMoreLink = 'https://nx.dev/deprecated/legacy-cache';
|
31
|
-
if (nxJson.tasksRunnerOptions?.default?.runner &&
|
32
|
-
!['nx-cloud', 'nx/tasks-runners/default', '@nrwl/nx-cloud'].includes(nxJson.tasksRunnerOptions.default.runner)) {
|
33
|
-
readMoreLink += '#tasksrunneroptions';
|
34
|
-
}
|
35
|
-
else if (process.env.NX_REJECT_UNKNOWN_LOCAL_CACHE === '0' ||
|
36
|
-
process.env.NX_REJECT_UNKNOWN_LOCAL_CACHE === 'false') {
|
37
|
-
readMoreLink += '#nxrejectunknownlocalcache';
|
38
|
-
}
|
39
|
-
logger_1.logger.warn(`Nx is configured to use the legacy cache. This cache will be removed in Nx 21. Read more at ${readMoreLink}.`);
|
40
|
-
return false;
|
41
|
-
}
|
27
|
+
function dbCacheEnabled() {
|
42
28
|
// ...but if on wasm and the the db cache isnt supported we shouldn't warn
|
43
29
|
if (native_1.IS_WASM) {
|
44
30
|
return false;
|
@@ -57,7 +43,7 @@ function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
|
|
57
43
|
// Do not change the order of these arguments as this function is used by nx cloud
|
58
44
|
function getCache(options) {
|
59
45
|
const nxJson = (0, nx_json_1.readNxJson)();
|
60
|
-
return dbCacheEnabled(
|
46
|
+
return dbCacheEnabled()
|
61
47
|
? new DbCache({
|
62
48
|
// Remove this in Nx 21
|
63
49
|
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
|
@@ -68,7 +54,10 @@ function getCache(options) {
|
|
68
54
|
class DbCache {
|
69
55
|
constructor(options) {
|
70
56
|
this.options = options;
|
71
|
-
this.
|
57
|
+
this.nxJson = (0, nx_json_1.readNxJson)();
|
58
|
+
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)(), undefined, this.nxJson.maxCacheSize !== undefined
|
59
|
+
? parseMaxCacheSize(this.nxJson.maxCacheSize)
|
60
|
+
: (0, native_1.getDefaultMaxCacheSize)(cache_directory_1.cacheDir));
|
72
61
|
this.isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
73
62
|
}
|
74
63
|
async init() {
|
@@ -83,6 +72,7 @@ class DbCache {
|
|
83
72
|
if (res) {
|
84
73
|
return {
|
85
74
|
...res,
|
75
|
+
terminalOutput: res.terminalOutput ?? '',
|
86
76
|
remote: false,
|
87
77
|
};
|
88
78
|
}
|
@@ -91,9 +81,10 @@ class DbCache {
|
|
91
81
|
// attempt remote cache
|
92
82
|
const res = await this.remoteCache.retrieve(task.hash, this.cache.cacheDirectory);
|
93
83
|
if (res) {
|
94
|
-
this.applyRemoteCacheResults(task.hash, res);
|
84
|
+
this.applyRemoteCacheResults(task.hash, res, task.outputs);
|
95
85
|
return {
|
96
86
|
...res,
|
87
|
+
terminalOutput: res.terminalOutput ?? '',
|
97
88
|
remote: true,
|
98
89
|
};
|
99
90
|
}
|
@@ -105,8 +96,11 @@ class DbCache {
|
|
105
96
|
return null;
|
106
97
|
}
|
107
98
|
}
|
108
|
-
|
109
|
-
return this.cache.
|
99
|
+
getUsedCacheSpace() {
|
100
|
+
return this.cache.getCacheSize();
|
101
|
+
}
|
102
|
+
applyRemoteCacheResults(hash, res, outputs) {
|
103
|
+
return this.cache.applyRemoteCacheResults(hash, res, outputs);
|
110
104
|
}
|
111
105
|
async put(task, terminalOutput, outputs, code) {
|
112
106
|
return tryAndRetry(async () => {
|
@@ -155,26 +149,49 @@ class DbCache {
|
|
155
149
|
}
|
156
150
|
}
|
157
151
|
else {
|
158
|
-
return ((await this.
|
159
|
-
(await this.
|
160
|
-
(await this.
|
161
|
-
(await this.
|
152
|
+
return ((await this.getS3Cache()) ??
|
153
|
+
(await this.getSharedCache()) ??
|
154
|
+
(await this.getGcsCache()) ??
|
155
|
+
(await this.getAzureCache()) ??
|
156
|
+
this.getHttpCache() ??
|
162
157
|
null);
|
163
158
|
}
|
164
159
|
}
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
return this.
|
170
|
-
}
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
return this.
|
160
|
+
async getS3Cache() {
|
161
|
+
const cache = await this.resolveRemoteCache('@nx/s3-cache');
|
162
|
+
if (cache)
|
163
|
+
return cache;
|
164
|
+
return this.resolveRemoteCache('@nx/powerpack-s3-cache');
|
165
|
+
}
|
166
|
+
async getSharedCache() {
|
167
|
+
const cache = await this.resolveRemoteCache('@nx/shared-fs-cache');
|
168
|
+
if (cache)
|
169
|
+
return cache;
|
170
|
+
return this.resolveRemoteCache('@nx/powerpack-shared-fs-cache');
|
171
|
+
}
|
172
|
+
async getGcsCache() {
|
173
|
+
const cache = await this.resolveRemoteCache('@nx/gcs-cache');
|
174
|
+
if (cache)
|
175
|
+
return cache;
|
176
|
+
return this.resolveRemoteCache('@nx/powerpack-gcs-cache');
|
177
|
+
}
|
178
|
+
async getAzureCache() {
|
179
|
+
const cache = await this.resolveRemoteCache('@nx/azure-cache');
|
180
|
+
if (cache)
|
181
|
+
return cache;
|
182
|
+
return this.resolveRemoteCache('@nx/powerpack-azure-cache');
|
183
|
+
}
|
184
|
+
getHttpCache() {
|
185
|
+
if (process.env.NX_SELF_HOSTED_REMOTE_CACHE_SERVER) {
|
186
|
+
if (native_1.IS_WASM) {
|
187
|
+
logger_1.logger.warn('The HTTP remote cache is not yet supported in the wasm build of Nx.');
|
188
|
+
return null;
|
189
|
+
}
|
190
|
+
return new native_1.HttpRemoteCache();
|
191
|
+
}
|
192
|
+
return null;
|
176
193
|
}
|
177
|
-
async
|
194
|
+
async resolveRemoteCache(pkg) {
|
178
195
|
let getRemoteCache = null;
|
179
196
|
try {
|
180
197
|
getRemoteCache = (await Promise.resolve(`${this.resolvePackage(pkg)}`).then(s => require(s))).getRemoteCache;
|
@@ -455,3 +472,54 @@ function tryAndRetry(fn) {
|
|
455
472
|
};
|
456
473
|
return _try();
|
457
474
|
}
|
475
|
+
/**
|
476
|
+
* Converts a string representation of a max cache size to a number.
|
477
|
+
*
|
478
|
+
* e.g. '1GB' -> 1024 * 1024 * 1024
|
479
|
+
* '1MB' -> 1024 * 1024
|
480
|
+
* '1KB' -> 1024
|
481
|
+
*
|
482
|
+
* @param maxCacheSize Max cache size as specified in nx.json
|
483
|
+
*/
|
484
|
+
function parseMaxCacheSize(maxCacheSize) {
|
485
|
+
if (maxCacheSize === null || maxCacheSize === undefined) {
|
486
|
+
return undefined;
|
487
|
+
}
|
488
|
+
let regexResult = maxCacheSize
|
489
|
+
// Covers folks who accidentally specify as a number rather than a string
|
490
|
+
.toString()
|
491
|
+
// Match a number followed by an optional unit (KB, MB, GB), with optional whitespace between the number and unit
|
492
|
+
.match(/^(?<size>[\d|.]+)\s?((?<unit>[KMG]?B)?)$/);
|
493
|
+
if (!regexResult) {
|
494
|
+
throw new Error(`Invalid max cache size specified in nx.json: ${maxCacheSize}. Must be a number followed by an optional unit (KB, MB, GB)`);
|
495
|
+
}
|
496
|
+
let sizeString = regexResult.groups.size;
|
497
|
+
let unit = regexResult.groups.unit;
|
498
|
+
if ([...sizeString].filter((c) => c === '.').length > 1) {
|
499
|
+
throw new Error(`Invalid max cache size specified in nx.json: ${maxCacheSize} (multiple decimal points in size)`);
|
500
|
+
}
|
501
|
+
let size = parseFloat(sizeString);
|
502
|
+
if (isNaN(size)) {
|
503
|
+
throw new Error(`Invalid max cache size specified in nx.json: ${maxCacheSize} (${sizeString} is not a number)`);
|
504
|
+
}
|
505
|
+
switch (unit) {
|
506
|
+
case 'KB':
|
507
|
+
return size * 1024;
|
508
|
+
case 'MB':
|
509
|
+
return size * 1024 * 1024;
|
510
|
+
case 'GB':
|
511
|
+
return size * 1024 * 1024 * 1024;
|
512
|
+
default:
|
513
|
+
return size;
|
514
|
+
}
|
515
|
+
}
|
516
|
+
function formatCacheSize(maxCacheSize, decimals = 2) {
|
517
|
+
const exponents = ['B', 'KB', 'MB', 'GB'];
|
518
|
+
let exponent = 0;
|
519
|
+
let size = maxCacheSize;
|
520
|
+
while (size >= 1024 && exponent < exponents.length - 1) {
|
521
|
+
size /= 1024;
|
522
|
+
exponent++;
|
523
|
+
}
|
524
|
+
return `${size.toFixed(decimals)} ${exponents[exponent]}`;
|
525
|
+
}
|
@@ -24,7 +24,6 @@ export declare class ProcessTasks {
|
|
24
24
|
private createDummyTask;
|
25
25
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
|
26
26
|
resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
|
27
|
-
getId(project: string, target: string, configuration: string | undefined): string;
|
28
27
|
}
|
29
28
|
export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Object, excludeTaskDependencies?: boolean): TaskGraph;
|
30
29
|
export declare function mapTargetDefaultsToDependencies(defaults: TargetDefaults | undefined): TargetDependencies;
|
@@ -33,7 +33,7 @@ class ProcessTasks {
|
|
33
33
|
const project = this.projectGraph.nodes[projectName];
|
34
34
|
if (targets.length === 1 || project.data.targets[target]) {
|
35
35
|
const resolvedConfiguration = this.resolveConfiguration(project, target, configuration);
|
36
|
-
const id =
|
36
|
+
const id = createTaskId(projectName, target, resolvedConfiguration);
|
37
37
|
const task = this.createTask(id, project, target, resolvedConfiguration, overrides);
|
38
38
|
this.tasks[task.id] = task;
|
39
39
|
this.dependencies[task.id] = [];
|
@@ -120,7 +120,7 @@ class ProcessTasks {
|
|
120
120
|
const selfProject = this.projectGraph.nodes[projectName];
|
121
121
|
if ((0, project_graph_utils_1.projectHasTarget)(selfProject, dependencyConfig.target)) {
|
122
122
|
const resolvedConfiguration = this.resolveConfiguration(selfProject, dependencyConfig.target, configuration);
|
123
|
-
const selfTaskId =
|
123
|
+
const selfTaskId = createTaskId(selfProject.name, dependencyConfig.target, resolvedConfiguration);
|
124
124
|
if (!this.tasks[selfTaskId]) {
|
125
125
|
const newTask = this.createTask(selfTaskId, selfProject, dependencyConfig.target, resolvedConfiguration, taskOverrides);
|
126
126
|
this.tasks[selfTaskId] = newTask;
|
@@ -149,7 +149,7 @@ class ProcessTasks {
|
|
149
149
|
continue;
|
150
150
|
if ((0, project_graph_utils_1.projectHasTarget)(depProject, dependencyConfig.target)) {
|
151
151
|
const resolvedConfiguration = this.resolveConfiguration(depProject, dependencyConfig.target, configuration);
|
152
|
-
const depTargetId =
|
152
|
+
const depTargetId = createTaskId(depProject.name, dependencyConfig.target, resolvedConfiguration);
|
153
153
|
const depTargetConfiguration = this.projectGraph.nodes[depProject.name].data.targets[dependencyConfig.target];
|
154
154
|
if (task.id !== depTargetId) {
|
155
155
|
if (depTargetConfiguration.continuous) {
|
@@ -169,7 +169,7 @@ class ProcessTasks {
|
|
169
169
|
}
|
170
170
|
else {
|
171
171
|
// Create a dummy task for task.target.project... which simulates if depProject had dependencyConfig.target
|
172
|
-
const dummyId =
|
172
|
+
const dummyId = createTaskId(depProject.name, task.target.project +
|
173
173
|
'__' +
|
174
174
|
dependencyConfig.target +
|
175
175
|
DUMMY_TASK_TARGET, undefined);
|
@@ -218,13 +218,6 @@ class ProcessTasks {
|
|
218
218
|
? configuration
|
219
219
|
: defaultConfiguration;
|
220
220
|
}
|
221
|
-
getId(project, target, configuration) {
|
222
|
-
let id = `${project}:${target}`;
|
223
|
-
if (configuration) {
|
224
|
-
id += `:${configuration}`;
|
225
|
-
}
|
226
|
-
return id;
|
227
|
-
}
|
228
221
|
}
|
229
222
|
exports.ProcessTasks = ProcessTasks;
|
230
223
|
function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
@@ -299,3 +292,10 @@ function getNonDummyDeps(currentTask, dependencies, cycles, seen = new Set()) {
|
|
299
292
|
return [currentTask];
|
300
293
|
}
|
301
294
|
}
|
295
|
+
function createTaskId(project, target, configuration) {
|
296
|
+
let id = `${project}:${target}`;
|
297
|
+
if (configuration) {
|
298
|
+
id += `:${configuration}`;
|
299
|
+
}
|
300
|
+
return id;
|
301
|
+
}
|
@@ -54,27 +54,18 @@ class RemoteCacheV2 {
|
|
54
54
|
}
|
55
55
|
exports.RemoteCacheV2 = RemoteCacheV2;
|
56
56
|
const defaultTasksRunner = async (tasks, options, context) => {
|
57
|
-
|
58
|
-
|
59
|
-
options['parallel'] = 1;
|
60
|
-
}
|
61
|
-
else if (options['parallel'] === 'true' ||
|
62
|
-
options['parallel'] === true ||
|
63
|
-
options['parallel'] === undefined ||
|
64
|
-
options['parallel'] === '') {
|
65
|
-
options['parallel'] = Number(options['maxParallel'] || 3);
|
66
|
-
}
|
67
|
-
await options.lifeCycle.startCommand();
|
57
|
+
const threadCount = (0, task_orchestrator_1.getThreadCount)(options, context.taskGraph);
|
58
|
+
await options.lifeCycle.startCommand(threadCount);
|
68
59
|
try {
|
69
|
-
return await runAllTasks(
|
60
|
+
return await runAllTasks(options, context);
|
70
61
|
}
|
71
62
|
finally {
|
72
63
|
await options.lifeCycle.endCommand();
|
73
64
|
}
|
74
65
|
};
|
75
66
|
exports.defaultTasksRunner = defaultTasksRunner;
|
76
|
-
async function runAllTasks(
|
77
|
-
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.projectGraph, context.taskGraph, context.nxJson, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.outputStyle);
|
67
|
+
async function runAllTasks(options, context) {
|
68
|
+
const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.initiatingTasks, context.projectGraph, context.taskGraph, context.nxJson, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.outputStyle);
|
78
69
|
return orchestrator.run();
|
79
70
|
}
|
80
71
|
exports.default = exports.defaultTasksRunner;
|
@@ -2,17 +2,21 @@ import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
|
2
2
|
import { Batch } from './tasks-schedule';
|
3
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
4
4
|
import { PseudoTtyProcess } from './pseudo-terminal';
|
5
|
+
import { ProjectGraph } from '../config/project-graph';
|
5
6
|
import { BatchProcess } from './running-tasks/batch-process';
|
6
7
|
import { RunningTask } from './running-tasks/running-task';
|
7
8
|
export declare class ForkedProcessTaskRunner {
|
8
9
|
private readonly options;
|
10
|
+
private readonly tuiEnabled;
|
9
11
|
cliPath: string;
|
10
12
|
private readonly verbose;
|
11
13
|
private processes;
|
12
|
-
private
|
13
|
-
|
14
|
+
private finishedProcesses;
|
15
|
+
private pseudoTerminals;
|
16
|
+
constructor(options: DefaultTasksRunnerOptions, tuiEnabled: boolean);
|
14
17
|
init(): Promise<void>;
|
15
|
-
forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }: Batch, fullTaskGraph: TaskGraph, env: NodeJS.ProcessEnv): Promise<BatchProcess>;
|
18
|
+
forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }: Batch, projectGraph: ProjectGraph, fullTaskGraph: TaskGraph, env: NodeJS.ProcessEnv): Promise<BatchProcess>;
|
19
|
+
cleanUpBatchProcesses(): void;
|
16
20
|
forkProcessLegacy(task: Task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }: {
|
17
21
|
temporaryOutputPath: string;
|
18
22
|
streamOutput: boolean;
|
@@ -28,6 +32,7 @@ export declare class ForkedProcessTaskRunner {
|
|
28
32
|
env: NodeJS.ProcessEnv;
|
29
33
|
disablePseudoTerminal: boolean;
|
30
34
|
}): Promise<RunningTask | PseudoTtyProcess>;
|
35
|
+
private createPseudoTerminal;
|
31
36
|
private forkProcessWithPseudoTerminal;
|
32
37
|
private forkProcessWithPrefixAndNotTTY;
|
33
38
|
private forkProcessDirectOutputCapture;
|
@@ -12,26 +12,24 @@ const pseudo_terminal_1 = require("./pseudo-terminal");
|
|
12
12
|
const exit_codes_1 = require("../utils/exit-codes");
|
13
13
|
const node_child_process_1 = require("./running-tasks/node-child-process");
|
14
14
|
const batch_process_1 = require("./running-tasks/batch-process");
|
15
|
+
const native_1 = require("../native");
|
15
16
|
const forkScript = (0, path_1.join)(__dirname, './fork.js');
|
16
17
|
const workerPath = (0, path_1.join)(__dirname, './batch/run-batch.js');
|
17
18
|
class ForkedProcessTaskRunner {
|
18
|
-
constructor(options) {
|
19
|
+
constructor(options, tuiEnabled) {
|
19
20
|
this.options = options;
|
21
|
+
this.tuiEnabled = tuiEnabled;
|
20
22
|
this.cliPath = (0, utils_1.getCliPath)();
|
21
23
|
this.verbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
22
24
|
this.processes = new Set();
|
23
|
-
this.
|
24
|
-
|
25
|
-
: null;
|
25
|
+
this.finishedProcesses = new Set();
|
26
|
+
this.pseudoTerminals = new Set();
|
26
27
|
}
|
27
28
|
async init() {
|
28
|
-
if (this.pseudoTerminal) {
|
29
|
-
await this.pseudoTerminal.init();
|
30
|
-
}
|
31
29
|
this.setupProcessEventListeners();
|
32
30
|
}
|
33
31
|
// TODO: vsavkin delegate terminal output printing
|
34
|
-
async forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }, fullTaskGraph, env) {
|
32
|
+
async forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }, projectGraph, fullTaskGraph, env) {
|
35
33
|
const count = Object.keys(batchTaskGraph.tasks).length;
|
36
34
|
if (count > 1) {
|
37
35
|
output_1.output.logSingleLine(`Running ${output_1.output.bold(count)} ${output_1.output.bold('tasks')} with ${output_1.output.bold(executorName)}`);
|
@@ -53,11 +51,20 @@ class ForkedProcessTaskRunner {
|
|
53
51
|
cp.send({
|
54
52
|
type: batch_messages_1.BatchMessageType.RunTasks,
|
55
53
|
executorName,
|
54
|
+
projectGraph,
|
56
55
|
batchTaskGraph,
|
57
56
|
fullTaskGraph,
|
58
57
|
});
|
59
58
|
return cp;
|
60
59
|
}
|
60
|
+
cleanUpBatchProcesses() {
|
61
|
+
if (this.finishedProcesses.size > 0) {
|
62
|
+
this.finishedProcesses.forEach((p) => {
|
63
|
+
p.kill();
|
64
|
+
});
|
65
|
+
this.finishedProcesses.clear();
|
66
|
+
}
|
67
|
+
}
|
61
68
|
async forkProcessLegacy(task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }) {
|
62
69
|
return pipeOutput
|
63
70
|
? this.forkProcessWithPrefixAndNotTTY(task, {
|
@@ -74,14 +81,15 @@ class ForkedProcessTaskRunner {
|
|
74
81
|
});
|
75
82
|
}
|
76
83
|
async forkProcess(task, { temporaryOutputPath, streamOutput, taskGraph, env, disablePseudoTerminal, }) {
|
77
|
-
const shouldPrefix = streamOutput &&
|
84
|
+
const shouldPrefix = streamOutput &&
|
85
|
+
process.env.NX_PREFIX_OUTPUT === 'true' &&
|
86
|
+
!this.tuiEnabled;
|
78
87
|
// streamOutput would be false if we are running multiple targets
|
79
88
|
// there's no point in running the commands in a pty if we are not streaming the output
|
80
|
-
if (
|
81
|
-
disablePseudoTerminal
|
82
|
-
|
83
|
-
|
84
|
-
return this.forkProcessWithPrefixAndNotTTY(task, {
|
89
|
+
if (pseudo_terminal_1.PseudoTerminal.isSupported() &&
|
90
|
+
!disablePseudoTerminal &&
|
91
|
+
(this.tuiEnabled || (streamOutput && !shouldPrefix))) {
|
92
|
+
return this.forkProcessWithPseudoTerminal(task, {
|
85
93
|
temporaryOutputPath,
|
86
94
|
streamOutput,
|
87
95
|
taskGraph,
|
@@ -89,7 +97,7 @@ class ForkedProcessTaskRunner {
|
|
89
97
|
});
|
90
98
|
}
|
91
99
|
else {
|
92
|
-
return this.
|
100
|
+
return this.forkProcessWithPrefixAndNotTTY(task, {
|
93
101
|
temporaryOutputPath,
|
94
102
|
streamOutput,
|
95
103
|
taskGraph,
|
@@ -97,13 +105,19 @@ class ForkedProcessTaskRunner {
|
|
97
105
|
});
|
98
106
|
}
|
99
107
|
}
|
108
|
+
async createPseudoTerminal() {
|
109
|
+
const terminal = new pseudo_terminal_1.PseudoTerminal(new native_1.RustPseudoTerminal());
|
110
|
+
await terminal.init();
|
111
|
+
terminal.onMessageFromChildren((message) => {
|
112
|
+
process.send(message);
|
113
|
+
});
|
114
|
+
return terminal;
|
115
|
+
}
|
100
116
|
async forkProcessWithPseudoTerminal(task, { temporaryOutputPath, streamOutput, taskGraph, env, }) {
|
101
|
-
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
102
|
-
if (streamOutput) {
|
103
|
-
output_1.output.logCommand(args.join(' '));
|
104
|
-
}
|
105
117
|
const childId = task.id;
|
106
|
-
const
|
118
|
+
const pseudoTerminal = await this.createPseudoTerminal();
|
119
|
+
this.pseudoTerminals.add(pseudoTerminal);
|
120
|
+
const p = await pseudoTerminal.fork(childId, forkScript, {
|
107
121
|
cwd: process.cwd(),
|
108
122
|
execArgv: process.execArgv,
|
109
123
|
jsEnv: env,
|
@@ -124,7 +138,11 @@ class ForkedProcessTaskRunner {
|
|
124
138
|
if (code > 128) {
|
125
139
|
process.exit(code);
|
126
140
|
}
|
141
|
+
this.pseudoTerminals.delete(pseudoTerminal);
|
127
142
|
this.processes.delete(p);
|
143
|
+
if (!streamOutput) {
|
144
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, code === 0 ? 'success' : 'failure', terminalOutput);
|
145
|
+
}
|
128
146
|
this.writeTerminalOutput(temporaryOutputPath, terminalOutput);
|
129
147
|
});
|
130
148
|
return p;
|
@@ -215,46 +233,41 @@ class ForkedProcessTaskRunner {
|
|
215
233
|
(0, fs_1.writeFileSync)(outputPath, content);
|
216
234
|
}
|
217
235
|
setupProcessEventListeners() {
|
218
|
-
|
219
|
-
this.
|
220
|
-
|
236
|
+
const messageHandler = (message) => {
|
237
|
+
this.pseudoTerminals.forEach((p) => {
|
238
|
+
p.sendMessageToChildren(message);
|
221
239
|
});
|
222
|
-
}
|
223
|
-
// When the nx process gets a message, it will be sent into the task's process
|
224
|
-
process.on('message', (message) => {
|
225
|
-
if (this.pseudoTerminal) {
|
226
|
-
this.pseudoTerminal.sendMessageToChildren(message);
|
227
|
-
}
|
228
240
|
this.processes.forEach((p) => {
|
229
|
-
if ('send' in p) {
|
241
|
+
if ('connected' in p && p.connected && 'send' in p) {
|
230
242
|
p.send(message);
|
231
243
|
}
|
232
244
|
});
|
233
|
-
}
|
234
|
-
//
|
235
|
-
process.on('
|
245
|
+
};
|
246
|
+
// When the nx process gets a message, it will be sent into the task's process
|
247
|
+
process.on('message', messageHandler);
|
248
|
+
const cleanUp = (signal) => {
|
236
249
|
this.processes.forEach((p) => {
|
237
|
-
p.kill();
|
250
|
+
p.kill(signal);
|
238
251
|
});
|
252
|
+
process.off('message', messageHandler);
|
253
|
+
this.cleanUpBatchProcesses();
|
254
|
+
};
|
255
|
+
// Terminate any task processes on exit
|
256
|
+
process.once('exit', () => {
|
257
|
+
cleanUp();
|
239
258
|
});
|
240
|
-
process.
|
241
|
-
|
242
|
-
p.kill('SIGTERM');
|
243
|
-
});
|
259
|
+
process.once('SIGINT', () => {
|
260
|
+
cleanUp('SIGTERM');
|
244
261
|
// we exit here because we don't need to write anything to cache.
|
245
262
|
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
246
263
|
});
|
247
|
-
process.
|
248
|
-
|
249
|
-
p.kill('SIGTERM');
|
250
|
-
});
|
264
|
+
process.once('SIGTERM', () => {
|
265
|
+
cleanUp('SIGTERM');
|
251
266
|
// no exit here because we expect child processes to terminate which
|
252
267
|
// will store results to the cache and will terminate this process
|
253
268
|
});
|
254
|
-
process.
|
255
|
-
|
256
|
-
p.kill('SIGTERM');
|
257
|
-
});
|
269
|
+
process.once('SIGHUP', () => {
|
270
|
+
cleanUp('SIGTERM');
|
258
271
|
// no exit here because we expect child processes to terminate which
|
259
272
|
// will store results to the cache and will terminate this process
|
260
273
|
});
|
@@ -1,6 +1,13 @@
|
|
1
|
+
import type { NxJsonConfiguration } from '../config/nx-json';
|
1
2
|
import { NxArgs } from '../utils/command-line-utils';
|
2
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
3
|
-
import { TaskResult } from './life-cycle';
|
4
|
+
import { LifeCycle, TaskResult } from './life-cycle';
|
5
|
+
import type { ProjectGraph } from '../config/project-graph';
|
6
|
+
import { RunningTask } from './running-tasks/running-task';
|
7
|
+
/**
|
8
|
+
* This function is deprecated. Do not use this
|
9
|
+
* @deprecated This function is deprecated. Do not use this
|
10
|
+
*/
|
4
11
|
export declare function initTasksRunner(nxArgs: NxArgs): Promise<{
|
5
12
|
invoke: (opts: {
|
6
13
|
tasks: Task[];
|
@@ -11,3 +18,10 @@ export declare function initTasksRunner(nxArgs: NxArgs): Promise<{
|
|
11
18
|
taskResults: Record<string, TaskResult>;
|
12
19
|
}>;
|
13
20
|
}>;
|
21
|
+
export declare function runDiscreteTasks(tasks: Task[], projectGraph: ProjectGraph, taskGraphForHashing: TaskGraph, nxJson: NxJsonConfiguration, lifeCycle: LifeCycle): Promise<Promise<{
|
22
|
+
task: Task;
|
23
|
+
code: number;
|
24
|
+
status: import("./tasks-runner").TaskStatus;
|
25
|
+
terminalOutput?: string;
|
26
|
+
}>[]>;
|
27
|
+
export declare function runContinuousTasks(tasks: Task[], projectGraph: ProjectGraph, taskGraphForHashing: TaskGraph, nxJson: NxJsonConfiguration, lifeCycle: LifeCycle): Promise<Record<string, Promise<RunningTask>>>;
|