nx 17.0.3 → 17.0.5
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/LICENSE +1 -1
- package/README.md +9 -4
- package/bin/init-local.js +10 -60
- package/bin/nx-cloud.js +6 -0
- package/bin/nx.js +1 -9
- package/bin/post-install.js +5 -1
- package/bin/run-executor.js +1 -1
- package/migrations.json +18 -0
- package/package.json +21 -18
- package/plugins/package-json.js +1 -1
- package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
- package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
- package/release/index.d.ts +4 -0
- package/release/index.js +11 -0
- package/schemas/nx-schema.json +203 -19
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.js +28 -18
- package/src/adapter/compat.d.ts +2 -2
- package/src/adapter/compat.js +6 -1
- package/src/adapter/ngcli-adapter.d.ts +16 -4
- package/src/adapter/ngcli-adapter.js +85 -28
- package/src/command-line/add/add.d.ts +2 -0
- package/src/command-line/add/add.js +169 -0
- package/src/command-line/add/command-object.d.ts +7 -0
- package/src/command-line/add/command-object.js +24 -0
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/affected/command-object.d.ts +4 -4
- package/src/command-line/affected/command-object.js +53 -26
- package/src/command-line/affected/print-affected.js +10 -1
- package/src/command-line/connect/command-object.d.ts +1 -2
- package/src/command-line/connect/command-object.js +3 -7
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
- package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
- package/src/command-line/connect/view-logs.js +5 -21
- package/src/command-line/examples.js +18 -0
- package/src/command-line/exec/command-object.js +2 -1
- package/src/command-line/exec/exec.d.ts +1 -1
- package/src/command-line/exec/exec.js +78 -35
- package/src/command-line/format/format.js +13 -4
- package/src/command-line/generate/generate.js +9 -9
- package/src/command-line/generate/generator-utils.d.ts +3 -2
- package/src/command-line/generate/generator-utils.js +5 -5
- package/src/command-line/graph/graph.d.ts +1 -1
- package/src/command-line/graph/graph.js +82 -37
- package/src/command-line/init/command-object.js +70 -43
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +11 -2
- package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +9 -6
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +14 -4
- package/src/command-line/init/implementation/angular/index.js +4 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/types.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +4 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
- package/src/command-line/init/implementation/utils.d.ts +5 -5
- package/src/command-line/init/implementation/utils.js +46 -44
- package/src/command-line/init/{init.js → init-v1.js} +5 -13
- package/src/command-line/init/init-v2.d.ts +7 -0
- package/src/command-line/init/init-v2.js +201 -0
- package/src/command-line/list/list.js +6 -5
- package/src/command-line/migrate/command-object.js +19 -4
- package/src/command-line/migrate/migrate.js +21 -17
- package/src/command-line/new/new.js +1 -1
- package/src/command-line/nx-commands.js +4 -1
- package/src/command-line/release/changelog.d.ts +22 -1
- package/src/command-line/release/changelog.js +459 -257
- package/src/command-line/release/command-object.d.ts +29 -7
- package/src/command-line/release/command-object.js +120 -20
- package/src/command-line/release/config/config.d.ts +26 -21
- package/src/command-line/release/config/config.js +416 -59
- package/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/src/command-line/release/config/conventional-commits.js +98 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
- package/src/command-line/release/config/filter-release-groups.js +38 -1
- package/src/command-line/release/index.d.ts +16 -0
- package/src/command-line/release/index.js +23 -0
- package/src/command-line/release/publish.d.ts +7 -3
- package/src/command-line/release/publish.js +89 -37
- package/src/command-line/release/release.d.ts +4 -0
- package/src/command-line/release/release.js +176 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
- package/src/command-line/release/utils/exec-command.d.ts +1 -0
- package/src/command-line/release/utils/exec-command.js +34 -0
- package/src/command-line/release/utils/git.d.ts +34 -1
- package/src/command-line/release/utils/git.js +238 -34
- package/src/command-line/release/utils/github.d.ts +5 -5
- package/src/command-line/release/utils/github.js +155 -8
- package/src/command-line/release/utils/markdown.js +6 -1
- package/src/command-line/release/utils/print-changes.d.ts +1 -1
- package/src/command-line/release/utils/print-changes.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
- package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +30 -1
- package/src/command-line/release/utils/shared.d.ts +39 -0
- package/src/command-line/release/utils/shared.js +213 -0
- package/src/command-line/release/version.d.ts +37 -3
- package/src/command-line/release/version.js +312 -117
- package/src/command-line/repair/repair.js +13 -9
- package/src/command-line/report/report.d.ts +3 -0
- package/src/command-line/report/report.js +22 -5
- package/src/command-line/run/command-object.d.ts +4 -0
- package/src/command-line/run/command-object.js +18 -2
- package/src/command-line/run/executor-utils.d.ts +2 -1
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +3 -6
- package/src/command-line/run/run.js +34 -9
- package/src/command-line/run-many/command-object.js +4 -1
- package/src/command-line/run-many/run-many.js +0 -3
- package/src/command-line/show/command-object.d.ts +3 -0
- package/src/command-line/show/command-object.js +29 -2
- package/src/command-line/show/show.js +9 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
- package/src/command-line/yargs-utils/shared-options.js +23 -9
- package/src/commands-runner/command-graph.d.ts +13 -0
- package/src/commands-runner/command-graph.js +2 -0
- package/src/commands-runner/create-command-graph.d.ts +4 -0
- package/src/commands-runner/create-command-graph.js +44 -0
- package/src/commands-runner/get-command-projects.d.ts +3 -0
- package/src/commands-runner/get-command-projects.js +19 -0
- package/src/config/nx-json.d.ts +160 -25
- package/src/config/project-graph.d.ts +3 -3
- package/src/config/workspace-json-project-json.d.ts +23 -1
- package/src/config/workspaces.d.ts +1 -1
- package/src/config/workspaces.js +4 -6
- package/src/core/graph/3rdpartylicenses.txt +144 -74
- package/src/core/graph/environment.js +1 -1
- package/src/core/graph/index.html +4 -6
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +3 -3
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -1
- package/src/daemon/client/client.js +27 -8
- package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
- package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
- package/src/daemon/daemon-project-graph-error.d.ts +8 -0
- package/src/daemon/daemon-project-graph-error.js +13 -0
- package/src/daemon/server/handle-hash-tasks.js +12 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
- package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
- package/src/daemon/server/shutdown-utils.js +2 -4
- package/src/daemon/server/watcher.js +0 -3
- package/src/daemon/socket-utils.d.ts +2 -1
- package/src/daemon/socket-utils.js +15 -4
- package/src/daemon/tmp-dir.d.ts +1 -0
- package/src/daemon/tmp-dir.js +4 -4
- package/src/devkit-exports.d.ts +2 -2
- package/src/devkit-exports.js +3 -2
- package/src/devkit-internals.d.ts +3 -0
- package/src/devkit-internals.js +7 -1
- package/src/executors/noop/schema.json +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
- package/src/executors/run-commands/run-commands.impl.js +152 -48
- package/src/executors/run-commands/schema.json +11 -1
- package/src/executors/run-script/run-script.impl.js +43 -11
- package/src/executors/utils/convert-nx-executor.js +1 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
- package/src/generators/tree.d.ts +1 -0
- package/src/generators/utils/glob.js +2 -2
- package/src/generators/utils/project-configuration.js +28 -9
- package/src/hasher/create-task-hasher.d.ts +4 -0
- package/src/hasher/create-task-hasher.js +16 -0
- package/src/hasher/hash-task.js +9 -3
- package/src/hasher/native-task-hasher-impl.d.ts +19 -0
- package/src/hasher/native-task-hasher-impl.js +37 -0
- package/src/hasher/node-task-hasher-impl.d.ts +49 -0
- package/src/hasher/node-task-hasher-impl.js +431 -0
- package/src/hasher/task-hasher.d.ts +33 -21
- package/src/hasher/task-hasher.js +30 -428
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
- package/src/migrations/update-15-1-0/set-project-names.js +2 -1
- package/src/migrations/update-15-8-2/update-nxw.js +2 -6
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +21 -0
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
- package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
- package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
- package/src/migrations/update-17-3-0/update-nxw.js +7 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
- package/src/native/index.d.ts +65 -15
- package/src/native/index.js +6 -2
- package/src/native/transform-objects.js +2 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
- package/src/nx-cloud/update-manager.js +2 -1
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/index.js +3 -3
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.js +15 -3
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
- package/src/plugins/js/utils/register.d.ts +1 -1
- package/src/plugins/js/utils/register.js +28 -8
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
- package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +4 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
- package/src/plugins/project-json/build-nodes/project-json.js +6 -44
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
- package/src/project-graph/affected/locators/workspace-projects.js +16 -29
- package/src/project-graph/build-project-graph.d.ts +20 -1
- package/src/project-graph/build-project-graph.js +91 -33
- package/src/project-graph/file-map-utils.d.ts +9 -5
- package/src/project-graph/file-map-utils.js +16 -63
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +44 -2
- package/src/project-graph/nx-deps-cache.js +1 -1
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph-builder.js +1 -1
- package/src/project-graph/project-graph.d.ts +32 -1
- package/src/project-graph/project-graph.js +147 -23
- package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
- package/src/project-graph/utils/build-all-workspace-files.js +15 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
- package/src/project-graph/utils/normalize-project-nodes.js +7 -33
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +509 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
- package/src/tasks-runner/batch/run-batch.js +3 -3
- package/src/tasks-runner/cache.js +6 -3
- package/src/tasks-runner/create-task-graph.js +1 -1
- package/src/tasks-runner/fork.d.ts +1 -0
- package/src/tasks-runner/fork.js +23 -0
- package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
- package/src/tasks-runner/forked-process-task-runner.js +112 -21
- package/src/tasks-runner/init-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
- package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
- package/src/tasks-runner/pseudo-ipc.js +140 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
- package/src/tasks-runner/pseudo-terminal.js +159 -0
- package/src/tasks-runner/run-command.d.ts +1 -1
- package/src/tasks-runner/run-command.js +13 -19
- package/src/tasks-runner/task-env.js +1 -2
- package/src/tasks-runner/task-graph-utils.d.ts +7 -3
- package/src/tasks-runner/task-graph-utils.js +15 -15
- package/src/tasks-runner/task-orchestrator.js +68 -12
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +16 -7
- package/src/tasks-runner/utils.js +30 -16
- package/src/utils/ab-testing.d.ts +36 -2
- package/src/utils/ab-testing.js +34 -16
- package/src/utils/assert-workspace-validity.js +1 -1
- package/src/utils/cache-directory.d.ts +1 -0
- package/src/utils/cache-directory.js +5 -1
- package/src/utils/child-process.d.ts +15 -1
- package/src/utils/child-process.js +91 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/exit-codes.d.ts +6 -0
- package/src/utils/exit-codes.js +20 -0
- package/src/utils/fileutils.d.ts +1 -0
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -0
- package/src/utils/ignore.js +8 -1
- package/src/utils/json-diff.d.ts +1 -0
- package/src/utils/json-diff.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/nx-cloud-utils.d.ts +1 -1
- package/src/utils/nx-cloud-utils.js +9 -4
- package/src/utils/nx-plugin.d.ts +32 -15
- package/src/utils/nx-plugin.deprecated.d.ts +10 -5
- package/src/utils/nx-plugin.deprecated.js +23 -0
- package/src/utils/nx-plugin.js +71 -80
- package/src/utils/output.d.ts +4 -2
- package/src/utils/output.js +44 -9
- package/src/utils/package-json.d.ts +4 -4
- package/src/utils/package-json.js +18 -12
- package/src/utils/package-manager.d.ts +7 -0
- package/src/utils/package-manager.js +24 -4
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +37 -4
- package/src/utils/plugins/core-plugins.js +8 -0
- package/src/utils/plugins/installed-plugins.d.ts +2 -1
- package/src/utils/plugins/installed-plugins.js +2 -2
- package/src/utils/plugins/local-plugins.js +1 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
- package/src/utils/plugins/plugin-capabilities.js +7 -7
- package/src/utils/typescript.js +1 -1
- package/src/utils/update-nxw.d.ts +2 -0
- package/src/utils/update-nxw.js +12 -0
- package/src/utils/workspace-configuration-check.js +1 -1
- package/src/utils/workspace-context.d.ts +6 -4
- package/src/utils/workspace-context.js +19 -9
- package/src/core/graph/polyfills.js +0 -1
- /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProjectConfiguration
|
|
1
|
+
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
|
2
2
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
|
3
|
-
import {
|
|
3
|
+
import { ConfigurationResult } from './project-configuration-utils';
|
|
4
4
|
import { LoadedNxPlugin } from '../../utils/nx-plugin';
|
|
5
5
|
/**
|
|
6
6
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
|
@@ -8,14 +8,13 @@ import { LoadedNxPlugin } from '../../utils/nx-plugin';
|
|
|
8
8
|
* @param workspaceRoot
|
|
9
9
|
* @param nxJson
|
|
10
10
|
*/
|
|
11
|
-
export declare function retrieveWorkspaceFiles(workspaceRoot: string,
|
|
12
|
-
allWorkspaceFiles: FileData[];
|
|
11
|
+
export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
|
|
12
|
+
allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
|
|
13
13
|
fileMap: {
|
|
14
|
-
projectFileMap:
|
|
15
|
-
nonProjectFiles: import("
|
|
14
|
+
projectFileMap: ProjectFiles;
|
|
15
|
+
nonProjectFiles: import("nx/src/native").FileData[];
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
externalNodes: Record<string, ProjectGraphExternalNode>;
|
|
17
|
+
rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
|
|
19
18
|
}>;
|
|
20
19
|
/**
|
|
21
20
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
|
@@ -23,26 +22,8 @@ export declare function retrieveWorkspaceFiles(workspaceRoot: string, nxJson: Nx
|
|
|
23
22
|
* @param workspaceRoot
|
|
24
23
|
* @param nxJson
|
|
25
24
|
*/
|
|
26
|
-
export declare function retrieveProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare function
|
|
31
|
-
externalNodes: Record<string, ProjectGraphExternalNode>;
|
|
32
|
-
projectNodes: Record<string, ProjectConfiguration>;
|
|
33
|
-
}>;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use {@link retrieveProjectConfigurations} instead.
|
|
36
|
-
*/
|
|
37
|
-
export declare function retrieveProjectConfigurationsSync(workspaceRoot: string, nxJson: NxJsonConfiguration): {
|
|
38
|
-
externalNodes: Record<string, ProjectGraphExternalNode>;
|
|
39
|
-
projectNodes: Record<string, ProjectConfiguration>;
|
|
40
|
-
};
|
|
41
|
-
export declare function retrieveProjectConfigurationPaths(root: string, nxJson: NxJsonConfiguration): Promise<string[]>;
|
|
42
|
-
export declare function retrieveProjectConfigurationPathsWithoutPluginInference(root: string): string[];
|
|
43
|
-
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Record<string, ProjectConfiguration>;
|
|
44
|
-
export declare function createProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration, configFiles: string[], plugins: LoadedNxPlugin[]): {
|
|
45
|
-
projects: Record<string, ProjectConfiguration>;
|
|
46
|
-
externalNodes: Record<string, ProjectGraphExternalNode>;
|
|
47
|
-
};
|
|
48
|
-
export declare function configurationGlobs(workspaceRoot: string, plugins: LoadedNxPlugin[]): string[];
|
|
25
|
+
export declare function retrieveProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
|
26
|
+
export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
|
27
|
+
export declare function retrieveProjectConfigurationPaths(root: string, plugins: LoadedNxPlugin[]): string[];
|
|
28
|
+
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
|
29
|
+
export declare function configurationGlobs(plugins: LoadedNxPlugin[]): string[];
|
|
@@ -1,48 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configurationGlobs = exports.
|
|
3
|
+
exports.configurationGlobs = exports.retrieveProjectConfigurationsWithoutPluginInference = exports.retrieveProjectConfigurationPaths = exports.retrieveProjectConfigurationsWithAngularProjects = exports.retrieveProjectConfigurations = exports.retrieveWorkspaceFiles = void 0;
|
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
|
5
5
|
const installation_directory_1 = require("../../utils/installation-directory");
|
|
6
6
|
const angular_json_1 = require("../../adapter/angular-json");
|
|
7
7
|
const nx_json_1 = require("../../config/nx-json");
|
|
8
|
-
const package_json_workspaces_1 = require("
|
|
8
|
+
const package_json_workspaces_1 = require("../../plugins/package-json-workspaces");
|
|
9
9
|
const project_configuration_utils_1 = require("./project-configuration-utils");
|
|
10
10
|
const nx_plugin_1 = require("../../utils/nx-plugin");
|
|
11
11
|
const project_json_1 = require("../../plugins/project-json/build-nodes/project-json");
|
|
12
12
|
const workspace_context_1 = require("../../utils/workspace-context");
|
|
13
|
+
const build_all_workspace_files_1 = require("./build-all-workspace-files");
|
|
13
14
|
/**
|
|
14
15
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
|
15
16
|
* @throws
|
|
16
17
|
* @param workspaceRoot
|
|
17
18
|
* @param nxJson
|
|
18
19
|
*/
|
|
19
|
-
async function retrieveWorkspaceFiles(workspaceRoot,
|
|
20
|
+
async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
20
21
|
perf_hooks_1.performance.mark('native-file-deps:start');
|
|
21
|
-
const plugins = await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins ?? [], (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot);
|
|
22
|
-
let globs = configurationGlobs(workspaceRoot, plugins);
|
|
23
22
|
perf_hooks_1.performance.mark('native-file-deps:end');
|
|
24
23
|
perf_hooks_1.performance.measure('native-file-deps', 'native-file-deps:start', 'native-file-deps:end');
|
|
25
24
|
perf_hooks_1.performance.mark('get-workspace-files:start');
|
|
26
|
-
const {
|
|
27
|
-
const projectConfigurations = createProjectConfigurations(workspaceRoot, nxJson, configs, plugins);
|
|
28
|
-
return {
|
|
29
|
-
projectNodes: projectConfigurations.projects,
|
|
30
|
-
externalNodes: projectConfigurations.externalNodes,
|
|
31
|
-
};
|
|
32
|
-
});
|
|
25
|
+
const { projectFileMap, globalFiles, externalReferences } = (0, workspace_context_1.getNxWorkspaceFilesFromContext)(workspaceRoot, projectRootMap);
|
|
33
26
|
perf_hooks_1.performance.mark('get-workspace-files:end');
|
|
34
27
|
perf_hooks_1.performance.measure('get-workspace-files', 'get-workspace-files:start', 'get-workspace-files:end');
|
|
35
28
|
return {
|
|
36
|
-
allWorkspaceFiles: buildAllWorkspaceFiles(projectFileMap, globalFiles),
|
|
29
|
+
allWorkspaceFiles: (0, build_all_workspace_files_1.buildAllWorkspaceFiles)(projectFileMap, globalFiles),
|
|
37
30
|
fileMap: {
|
|
38
31
|
projectFileMap,
|
|
39
32
|
nonProjectFiles: globalFiles,
|
|
40
33
|
},
|
|
41
|
-
|
|
42
|
-
version: 2,
|
|
43
|
-
projects: projectConfigurations,
|
|
44
|
-
},
|
|
45
|
-
externalNodes: externalNodes,
|
|
34
|
+
rustReferences: externalReferences,
|
|
46
35
|
};
|
|
47
36
|
}
|
|
48
37
|
exports.retrieveWorkspaceFiles = retrieveWorkspaceFiles;
|
|
@@ -54,8 +43,7 @@ exports.retrieveWorkspaceFiles = retrieveWorkspaceFiles;
|
|
|
54
43
|
*/
|
|
55
44
|
async function retrieveProjectConfigurations(workspaceRoot, nxJson) {
|
|
56
45
|
const plugins = await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins ?? [], (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot);
|
|
57
|
-
|
|
58
|
-
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs);
|
|
46
|
+
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
|
59
47
|
}
|
|
60
48
|
exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
|
61
49
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|
|
@@ -64,84 +52,40 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
|
64
52
|
!plugins.some((p) => p.plugin.name === angular_json_1.NX_ANGULAR_JSON_PLUGIN_NAME)) {
|
|
65
53
|
plugins.push({ plugin: angular_json_1.NxAngularJsonPlugin });
|
|
66
54
|
}
|
|
67
|
-
|
|
68
|
-
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs);
|
|
55
|
+
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
|
69
56
|
}
|
|
70
57
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const plugins = (0, nx_plugin_1.loadNxPluginsSync)(nxJson?.plugins ?? [], (0, installation_directory_1.getNxRequirePaths)(workspaceRoot), workspaceRoot);
|
|
76
|
-
const globs = configurationGlobs(workspaceRoot, plugins);
|
|
77
|
-
return _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs);
|
|
78
|
-
}
|
|
79
|
-
exports.retrieveProjectConfigurationsSync = retrieveProjectConfigurationsSync;
|
|
80
|
-
function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs) {
|
|
81
|
-
return (0, workspace_context_1.getProjectConfigurationsFromContext)(workspaceRoot, globs, (configs) => {
|
|
82
|
-
const projectConfigurations = createProjectConfigurations(workspaceRoot, nxJson, configs, plugins);
|
|
83
|
-
return {
|
|
84
|
-
projectNodes: projectConfigurations.projects,
|
|
85
|
-
externalNodes: projectConfigurations.externalNodes,
|
|
86
|
-
};
|
|
87
|
-
});
|
|
58
|
+
function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins) {
|
|
59
|
+
const globPatterns = configurationGlobs(plugins);
|
|
60
|
+
const workspaceFiles = (0, workspace_context_1.globWithWorkspaceContext)(workspaceRoot, globPatterns);
|
|
61
|
+
return (0, project_configuration_utils_1.createProjectConfigurations)(workspaceRoot, nxJson, workspaceFiles, plugins);
|
|
88
62
|
}
|
|
89
|
-
|
|
90
|
-
const projectGlobPatterns = configurationGlobs(
|
|
63
|
+
function retrieveProjectConfigurationPaths(root, plugins) {
|
|
64
|
+
const projectGlobPatterns = configurationGlobs(plugins);
|
|
91
65
|
return (0, workspace_context_1.globWithWorkspaceContext)(root, projectGlobPatterns);
|
|
92
66
|
}
|
|
93
67
|
exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
|
|
94
|
-
function retrieveProjectConfigurationPathsWithoutPluginInference(root) {
|
|
95
|
-
return (0, workspace_context_1.globWithWorkspaceContext)(root, configurationGlobsWithoutPlugins(root));
|
|
96
|
-
}
|
|
97
|
-
exports.retrieveProjectConfigurationPathsWithoutPluginInference = retrieveProjectConfigurationPathsWithoutPluginInference;
|
|
98
68
|
const projectsWithoutPluginCache = new Map();
|
|
99
69
|
// TODO: This function is called way too often, it should be optimized without this cache
|
|
100
|
-
function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
|
70
|
+
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
|
101
71
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
|
102
|
-
const
|
|
72
|
+
const plugins = await (0, nx_plugin_1.getDefaultPlugins)(root);
|
|
73
|
+
const projectGlobPatterns = retrieveProjectConfigurationPaths(root, plugins);
|
|
103
74
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
|
104
75
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
|
105
76
|
return projectsWithoutPluginCache.get(cacheKey);
|
|
106
77
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
externalNodes: {},
|
|
115
|
-
};
|
|
116
|
-
}).projectNodes;
|
|
117
|
-
projectsWithoutPluginCache.set(cacheKey, projectConfigurations);
|
|
118
|
-
return projectConfigurations;
|
|
78
|
+
const projectFiles = (0, workspace_context_1.globWithWorkspaceContext)(root, projectGlobPatterns) ?? [];
|
|
79
|
+
const { projects } = await (0, project_configuration_utils_1.createProjectConfigurations)(root, nxJson, projectFiles, [
|
|
80
|
+
{ plugin: (0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(root) },
|
|
81
|
+
{ plugin: project_json_1.ProjectJsonProjectsPlugin },
|
|
82
|
+
]);
|
|
83
|
+
projectsWithoutPluginCache.set(cacheKey, projects);
|
|
84
|
+
return projects;
|
|
119
85
|
}
|
|
120
86
|
exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
let fileData = Object.values(projectFileMap).flat();
|
|
124
|
-
fileData = fileData
|
|
125
|
-
.concat(globalFiles)
|
|
126
|
-
.sort((a, b) => a.file.localeCompare(b.file));
|
|
127
|
-
perf_hooks_1.performance.mark('get-all-workspace-files:end');
|
|
128
|
-
perf_hooks_1.performance.measure('get-all-workspace-files', 'get-all-workspace-files:start', 'get-all-workspace-files:end');
|
|
129
|
-
return fileData;
|
|
130
|
-
}
|
|
131
|
-
function createProjectConfigurations(workspaceRoot, nxJson, configFiles, plugins) {
|
|
132
|
-
perf_hooks_1.performance.mark('build-project-configs:start');
|
|
133
|
-
const { projects, externalNodes } = (0, project_configuration_utils_1.buildProjectsConfigurationsFromProjectPathsAndPlugins)(nxJson, configFiles, plugins, workspaceRoot);
|
|
134
|
-
let projectConfigurations = projects;
|
|
135
|
-
perf_hooks_1.performance.mark('build-project-configs:end');
|
|
136
|
-
perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
|
|
137
|
-
return {
|
|
138
|
-
projects: projectConfigurations,
|
|
139
|
-
externalNodes,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
exports.createProjectConfigurations = createProjectConfigurations;
|
|
143
|
-
function configurationGlobs(workspaceRoot, plugins) {
|
|
144
|
-
const globPatterns = configurationGlobsWithoutPlugins(workspaceRoot);
|
|
87
|
+
function configurationGlobs(plugins) {
|
|
88
|
+
const globPatterns = [];
|
|
145
89
|
for (const { plugin } of plugins) {
|
|
146
90
|
if (plugin.createNodes) {
|
|
147
91
|
globPatterns.push(plugin.createNodes[0]);
|
|
@@ -150,10 +94,3 @@ function configurationGlobs(workspaceRoot, plugins) {
|
|
|
150
94
|
return globPatterns;
|
|
151
95
|
}
|
|
152
96
|
exports.configurationGlobs = configurationGlobs;
|
|
153
|
-
function configurationGlobsWithoutPlugins(workspaceRoot) {
|
|
154
|
-
return [
|
|
155
|
-
'project.json',
|
|
156
|
-
'**/project.json',
|
|
157
|
-
...(0, package_json_workspaces_1.getGlobPatternsFromPackageManagerWorkspaces)(workspaceRoot),
|
|
158
|
-
];
|
|
159
|
-
}
|
|
@@ -7,16 +7,16 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
|
7
7
|
const configuration_1 = require("../../config/configuration");
|
|
8
8
|
const async_iterator_1 = require("../../utils/async-iterator");
|
|
9
9
|
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
|
10
|
-
function getBatchExecutor(executorName) {
|
|
10
|
+
function getBatchExecutor(executorName, projects) {
|
|
11
11
|
const [nodeModule, exportName] = executorName.split(':');
|
|
12
|
-
return (0, executor_utils_1.getExecutorInformation)(nodeModule, exportName, workspace_root_1.workspaceRoot);
|
|
12
|
+
return (0, executor_utils_1.getExecutorInformation)(nodeModule, exportName, workspace_root_1.workspaceRoot, projects);
|
|
13
13
|
}
|
|
14
14
|
async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
15
15
|
const input = {};
|
|
16
16
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
17
17
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
18
18
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
|
19
|
-
const batchExecutor = getBatchExecutor(executorName);
|
|
19
|
+
const batchExecutor = getBatchExecutor(executorName, projectsConfigurations.projects);
|
|
20
20
|
const tasks = Object.values(batchTaskGraph.tasks);
|
|
21
21
|
const context = {
|
|
22
22
|
root: workspace_root_1.workspaceRoot,
|
|
@@ -215,18 +215,21 @@ class Cache {
|
|
|
215
215
|
}
|
|
216
216
|
tryAndRetry(fn) {
|
|
217
217
|
let attempts = 0;
|
|
218
|
-
const baseTimeout =
|
|
218
|
+
const baseTimeout = 5;
|
|
219
|
+
// Generate a random number between 2 and 4 to raise to the power of attempts
|
|
220
|
+
const baseExponent = Math.random() * 2 + 2;
|
|
219
221
|
const _try = async () => {
|
|
220
222
|
try {
|
|
221
223
|
attempts++;
|
|
222
224
|
return await fn();
|
|
223
225
|
}
|
|
224
226
|
catch (e) {
|
|
225
|
-
|
|
227
|
+
// Max time is 5 * 4^3 = 20480ms
|
|
228
|
+
if (attempts === 6) {
|
|
226
229
|
// After enough attempts, throw the error
|
|
227
230
|
throw e;
|
|
228
231
|
}
|
|
229
|
-
await new Promise((res) => setTimeout(res,
|
|
232
|
+
await new Promise((res) => setTimeout(res, baseExponent ** attempts));
|
|
230
233
|
return await _try();
|
|
231
234
|
}
|
|
232
235
|
};
|
|
@@ -170,7 +170,7 @@ class ProcessTasks {
|
|
|
170
170
|
projectRoot: project.data.root,
|
|
171
171
|
overrides: interpolatedOverrides,
|
|
172
172
|
outputs: (0, utils_1.getOutputs)(this.projectGraph.nodes, qualifiedTarget, interpolatedOverrides),
|
|
173
|
-
// TODO(
|
|
173
|
+
// TODO(v19): Remove cast here after typing is moved back onto TargetConfiguration
|
|
174
174
|
cache: project.data.targets[target].cache,
|
|
175
175
|
};
|
|
176
176
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const pseudo_ipc_1 = require("./pseudo-ipc");
|
|
6
|
+
const pseudoIPCPath = process.argv[2];
|
|
7
|
+
const forkId = process.argv[3];
|
|
8
|
+
const script = (0, path_1.join)(__dirname, '../../bin/run-executor.js');
|
|
9
|
+
const childProcess = (0, child_process_1.fork)(script, {
|
|
10
|
+
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
11
|
+
});
|
|
12
|
+
const pseudoIPC = new pseudo_ipc_1.PseudoIPCClient(pseudoIPCPath);
|
|
13
|
+
pseudoIPC.onMessageFromParent(forkId, (message) => {
|
|
14
|
+
childProcess.send(message);
|
|
15
|
+
});
|
|
16
|
+
pseudoIPC.notifyChildIsReady(forkId);
|
|
17
|
+
process.on('message', (message) => {
|
|
18
|
+
pseudoIPC.sendMessageToParent(message);
|
|
19
|
+
});
|
|
20
|
+
childProcess.on('exit', (code) => {
|
|
21
|
+
pseudoIPC.close();
|
|
22
|
+
process.exit(code);
|
|
23
|
+
});
|
|
@@ -8,28 +8,36 @@ export declare class ForkedProcessTaskRunner {
|
|
|
8
8
|
cliPath: string;
|
|
9
9
|
private readonly verbose;
|
|
10
10
|
private processes;
|
|
11
|
+
private pseudoTerminal;
|
|
11
12
|
constructor(options: DefaultTasksRunnerOptions);
|
|
13
|
+
init(): Promise<void>;
|
|
12
14
|
forkProcessForBatch({ executorName, taskGraph: batchTaskGraph }: Batch, fullTaskGraph: TaskGraph, env: NodeJS.ProcessEnv): Promise<BatchResults>;
|
|
13
|
-
|
|
14
|
-
streamOutput: boolean;
|
|
15
|
+
forkProcessLegacy(task: Task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }: {
|
|
15
16
|
temporaryOutputPath: string;
|
|
17
|
+
streamOutput: boolean;
|
|
18
|
+
pipeOutput: boolean;
|
|
16
19
|
taskGraph: TaskGraph;
|
|
17
20
|
env: NodeJS.ProcessEnv;
|
|
18
21
|
}): Promise<{
|
|
19
22
|
code: number;
|
|
20
23
|
terminalOutput: string;
|
|
21
24
|
}>;
|
|
22
|
-
|
|
23
|
-
streamOutput: boolean;
|
|
25
|
+
forkProcess(task: Task, { temporaryOutputPath, streamOutput, taskGraph, env, disablePseudoTerminal, }: {
|
|
24
26
|
temporaryOutputPath: string;
|
|
27
|
+
streamOutput: boolean;
|
|
28
|
+
pipeOutput: boolean;
|
|
25
29
|
taskGraph: TaskGraph;
|
|
26
30
|
env: NodeJS.ProcessEnv;
|
|
31
|
+
disablePseudoTerminal: boolean;
|
|
27
32
|
}): Promise<{
|
|
28
33
|
code: number;
|
|
29
34
|
terminalOutput: string;
|
|
30
35
|
}>;
|
|
36
|
+
private forkProcessWithPseudoTerminal;
|
|
37
|
+
private forkProcessPipeOutputCapture;
|
|
38
|
+
private forkProcessWithPrefixAndNotTTY;
|
|
39
|
+
private forkProcessDirectOutputCapture;
|
|
31
40
|
private readTerminalOutput;
|
|
32
41
|
private writeTerminalOutput;
|
|
33
|
-
private signalToCode;
|
|
34
42
|
private setupProcessEventListeners;
|
|
35
43
|
}
|
|
@@ -11,6 +11,9 @@ const path_1 = require("path");
|
|
|
11
11
|
const batch_messages_1 = require("./batch/batch-messages");
|
|
12
12
|
const strip_indents_1 = require("../utils/strip-indents");
|
|
13
13
|
const stream_1 = require("stream");
|
|
14
|
+
const pseudo_terminal_1 = require("./pseudo-terminal");
|
|
15
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
|
16
|
+
const forkScript = (0, path_1.join)(__dirname, './fork.js');
|
|
14
17
|
const workerPath = (0, path_1.join)(__dirname, './batch/run-batch.js');
|
|
15
18
|
class ForkedProcessTaskRunner {
|
|
16
19
|
constructor(options) {
|
|
@@ -18,6 +21,14 @@ class ForkedProcessTaskRunner {
|
|
|
18
21
|
this.cliPath = (0, utils_1.getCliPath)();
|
|
19
22
|
this.verbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
20
23
|
this.processes = new Set();
|
|
24
|
+
this.pseudoTerminal = pseudo_terminal_1.PseudoTerminal.isSupported()
|
|
25
|
+
? (0, pseudo_terminal_1.getPseudoTerminal)()
|
|
26
|
+
: null;
|
|
27
|
+
}
|
|
28
|
+
async init() {
|
|
29
|
+
if (this.pseudoTerminal) {
|
|
30
|
+
await this.pseudoTerminal.init();
|
|
31
|
+
}
|
|
21
32
|
this.setupProcessEventListeners();
|
|
22
33
|
}
|
|
23
34
|
// TODO: vsavkin delegate terminal output printing
|
|
@@ -31,7 +42,6 @@ class ForkedProcessTaskRunner {
|
|
|
31
42
|
else {
|
|
32
43
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(Object.values(batchTaskGraph.tasks)[0]);
|
|
33
44
|
output_1.output.logCommand(args.join(' '));
|
|
34
|
-
output_1.output.addNewline();
|
|
35
45
|
}
|
|
36
46
|
const p = (0, child_process_1.fork)(workerPath, {
|
|
37
47
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
@@ -41,7 +51,7 @@ class ForkedProcessTaskRunner {
|
|
|
41
51
|
p.once('exit', (code, signal) => {
|
|
42
52
|
this.processes.delete(p);
|
|
43
53
|
if (code === null)
|
|
44
|
-
code =
|
|
54
|
+
code = (0, exit_codes_1.signalToCode)(signal);
|
|
45
55
|
if (code !== 0) {
|
|
46
56
|
const results = {};
|
|
47
57
|
for (const rootTaskId of batchTaskGraph.roots) {
|
|
@@ -83,13 +93,95 @@ class ForkedProcessTaskRunner {
|
|
|
83
93
|
}
|
|
84
94
|
});
|
|
85
95
|
}
|
|
96
|
+
async forkProcessLegacy(task, { temporaryOutputPath, streamOutput, pipeOutput, taskGraph, env, }) {
|
|
97
|
+
return pipeOutput
|
|
98
|
+
? await this.forkProcessPipeOutputCapture(task, {
|
|
99
|
+
temporaryOutputPath,
|
|
100
|
+
streamOutput,
|
|
101
|
+
taskGraph,
|
|
102
|
+
env,
|
|
103
|
+
})
|
|
104
|
+
: await this.forkProcessDirectOutputCapture(task, {
|
|
105
|
+
temporaryOutputPath,
|
|
106
|
+
streamOutput,
|
|
107
|
+
taskGraph,
|
|
108
|
+
env,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async forkProcess(task, { temporaryOutputPath, streamOutput, taskGraph, env, disablePseudoTerminal, }) {
|
|
112
|
+
const shouldPrefix = streamOutput && process.env.NX_PREFIX_OUTPUT === 'true';
|
|
113
|
+
// streamOutput would be false if we are running multiple targets
|
|
114
|
+
// there's no point in running the commands in a pty if we are not streaming the output
|
|
115
|
+
if (!this.pseudoTerminal ||
|
|
116
|
+
disablePseudoTerminal ||
|
|
117
|
+
!streamOutput ||
|
|
118
|
+
shouldPrefix) {
|
|
119
|
+
return this.forkProcessWithPrefixAndNotTTY(task, {
|
|
120
|
+
temporaryOutputPath,
|
|
121
|
+
streamOutput,
|
|
122
|
+
taskGraph,
|
|
123
|
+
env,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return this.forkProcessWithPseudoTerminal(task, {
|
|
128
|
+
temporaryOutputPath,
|
|
129
|
+
streamOutput,
|
|
130
|
+
taskGraph,
|
|
131
|
+
env,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async forkProcessWithPseudoTerminal(task, { temporaryOutputPath, streamOutput, taskGraph, env, }) {
|
|
136
|
+
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
137
|
+
if (streamOutput) {
|
|
138
|
+
output_1.output.logCommand(args.join(' '));
|
|
139
|
+
}
|
|
140
|
+
const childId = task.id;
|
|
141
|
+
const p = await this.pseudoTerminal.fork(childId, forkScript, {
|
|
142
|
+
cwd: process.cwd(),
|
|
143
|
+
jsEnv: env,
|
|
144
|
+
quiet: !streamOutput,
|
|
145
|
+
});
|
|
146
|
+
p.send({
|
|
147
|
+
targetDescription: task.target,
|
|
148
|
+
overrides: task.overrides,
|
|
149
|
+
taskGraph,
|
|
150
|
+
isVerbose: this.verbose,
|
|
151
|
+
});
|
|
152
|
+
this.processes.add(p);
|
|
153
|
+
let terminalOutput = '';
|
|
154
|
+
p.onOutput((msg) => {
|
|
155
|
+
terminalOutput += msg;
|
|
156
|
+
});
|
|
157
|
+
return new Promise((res) => {
|
|
158
|
+
p.onExit((code) => {
|
|
159
|
+
// If the exit code is greater than 128, it's a special exit code for a signal
|
|
160
|
+
if (code >= 128) {
|
|
161
|
+
process.exit(code);
|
|
162
|
+
}
|
|
163
|
+
this.writeTerminalOutput(temporaryOutputPath, terminalOutput);
|
|
164
|
+
res({
|
|
165
|
+
code,
|
|
166
|
+
terminalOutput,
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
86
171
|
forkProcessPipeOutputCapture(task, { streamOutput, temporaryOutputPath, taskGraph, env, }) {
|
|
172
|
+
return this.forkProcessWithPrefixAndNotTTY(task, {
|
|
173
|
+
streamOutput,
|
|
174
|
+
temporaryOutputPath,
|
|
175
|
+
taskGraph,
|
|
176
|
+
env,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
forkProcessWithPrefixAndNotTTY(task, { streamOutput, temporaryOutputPath, taskGraph, env, }) {
|
|
87
180
|
return new Promise((res, rej) => {
|
|
88
181
|
try {
|
|
89
182
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
90
183
|
if (streamOutput) {
|
|
91
184
|
output_1.output.logCommand(args.join(' '));
|
|
92
|
-
output_1.output.addNewline();
|
|
93
185
|
}
|
|
94
186
|
const p = (0, child_process_1.fork)(this.cliPath, {
|
|
95
187
|
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
@@ -137,7 +229,7 @@ class ForkedProcessTaskRunner {
|
|
|
137
229
|
p.on('exit', (code, signal) => {
|
|
138
230
|
this.processes.delete(p);
|
|
139
231
|
if (code === null)
|
|
140
|
-
code =
|
|
232
|
+
code = (0, exit_codes_1.signalToCode)(signal);
|
|
141
233
|
// we didn't print any output as we were running the command
|
|
142
234
|
// print all the collected output|
|
|
143
235
|
const terminalOutput = outWithErr.join('');
|
|
@@ -160,7 +252,6 @@ class ForkedProcessTaskRunner {
|
|
|
160
252
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
161
253
|
if (streamOutput) {
|
|
162
254
|
output_1.output.logCommand(args.join(' '));
|
|
163
|
-
output_1.output.addNewline();
|
|
164
255
|
}
|
|
165
256
|
const p = (0, child_process_1.fork)(this.cliPath, {
|
|
166
257
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
@@ -182,7 +273,7 @@ class ForkedProcessTaskRunner {
|
|
|
182
273
|
});
|
|
183
274
|
p.on('exit', (code, signal) => {
|
|
184
275
|
if (code === null)
|
|
185
|
-
code =
|
|
276
|
+
code = (0, exit_codes_1.signalToCode)(signal);
|
|
186
277
|
// we didn't print any output as we were running the command
|
|
187
278
|
// print all the collected output
|
|
188
279
|
let terminalOutput = '';
|
|
@@ -219,20 +310,20 @@ class ForkedProcessTaskRunner {
|
|
|
219
310
|
writeTerminalOutput(outputPath, content) {
|
|
220
311
|
(0, fs_1.writeFileSync)(outputPath, content);
|
|
221
312
|
}
|
|
222
|
-
signalToCode(signal) {
|
|
223
|
-
if (signal === 'SIGHUP')
|
|
224
|
-
return 128 + 1;
|
|
225
|
-
if (signal === 'SIGINT')
|
|
226
|
-
return 128 + 2;
|
|
227
|
-
if (signal === 'SIGTERM')
|
|
228
|
-
return 128 + 15;
|
|
229
|
-
return 128;
|
|
230
|
-
}
|
|
231
313
|
setupProcessEventListeners() {
|
|
314
|
+
if (this.pseudoTerminal) {
|
|
315
|
+
this.pseudoTerminal.onMessageFromChildren((message) => {
|
|
316
|
+
process.send(message);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
232
319
|
// When the nx process gets a message, it will be sent into the task's process
|
|
233
320
|
process.on('message', (message) => {
|
|
321
|
+
// this.publisher.publish(message.toString());
|
|
322
|
+
if (this.pseudoTerminal) {
|
|
323
|
+
this.pseudoTerminal.sendMessageToChildren(message);
|
|
324
|
+
}
|
|
234
325
|
this.processes.forEach((p) => {
|
|
235
|
-
if (p.connected) {
|
|
326
|
+
if ('connected' in p && p.connected) {
|
|
236
327
|
p.send(message);
|
|
237
328
|
}
|
|
238
329
|
});
|
|
@@ -240,23 +331,23 @@ class ForkedProcessTaskRunner {
|
|
|
240
331
|
// Terminate any task processes on exit
|
|
241
332
|
process.on('exit', () => {
|
|
242
333
|
this.processes.forEach((p) => {
|
|
243
|
-
if (p.connected) {
|
|
334
|
+
if ('connected' in p ? p.connected : p.isAlive) {
|
|
244
335
|
p.kill();
|
|
245
336
|
}
|
|
246
337
|
});
|
|
247
338
|
});
|
|
248
339
|
process.on('SIGINT', () => {
|
|
249
340
|
this.processes.forEach((p) => {
|
|
250
|
-
if (p.connected) {
|
|
341
|
+
if ('connected' in p ? p.connected : p.isAlive) {
|
|
251
342
|
p.kill('SIGTERM');
|
|
252
343
|
}
|
|
253
344
|
});
|
|
254
345
|
// we exit here because we don't need to write anything to cache.
|
|
255
|
-
process.exit();
|
|
346
|
+
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
|
256
347
|
});
|
|
257
348
|
process.on('SIGTERM', () => {
|
|
258
349
|
this.processes.forEach((p) => {
|
|
259
|
-
if (p.connected) {
|
|
350
|
+
if ('connected' in p ? p.connected : p.isAlive) {
|
|
260
351
|
p.kill('SIGTERM');
|
|
261
352
|
}
|
|
262
353
|
});
|
|
@@ -265,7 +356,7 @@ class ForkedProcessTaskRunner {
|
|
|
265
356
|
});
|
|
266
357
|
process.on('SIGHUP', () => {
|
|
267
358
|
this.processes.forEach((p) => {
|
|
268
|
-
if (p.connected) {
|
|
359
|
+
if ('connected' in p ? p.connected : p.isAlive) {
|
|
269
360
|
p.kill('SIGTERM');
|
|
270
361
|
}
|
|
271
362
|
});
|
|
@@ -19,7 +19,7 @@ async function initTasksRunner(nxArgs) {
|
|
|
19
19
|
return {
|
|
20
20
|
invoke: async (opts) => {
|
|
21
21
|
perf_hooks_1.performance.mark('code-loading:end');
|
|
22
|
-
// TODO: This polyfills the outputs if someone doesn't pass a task with outputs. Remove this in Nx
|
|
22
|
+
// TODO: This polyfills the outputs if someone doesn't pass a task with outputs. Remove this in Nx 19
|
|
23
23
|
opts.tasks.forEach((t) => {
|
|
24
24
|
if (!t.outputs) {
|
|
25
25
|
t.outputs = (0, utils_1.getOutputs)(projectGraph.nodes, t.target, t.overrides);
|