nx 19.5.0-beta.0 → 19.5.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/init-local.js +2 -3
- package/package.json +12 -12
- package/schemas/project-schema.json +26 -0
- package/src/adapter/angular-json.js +6 -6
- package/src/adapter/decorate-cli.js +1 -2
- package/src/adapter/ngcli-adapter.js +8 -8
- package/src/adapter/rxjs-for-await.js +5 -5
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/affected/affected.js +2 -3
- package/src/command-line/connect/connect-to-nx-cloud.js +5 -6
- package/src/command-line/connect/view-logs.js +1 -2
- package/src/command-line/daemon/daemon.js +1 -2
- package/src/command-line/exec/exec.js +1 -2
- package/src/command-line/format/format.js +1 -2
- package/src/command-line/generate/generate.js +4 -5
- package/src/command-line/generate/generator-utils.js +2 -3
- package/src/command-line/graph/command-object.js +2 -2
- package/src/command-line/graph/graph.js +2 -3
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -2
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -2
- package/src/command-line/init/implementation/angular/index.js +1 -2
- package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -2
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -2
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -2
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +7 -7
- package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.js +1 -2
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +1 -2
- package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.js +1 -2
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -2
- package/src/command-line/init/implementation/react/clean-up-files.js +1 -2
- package/src/command-line/init/implementation/react/index.js +1 -2
- package/src/command-line/init/implementation/react/read-name-from-package-json.js +1 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +1 -2
- package/src/command-line/init/implementation/react/tsconfig-setup.js +1 -2
- package/src/command-line/init/implementation/react/write-craco-config.js +1 -2
- package/src/command-line/init/implementation/react/write-vite-config.js +1 -2
- package/src/command-line/init/implementation/react/write-vite-index-html.js +1 -2
- package/src/command-line/init/implementation/utils.js +10 -11
- package/src/command-line/init/init-v1.js +1 -2
- package/src/command-line/init/init-v2.js +1 -2
- package/src/command-line/list/list.js +1 -2
- package/src/command-line/migrate/migrate.d.ts +1 -1
- package/src/command-line/migrate/migrate.js +5 -5
- package/src/command-line/new/new.js +1 -2
- package/src/command-line/release/changelog.js +3 -3
- package/src/command-line/release/config/config.js +3 -3
- package/src/command-line/release/config/filter-release-groups.js +1 -2
- package/src/command-line/release/config/version-plans.js +3 -4
- package/src/command-line/release/plan.js +2 -2
- package/src/command-line/release/publish.js +2 -2
- package/src/command-line/release/release.js +2 -2
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +1 -2
- package/src/command-line/release/utils/exec-command.js +1 -2
- package/src/command-line/release/utils/git.js +11 -12
- package/src/command-line/release/utils/github.js +5 -6
- package/src/command-line/release/utils/launch-editor.js +1 -2
- package/src/command-line/release/utils/markdown.js +1 -2
- package/src/command-line/release/utils/print-changes.d.ts +0 -1
- package/src/command-line/release/utils/print-changes.js +2 -3
- package/src/command-line/release/utils/resolve-changelog-renderer.js +1 -2
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +1 -2
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -3
- package/src/command-line/release/utils/semver.js +4 -5
- package/src/command-line/release/utils/shared.js +6 -6
- package/src/command-line/release/version.js +2 -2
- package/src/command-line/repair/repair.js +1 -2
- package/src/command-line/report/report.js +27 -19
- package/src/command-line/reset/reset.js +1 -2
- package/src/command-line/run/executor-utils.js +2 -3
- package/src/command-line/run/run-one.js +1 -2
- package/src/command-line/run/run.js +5 -6
- package/src/command-line/run-many/run-many.js +2 -3
- package/src/command-line/show/project.js +1 -2
- package/src/command-line/show/projects.js +1 -2
- package/src/command-line/watch/watch.js +2 -2
- package/src/command-line/yargs-utils/documentation.js +1 -2
- package/src/command-line/yargs-utils/shared-options.js +12 -13
- package/src/commands-runner/create-command-graph.js +1 -2
- package/src/commands-runner/get-command-projects.js +1 -2
- package/src/config/calculate-default-project-name.js +2 -3
- package/src/config/configuration.js +2 -2
- package/src/config/nx-json.js +2 -3
- package/src/config/project-graph.js +3 -3
- package/src/config/schema-utils.js +3 -4
- package/src/config/task-graph.d.ts +4 -0
- package/src/config/to-project-name.js +1 -2
- package/src/config/workspace-json-project-json.d.ts +5 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/cache.js +6 -6
- package/src/daemon/client/client.d.ts +0 -2
- package/src/daemon/client/client.js +2 -2
- package/src/daemon/client/daemon-socket-messenger.d.ts +0 -1
- package/src/daemon/client/generate-help-output.js +1 -2
- package/src/daemon/is-on-daemon.js +1 -2
- package/src/daemon/message-types/get-context-file-data.js +2 -2
- package/src/daemon/message-types/get-files-in-directory.js +2 -2
- package/src/daemon/message-types/get-nx-workspace-files.js +2 -2
- package/src/daemon/message-types/glob.js +2 -2
- package/src/daemon/message-types/hash-glob.js +2 -2
- package/src/daemon/message-types/task-history.js +3 -3
- package/src/daemon/message-types/update-context-files.js +2 -2
- package/src/daemon/server/file-watching/changed-projects.js +1 -2
- package/src/daemon/server/file-watching/file-watcher-sockets.d.ts +0 -1
- package/src/daemon/server/file-watching/file-watcher-sockets.js +4 -4
- package/src/daemon/server/handle-context-file-data.js +1 -2
- package/src/daemon/server/handle-get-files-in-directory.js +1 -2
- package/src/daemon/server/handle-get-task-history.js +1 -2
- package/src/daemon/server/handle-glob.js +1 -2
- package/src/daemon/server/handle-hash-glob.js +1 -2
- package/src/daemon/server/handle-hash-tasks.js +1 -2
- package/src/daemon/server/handle-nx-workspace-files.js +1 -2
- package/src/daemon/server/handle-outputs-tracking.js +2 -3
- package/src/daemon/server/handle-process-in-background.js +1 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -2
- package/src/daemon/server/handle-request-shutdown.d.ts +0 -1
- package/src/daemon/server/handle-request-shutdown.js +1 -2
- package/src/daemon/server/handle-write-task-runs-to-history.js +1 -2
- package/src/daemon/server/outputs-tracking.js +7 -8
- package/src/daemon/server/plugins.js +2 -3
- package/src/daemon/server/project-graph-incremental-recomputation.js +3 -3
- package/src/daemon/server/server.d.ts +0 -1
- package/src/daemon/server/server.js +2 -3
- package/src/daemon/server/shutdown-utils.d.ts +0 -1
- package/src/daemon/server/shutdown-utils.js +9 -9
- package/src/daemon/server/watcher.d.ts +0 -1
- package/src/daemon/server/watcher.js +3 -4
- package/src/daemon/socket-utils.js +3 -3
- package/src/daemon/tmp-dir.js +6 -6
- package/src/executors/noop/noop.impl.js +1 -1
- package/src/executors/run-commands/run-commands.impl.js +3 -3
- package/src/executors/run-script/run-script.impl.js +1 -1
- package/src/executors/utils/convert-nx-executor.js +1 -2
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +1 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +1 -1
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +2 -3
- package/src/generators/testing-utils/create-tree.js +1 -2
- package/src/generators/tree.d.ts +0 -2
- package/src/generators/tree.js +3 -3
- package/src/generators/utils/glob.js +2 -3
- package/src/generators/utils/json.js +3 -4
- package/src/generators/utils/nx-json.js +2 -3
- package/src/generators/utils/project-configuration.js +7 -7
- package/src/hasher/create-task-hasher.js +1 -2
- package/src/hasher/file-hasher.js +2 -3
- package/src/hasher/hash-task.d.ts +0 -1
- package/src/hasher/hash-task.js +2 -3
- package/src/hasher/native-task-hasher-impl.d.ts +0 -1
- package/src/hasher/node-task-hasher-impl.d.ts +0 -1
- package/src/hasher/task-hasher.d.ts +0 -1
- package/src/hasher/task-hasher.js +10 -10
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +1 -1
- package/src/migrations/update-15-0-0/prefix-outputs.js +1 -1
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +1 -1
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +1 -1
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +1 -1
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +1 -1
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +1 -1
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +1 -1
- package/src/migrations/update-17-0-0/move-cache-directory.js +1 -1
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +1 -1
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +1 -1
- package/src/migrations/update-17-2-0/move-default-base.js +1 -1
- package/src/migrations/update-17-3-0/nx-release-path.js +2 -3
- package/src/migrations/update-17-3-0/update-nxw.js +1 -1
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +1 -1
- package/src/migrations/update-19-2-0/move-workspace-data-directory.js +3 -4
- package/src/migrations/update-19-2-4/set-project-name.js +1 -1
- package/src/native/assert-supported-platform.js +1 -2
- package/src/native/index.d.ts +1 -0
- package/src/native/native-file-cache-location.js +1 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/native/transform-objects.js +2 -2
- package/src/nx-cloud/debug-logger.js +1 -2
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -2
- package/src/nx-cloud/resolution-helpers.js +1 -2
- package/src/nx-cloud/update-manager.js +2 -2
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/get-cloud-options.js +1 -2
- package/src/nx-cloud/utilities/url-shorten.js +8 -9
- package/src/plugins/js/hasher/hasher.js +1 -2
- package/src/plugins/js/lock-file/lock-file.js +6 -6
- package/src/plugins/js/lock-file/npm-parser.js +3 -4
- package/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/src/plugins/js/lock-file/project-graph-pruning.js +1 -2
- package/src/plugins/js/lock-file/utils/package-json.js +2 -3
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +5 -6
- package/src/plugins/js/lock-file/yarn-parser.js +3 -4
- package/src/plugins/js/package-json/create-package-json.js +2 -3
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -2
- package/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +1 -2
- package/src/plugins/js/utils/config.js +1 -2
- package/src/plugins/js/utils/register.d.ts +1 -0
- package/src/plugins/js/utils/register.js +7 -8
- package/src/plugins/js/utils/resolve-relative-to-dir.js +1 -2
- package/src/plugins/js/utils/typescript.js +5 -6
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/src/plugins/package-json-workspaces/create-nodes.js +5 -5
- package/src/plugins/project-json/build-nodes/project-json.js +3 -3
- package/src/project-graph/affected/affected-project-graph.js +1 -2
- package/src/project-graph/build-project-graph.js +3 -4
- package/src/project-graph/error-types.js +11 -11
- package/src/project-graph/file-map-utils.js +4 -5
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +7 -7
- package/src/project-graph/nx-deps-cache.js +8 -8
- package/src/project-graph/operators.js +5 -5
- package/src/project-graph/plugins/internal-api.d.ts +1 -1
- package/src/project-graph/plugins/internal-api.js +13 -9
- package/src/project-graph/plugins/isolation/index.js +1 -2
- package/src/project-graph/plugins/isolation/messaging.d.ts +1 -3
- package/src/project-graph/plugins/isolation/messaging.js +4 -5
- package/src/project-graph/plugins/isolation/plugin-pool.js +1 -2
- package/src/project-graph/plugins/isolation/plugin-worker.js +6 -2
- package/src/project-graph/plugins/loader.js +7 -7
- package/src/project-graph/plugins/utils.js +4 -5
- package/src/project-graph/project-graph-builder.js +2 -2
- package/src/project-graph/project-graph.js +7 -8
- package/src/project-graph/utils/build-all-workspace-files.js +1 -2
- package/src/project-graph/utils/find-project-for-path.js +4 -5
- package/src/project-graph/utils/implicit-project-dependencies.js +1 -2
- package/src/project-graph/utils/normalize-project-nodes.js +2 -3
- package/src/project-graph/utils/project-configuration-utils.js +30 -14
- package/src/project-graph/utils/retrieve-workspace-files.js +6 -7
- package/src/tasks-runner/create-task-graph.d.ts +2 -1
- package/src/tasks-runner/create-task-graph.js +18 -33
- package/src/tasks-runner/forked-process-task-runner.d.ts +0 -1
- package/src/tasks-runner/init-tasks-runner.js +1 -2
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +1 -2
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +1 -2
- package/src/tasks-runner/life-cycles/formatting-utils.js +2 -3
- package/src/tasks-runner/life-cycles/pretty-time.js +1 -2
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -2
- package/src/tasks-runner/pseudo-ipc.d.ts +0 -1
- package/src/tasks-runner/pseudo-terminal.d.ts +0 -1
- package/src/tasks-runner/pseudo-terminal.js +2 -2
- package/src/tasks-runner/run-command.js +4 -5
- package/src/tasks-runner/task-env.d.ts +0 -1
- package/src/tasks-runner/task-env.js +5 -6
- package/src/tasks-runner/task-graph-utils.js +2 -3
- package/src/tasks-runner/task-orchestrator.js +8 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +28 -4
- package/src/tasks-runner/utils.d.ts +15 -2
- package/src/tasks-runner/utils.js +107 -43
- package/src/utils/ab-testing.js +2 -2
- package/src/utils/all-file-data.js +1 -2
- package/src/utils/assert-workspace-validity.js +1 -2
- package/src/utils/async-iterator.js +2 -3
- package/src/utils/cache-directory.js +2 -2
- package/src/utils/child-process.d.ts +0 -1
- package/src/utils/child-process.js +3 -3
- package/src/utils/chunkify.js +1 -2
- package/src/utils/code-frames.js +1 -2
- package/src/utils/collapse-expanded-outputs.js +1 -2
- package/src/utils/command-line-utils.js +5 -6
- package/src/utils/consume-messages-from-socket.js +1 -2
- package/src/utils/default-base.js +1 -2
- package/src/utils/dotenv.js +1 -2
- package/src/utils/exit-codes.d.ts +0 -1
- package/src/utils/exit-codes.js +1 -2
- package/src/utils/fileutils.d.ts +0 -1
- package/src/utils/fileutils.js +9 -10
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -2
- package/src/utils/get-package-name-from-import-path.js +1 -2
- package/src/utils/git-utils.js +4 -5
- package/src/utils/globs.d.ts +2 -0
- package/src/utils/globs.js +12 -2
- package/src/utils/ignore.js +4 -4
- package/src/utils/installation-directory.js +2 -3
- package/src/utils/is-ci.js +1 -2
- package/src/utils/json-diff.js +5 -5
- package/src/utils/json.js +3 -3
- package/src/utils/logger.js +2 -2
- package/src/utils/nx-cloud-utils.js +3 -4
- package/src/utils/nx-plugin.deprecated.js +1 -2
- package/src/utils/object-sort.js +1 -2
- package/src/utils/package-json.js +8 -9
- package/src/utils/package-manager.js +13 -14
- package/src/utils/params.js +14 -14
- package/src/utils/path.js +3 -4
- package/src/utils/plugins/community-plugins.js +1 -2
- package/src/utils/plugins/core-plugins.js +2 -3
- package/src/utils/plugins/installed-plugins.js +3 -4
- package/src/utils/plugins/local-plugins.js +2 -3
- package/src/utils/plugins/plugin-capabilities.js +2 -3
- package/src/utils/plugins/shared.js +1 -2
- package/src/utils/print-help.js +1 -2
- package/src/utils/project-graph-utils.js +4 -5
- package/src/utils/serializable-error.js +7 -2
- package/src/utils/serialize-overrides-into-command-line.js +1 -2
- package/src/utils/serialize-target.js +1 -2
- package/src/utils/split-target.js +2 -3
- package/src/utils/strip-indents.js +1 -2
- package/src/utils/task-history.js +3 -3
- package/src/utils/update-nxw.js +1 -2
- package/src/utils/workspace-configuration-check.js +1 -2
- package/src/utils/workspace-context.js +10 -11
- package/src/utils/workspace-root.js +3 -3
@@ -14,6 +14,7 @@ class TasksSchedule {
|
|
14
14
|
this.reverseProjectGraph = (0, operators_1.reverse)(this.projectGraph);
|
15
15
|
this.scheduledBatches = [];
|
16
16
|
this.scheduledTasks = [];
|
17
|
+
this.runningTasks = new Set();
|
17
18
|
this.completedTasks = new Set();
|
18
19
|
this.scheduleRequestsExecutionChain = Promise.resolve();
|
19
20
|
}
|
@@ -31,6 +32,7 @@ class TasksSchedule {
|
|
31
32
|
complete(taskIds) {
|
32
33
|
for (const taskId of taskIds) {
|
33
34
|
this.completedTasks.add(taskId);
|
35
|
+
this.runningTasks.delete(taskId);
|
34
36
|
}
|
35
37
|
this.notScheduledTaskGraph = (0, utils_1.removeTasksFromTaskGraph)(this.notScheduledTaskGraph, taskIds);
|
36
38
|
}
|
@@ -84,6 +86,7 @@ class TasksSchedule {
|
|
84
86
|
(0, project_graph_utils_1.findAllProjectNodeDependencies)(project1, this.reverseProjectGraph)
|
85
87
|
.length);
|
86
88
|
});
|
89
|
+
this.runningTasks.add(taskId);
|
87
90
|
}
|
88
91
|
async scheduleBatches() {
|
89
92
|
const batchMap = {};
|
@@ -102,7 +105,7 @@ class TasksSchedule {
|
|
102
105
|
this.scheduledBatches.push({ executorName, taskGraph });
|
103
106
|
}
|
104
107
|
async processTaskForBatches(batches, task, rootExecutorName, isRoot) {
|
105
|
-
if (!this.canBatchTaskBeScheduled(task
|
108
|
+
if (!this.canBatchTaskBeScheduled(task, batches[rootExecutorName])) {
|
106
109
|
return;
|
107
110
|
}
|
108
111
|
const { batchImplementationFactory } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
@@ -131,12 +134,33 @@ class TasksSchedule {
|
|
131
134
|
await this.processTaskForBatches(batches, depTask, rootExecutorName, false);
|
132
135
|
}
|
133
136
|
}
|
134
|
-
canBatchTaskBeScheduled(
|
137
|
+
canBatchTaskBeScheduled(task, batchTaskGraph) {
|
138
|
+
// task self needs to have parallelism true
|
135
139
|
// all deps have either completed or belong to the same batch
|
136
|
-
return
|
140
|
+
return (task.parallelism === true &&
|
141
|
+
this.taskGraph.dependencies[task.id].every((id) => this.completedTasks.has(id) || !!batchTaskGraph?.tasks[id]));
|
137
142
|
}
|
138
143
|
canBeScheduled(taskId) {
|
139
|
-
|
144
|
+
const hasDependenciesCompleted = this.taskGraph.dependencies[taskId].every((id) => this.completedTasks.has(id));
|
145
|
+
// if dependencies have not completed, cannot schedule
|
146
|
+
if (!hasDependenciesCompleted) {
|
147
|
+
return false;
|
148
|
+
}
|
149
|
+
// if there are no running tasks, can schedule anything
|
150
|
+
if (this.runningTasks.size === 0) {
|
151
|
+
return true;
|
152
|
+
}
|
153
|
+
const runningTasksNotSupportParallelism = Array.from(this.runningTasks).some((taskId) => {
|
154
|
+
return this.taskGraph.tasks[taskId].parallelism === false;
|
155
|
+
});
|
156
|
+
if (runningTasksNotSupportParallelism) {
|
157
|
+
// if any running tasks do not support parallelism, no other tasks can be scheduled
|
158
|
+
return false;
|
159
|
+
}
|
160
|
+
else {
|
161
|
+
// if all running tasks support parallelism, can only schedule task with parallelism
|
162
|
+
return this.taskGraph.tasks[taskId].parallelism === true;
|
163
|
+
}
|
140
164
|
}
|
141
165
|
}
|
142
166
|
exports.TasksSchedule = TasksSchedule;
|
@@ -2,12 +2,25 @@ import { Task, TaskGraph } from '../config/task-graph';
|
|
2
2
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
3
3
|
import { TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
4
4
|
import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
5
|
+
export type NormalizedTargetDependencyConfig = TargetDependencyConfig & {
|
6
|
+
projects: string[];
|
7
|
+
};
|
5
8
|
export declare function getDependencyConfigs({ project, target }: {
|
6
9
|
project: string;
|
7
10
|
target: string;
|
8
|
-
}, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph):
|
9
|
-
export declare function
|
11
|
+
}, extraTargetDependencies: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph, allTargetNames: string[]): NormalizedTargetDependencyConfig[] | undefined;
|
12
|
+
export declare function normalizeDependencyConfigDefinition(definition: string | TargetDependencyConfig, currentProject: string, graph: ProjectGraph, allTargetNames: string[]): NormalizedTargetDependencyConfig[];
|
13
|
+
export declare function normalizeDependencyConfigProjects(dependencyConfig: TargetDependencyConfig, currentProject: string, graph: ProjectGraph): NormalizedTargetDependencyConfig;
|
14
|
+
export declare function expandDependencyConfigSyntaxSugar(dependencyConfigString: string | TargetDependencyConfig, graph: ProjectGraph): TargetDependencyConfig;
|
15
|
+
export declare function expandWildcardTargetConfiguration(dependencyConfig: NormalizedTargetDependencyConfig, allTargetNames: string[]): NormalizedTargetDependencyConfig[];
|
16
|
+
export declare function readProjectAndTargetFromTargetString(targetString: string, projects: Record<string, ProjectGraphProjectNode>): {
|
17
|
+
projects?: string[];
|
18
|
+
target: string;
|
19
|
+
};
|
10
20
|
export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>, target: Task['target'], overrides: Task['overrides']): string[];
|
21
|
+
export declare function normalizeTargetDependencyWithStringProjects(dependencyConfig: TargetDependencyConfig): Omit<TargetDependencyConfig, 'projects'> & {
|
22
|
+
projects: string[];
|
23
|
+
};
|
11
24
|
declare class InvalidOutputsError extends Error {
|
12
25
|
outputs: string[];
|
13
26
|
invalidOutputs: Set<string>;
|
@@ -1,7 +1,30 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
3
|
+
exports.getDependencyConfigs = getDependencyConfigs;
|
4
|
+
exports.normalizeDependencyConfigDefinition = normalizeDependencyConfigDefinition;
|
5
|
+
exports.normalizeDependencyConfigProjects = normalizeDependencyConfigProjects;
|
6
|
+
exports.expandDependencyConfigSyntaxSugar = expandDependencyConfigSyntaxSugar;
|
7
|
+
exports.expandWildcardTargetConfiguration = expandWildcardTargetConfiguration;
|
8
|
+
exports.readProjectAndTargetFromTargetString = readProjectAndTargetFromTargetString;
|
9
|
+
exports.getOutputs = getOutputs;
|
10
|
+
exports.normalizeTargetDependencyWithStringProjects = normalizeTargetDependencyWithStringProjects;
|
11
|
+
exports.validateOutputs = validateOutputs;
|
12
|
+
exports.transformLegacyOutputs = transformLegacyOutputs;
|
13
|
+
exports.getOutputsForTargetAndConfiguration = getOutputsForTargetAndConfiguration;
|
14
|
+
exports.interpolate = interpolate;
|
15
|
+
exports.getTargetConfigurationForTask = getTargetConfigurationForTask;
|
16
|
+
exports.getExecutorNameForTask = getExecutorNameForTask;
|
17
|
+
exports.getExecutorForTask = getExecutorForTask;
|
18
|
+
exports.getCustomHasher = getCustomHasher;
|
19
|
+
exports.removeTasksFromTaskGraph = removeTasksFromTaskGraph;
|
20
|
+
exports.removeIdsFromGraph = removeIdsFromGraph;
|
21
|
+
exports.calculateReverseDeps = calculateReverseDeps;
|
22
|
+
exports.getCliPath = getCliPath;
|
23
|
+
exports.getPrintableCommandArgsForTask = getPrintableCommandArgsForTask;
|
24
|
+
exports.getSerializedArgsForTask = getSerializedArgsForTask;
|
25
|
+
exports.shouldStreamOutput = shouldStreamOutput;
|
26
|
+
exports.isCacheableTask = isCacheableTask;
|
27
|
+
exports.unparse = unparse;
|
5
28
|
const path_1 = require("path");
|
6
29
|
const posix_1 = require("path/posix");
|
7
30
|
const workspace_root_1 = require("../utils/workspace-root");
|
@@ -11,28 +34,33 @@ const serialize_overrides_into_command_line_1 = require("../utils/serialize-over
|
|
11
34
|
const split_target_1 = require("../utils/split-target");
|
12
35
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
13
36
|
const project_graph_1 = require("../project-graph/project-graph");
|
14
|
-
|
37
|
+
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
38
|
+
const minimatch_1 = require("minimatch");
|
39
|
+
const globs_1 = require("../utils/globs");
|
40
|
+
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) {
|
15
41
|
const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
16
42
|
// This is passed into `run-command` from programmatic invocations
|
17
43
|
extraTargetDependencies[target] ??
|
18
|
-
[]).
|
19
|
-
? expandDependencyConfigSyntaxSugar(config, projectGraph)
|
20
|
-
: config);
|
21
|
-
for (const dependencyConfig of dependencyConfigs) {
|
22
|
-
if (dependencyConfig.projects && dependencyConfig.dependencies) {
|
23
|
-
output_1.output.error({
|
24
|
-
title: `dependsOn is improperly configured for ${project}:${target}`,
|
25
|
-
bodyLines: [
|
26
|
-
`dependsOn.projects and dependsOn.dependencies cannot be used together.`,
|
27
|
-
],
|
28
|
-
});
|
29
|
-
process.exit(1);
|
30
|
-
}
|
31
|
-
}
|
44
|
+
[]).flatMap((config) => normalizeDependencyConfigDefinition(config, project, projectGraph, allTargetNames));
|
32
45
|
return dependencyConfigs;
|
33
46
|
}
|
34
|
-
|
47
|
+
function normalizeDependencyConfigDefinition(definition, currentProject, graph, allTargetNames) {
|
48
|
+
return expandWildcardTargetConfiguration(normalizeDependencyConfigProjects(expandDependencyConfigSyntaxSugar(definition, graph), currentProject, graph), allTargetNames);
|
49
|
+
}
|
50
|
+
function normalizeDependencyConfigProjects(dependencyConfig, currentProject, graph) {
|
51
|
+
const noStringConfig = normalizeTargetDependencyWithStringProjects(dependencyConfig);
|
52
|
+
if (noStringConfig.projects) {
|
53
|
+
dependencyConfig.projects = (0, find_matching_projects_1.findMatchingProjects)(noStringConfig.projects, graph.nodes);
|
54
|
+
}
|
55
|
+
else if (!noStringConfig.dependencies) {
|
56
|
+
dependencyConfig.projects = [currentProject];
|
57
|
+
}
|
58
|
+
return dependencyConfig;
|
59
|
+
}
|
35
60
|
function expandDependencyConfigSyntaxSugar(dependencyConfigString, graph) {
|
61
|
+
if (typeof dependencyConfigString !== 'string') {
|
62
|
+
return dependencyConfigString;
|
63
|
+
}
|
36
64
|
const [dependencies, targetString] = dependencyConfigString.startsWith('^')
|
37
65
|
? [true, dependencyConfigString.substring(1)]
|
38
66
|
: [false, dependencyConfigString];
|
@@ -44,26 +72,79 @@ function expandDependencyConfigSyntaxSugar(dependencyConfigString, graph) {
|
|
44
72
|
dependencies: true,
|
45
73
|
};
|
46
74
|
}
|
75
|
+
const { projects, target } = readProjectAndTargetFromTargetString(targetString, graph.nodes);
|
76
|
+
return projects ? { projects, target } : { target };
|
77
|
+
}
|
78
|
+
// Weakmap let's the cache get cleared by garbage collector if allTargetNames is no longer used
|
79
|
+
const patternResultCache = new WeakMap();
|
80
|
+
function expandWildcardTargetConfiguration(dependencyConfig, allTargetNames) {
|
81
|
+
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) {
|
82
|
+
return [dependencyConfig];
|
83
|
+
}
|
84
|
+
let cache = patternResultCache.get(allTargetNames);
|
85
|
+
if (!cache) {
|
86
|
+
cache = new Map();
|
87
|
+
patternResultCache.set(allTargetNames, cache);
|
88
|
+
}
|
89
|
+
const cachedResult = cache.get(dependencyConfig.target);
|
90
|
+
if (cachedResult) {
|
91
|
+
return cachedResult;
|
92
|
+
}
|
93
|
+
const matcher = minimatch_1.minimatch.filter(dependencyConfig.target);
|
94
|
+
const matchingTargets = allTargetNames.filter((t) => matcher(t));
|
95
|
+
const result = matchingTargets.map((t) => ({
|
96
|
+
...dependencyConfig,
|
97
|
+
target: t,
|
98
|
+
}));
|
99
|
+
cache.set(dependencyConfig.target, result);
|
100
|
+
return result;
|
101
|
+
}
|
102
|
+
function readProjectAndTargetFromTargetString(targetString, projects) {
|
47
103
|
// Support for both `project:target` and `target:with:colons` syntax
|
48
104
|
const [maybeProject, ...segments] = (0, split_target_1.splitByColons)(targetString);
|
49
|
-
// if no additional segments are provided, then the string references
|
50
|
-
// a target of the same project
|
51
105
|
if (!segments.length) {
|
106
|
+
// if no additional segments are provided, then the string references
|
107
|
+
// a target of the same project
|
52
108
|
return { target: maybeProject };
|
53
109
|
}
|
54
|
-
|
110
|
+
else if (maybeProject in projects) {
|
55
111
|
// Only the first segment could be a project. If it is, the rest is a target.
|
56
112
|
// If its not, then the whole targetString was a target with colons in its name.
|
57
|
-
|
113
|
+
return { projects: [maybeProject], target: segments.join(':') };
|
114
|
+
}
|
115
|
+
else {
|
58
116
|
// If the first segment is a project, then we have a specific project. Otherwise, we don't.
|
59
|
-
|
60
|
-
}
|
117
|
+
return { target: targetString };
|
118
|
+
}
|
61
119
|
}
|
62
|
-
exports.expandDependencyConfigSyntaxSugar = expandDependencyConfigSyntaxSugar;
|
63
120
|
function getOutputs(p, target, overrides) {
|
64
121
|
return getOutputsForTargetAndConfiguration(target, overrides, p[target.project]);
|
65
122
|
}
|
66
|
-
|
123
|
+
function normalizeTargetDependencyWithStringProjects(dependencyConfig) {
|
124
|
+
if (typeof dependencyConfig.projects === 'string') {
|
125
|
+
/** LERNA SUPPORT START - Remove in v20 */
|
126
|
+
// Lerna uses `dependencies` in `prepNxOptions`, so we need to maintain
|
127
|
+
// support for it until lerna can be updated to use the syntax.
|
128
|
+
//
|
129
|
+
// This should have been removed in v17, but the updates to lerna had not
|
130
|
+
// been made yet.
|
131
|
+
//
|
132
|
+
// TODO(@agentender): Remove this part in v20
|
133
|
+
if (dependencyConfig.projects === 'self') {
|
134
|
+
delete dependencyConfig.projects;
|
135
|
+
}
|
136
|
+
else if (dependencyConfig.projects === 'dependencies') {
|
137
|
+
dependencyConfig.dependencies = true;
|
138
|
+
delete dependencyConfig.projects;
|
139
|
+
return;
|
140
|
+
/** LERNA SUPPORT END - Remove in v20 */
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
dependencyConfig.projects = [dependencyConfig.projects];
|
144
|
+
}
|
145
|
+
}
|
146
|
+
return dependencyConfig;
|
147
|
+
}
|
67
148
|
class InvalidOutputsError extends Error {
|
68
149
|
constructor(outputs, invalidOutputs) {
|
69
150
|
super(InvalidOutputsError.createMessage(invalidOutputs));
|
@@ -103,7 +184,6 @@ function validateOutputs(outputs) {
|
|
103
184
|
throw new InvalidOutputsError(outputs, invalidOutputs);
|
104
185
|
}
|
105
186
|
}
|
106
|
-
exports.validateOutputs = validateOutputs;
|
107
187
|
function transformLegacyOutputs(projectRoot, error) {
|
108
188
|
return error.outputs.map((output) => {
|
109
189
|
if (!error.invalidOutputs.has(output)) {
|
@@ -120,7 +200,6 @@ function transformLegacyOutputs(projectRoot, error) {
|
|
120
200
|
(0, path_2.joinPathFragments)(isWithinProject ? '{projectRoot}' : '{workspaceRoot}', isWithinProject ? relativePath : outputPath));
|
121
201
|
});
|
122
202
|
}
|
123
|
-
exports.transformLegacyOutputs = transformLegacyOutputs;
|
124
203
|
/**
|
125
204
|
* Returns the list of outputs that will be cached.
|
126
205
|
*/
|
@@ -166,7 +245,6 @@ function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode,
|
|
166
245
|
return [];
|
167
246
|
}
|
168
247
|
}
|
169
|
-
exports.getOutputsForTargetAndConfiguration = getOutputsForTargetAndConfiguration;
|
170
248
|
/**
|
171
249
|
* Matches portions of a string which need to be interpolated.
|
172
250
|
* Matches anything within curly braces, excluding the braces.
|
@@ -186,7 +264,6 @@ function interpolate(template, data) {
|
|
186
264
|
const parts = template.split('/').map((s) => _interpolate(s, data));
|
187
265
|
return (0, posix_1.join)(...parts).replace('{workspaceRoot}/', '');
|
188
266
|
}
|
189
|
-
exports.interpolate = interpolate;
|
190
267
|
function _interpolate(template, data) {
|
191
268
|
let res = template;
|
192
269
|
if (data.projectRoot == '.') {
|
@@ -208,22 +285,18 @@ function getTargetConfigurationForTask(task, projectGraph) {
|
|
208
285
|
const project = projectGraph.nodes[task.target.project].data;
|
209
286
|
return project.targets[task.target.target];
|
210
287
|
}
|
211
|
-
exports.getTargetConfigurationForTask = getTargetConfigurationForTask;
|
212
288
|
function getExecutorNameForTask(task, projectGraph) {
|
213
289
|
return getTargetConfigurationForTask(task, projectGraph)?.executor;
|
214
290
|
}
|
215
|
-
exports.getExecutorNameForTask = getExecutorNameForTask;
|
216
291
|
function getExecutorForTask(task, projectGraph) {
|
217
292
|
const executor = getExecutorNameForTask(task, projectGraph);
|
218
293
|
const [nodeModule, executorName] = executor.split(':');
|
219
294
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects);
|
220
295
|
}
|
221
|
-
exports.getExecutorForTask = getExecutorForTask;
|
222
296
|
function getCustomHasher(task, projectGraph) {
|
223
297
|
const factory = getExecutorForTask(task, projectGraph).hasherFactory;
|
224
298
|
return factory ? factory() : null;
|
225
299
|
}
|
226
|
-
exports.getCustomHasher = getCustomHasher;
|
227
300
|
function removeTasksFromTaskGraph(graph, ids) {
|
228
301
|
const newGraph = removeIdsFromGraph(graph, ids, graph.tasks);
|
229
302
|
return {
|
@@ -232,7 +305,6 @@ function removeTasksFromTaskGraph(graph, ids) {
|
|
232
305
|
tasks: newGraph.mapWithIds,
|
233
306
|
};
|
234
307
|
}
|
235
|
-
exports.removeTasksFromTaskGraph = removeTasksFromTaskGraph;
|
236
308
|
function removeIdsFromGraph(graph, ids, mapWithIds) {
|
237
309
|
const filteredMapWithIds = {};
|
238
310
|
const dependencies = {};
|
@@ -249,7 +321,6 @@ function removeIdsFromGraph(graph, ids, mapWithIds) {
|
|
249
321
|
roots: Object.keys(dependencies).filter((k) => dependencies[k].length === 0),
|
250
322
|
};
|
251
323
|
}
|
252
|
-
exports.removeIdsFromGraph = removeIdsFromGraph;
|
253
324
|
function calculateReverseDeps(taskGraph) {
|
254
325
|
const reverseTaskDeps = {};
|
255
326
|
Object.keys(taskGraph.tasks).forEach((t) => {
|
@@ -262,11 +333,9 @@ function calculateReverseDeps(taskGraph) {
|
|
262
333
|
});
|
263
334
|
return reverseTaskDeps;
|
264
335
|
}
|
265
|
-
exports.calculateReverseDeps = calculateReverseDeps;
|
266
336
|
function getCliPath() {
|
267
337
|
return require.resolve(`../../bin/run-executor.js`);
|
268
338
|
}
|
269
|
-
exports.getCliPath = getCliPath;
|
270
339
|
function getPrintableCommandArgsForTask(task) {
|
271
340
|
const args = task.overrides['__overrides_unparsed__'];
|
272
341
|
const target = task.target.target.includes(':')
|
@@ -277,7 +346,6 @@ function getPrintableCommandArgsForTask(task) {
|
|
277
346
|
: '';
|
278
347
|
return ['run', `${task.target.project}:${target}${config}`, ...args];
|
279
348
|
}
|
280
|
-
exports.getPrintableCommandArgsForTask = getPrintableCommandArgsForTask;
|
281
349
|
function getSerializedArgsForTask(task, isVerbose) {
|
282
350
|
return [
|
283
351
|
JSON.stringify({
|
@@ -287,7 +355,6 @@ function getSerializedArgsForTask(task, isVerbose) {
|
|
287
355
|
}),
|
288
356
|
];
|
289
357
|
}
|
290
|
-
exports.getSerializedArgsForTask = getSerializedArgsForTask;
|
291
358
|
function shouldStreamOutput(task, initiatingProject) {
|
292
359
|
if (process.env.NX_STREAM_OUTPUT === 'true')
|
293
360
|
return true;
|
@@ -297,7 +364,6 @@ function shouldStreamOutput(task, initiatingProject) {
|
|
297
364
|
return true;
|
298
365
|
return false;
|
299
366
|
}
|
300
|
-
exports.shouldStreamOutput = shouldStreamOutput;
|
301
367
|
function isCacheableTask(task, options) {
|
302
368
|
if (task.cache !== undefined && !longRunningTask(task)) {
|
303
369
|
return task.cache;
|
@@ -307,7 +373,6 @@ function isCacheableTask(task, options) {
|
|
307
373
|
cacheable.indexOf(task.target.target) > -1 &&
|
308
374
|
!longRunningTask(task));
|
309
375
|
}
|
310
|
-
exports.isCacheableTask = isCacheableTask;
|
311
376
|
function longRunningTask(task) {
|
312
377
|
const t = task.target.target;
|
313
378
|
return ((!!task.overrides['watch'] && task.overrides['watch'] !== 'false') ||
|
@@ -321,4 +386,3 @@ function longRunningTask(task) {
|
|
321
386
|
function unparse(options) {
|
322
387
|
return (0, serialize_overrides_into_command_line_1.serializeOverridesIntoCommandLine)(options);
|
323
388
|
}
|
324
|
-
exports.unparse = unparse;
|
package/src/utils/ab-testing.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.messages = exports.PromptMessages = void 0;
|
4
|
+
exports.recordStat = recordStat;
|
4
5
|
const node_child_process_1 = require("node:child_process");
|
5
6
|
const is_ci_1 = require("./is-ci");
|
6
7
|
const package_manager_1 = require("./package-manager");
|
@@ -87,7 +88,6 @@ async function recordStat(opts) {
|
|
87
88
|
}
|
88
89
|
}
|
89
90
|
}
|
90
|
-
exports.recordStat = recordStat;
|
91
91
|
function shouldRecordStats() {
|
92
92
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
93
93
|
if (!pmc.getRegistryUrl) {
|
@@ -1,9 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.allFileData =
|
3
|
+
exports.allFileData = allFileData;
|
4
4
|
const workspace_context_1 = require("./workspace-context");
|
5
5
|
const workspace_root_1 = require("./workspace-root");
|
6
6
|
function allFileData() {
|
7
7
|
return (0, workspace_context_1.getAllFileDataInContext)(workspace_root_1.workspaceRoot);
|
8
8
|
}
|
9
|
-
exports.allFileData = allFileData;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.assertWorkspaceValidity =
|
3
|
+
exports.assertWorkspaceValidity = assertWorkspaceValidity;
|
4
4
|
const find_matching_projects_1 = require("./find-matching-projects");
|
5
5
|
const output_1 = require("./output");
|
6
6
|
const devkit_internals_1 = require("../devkit-internals");
|
@@ -70,7 +70,6 @@ function assertWorkspaceValidity(projects, nxJson) {
|
|
70
70
|
}
|
71
71
|
throw new devkit_internals_1.WorkspaceValidityError(message);
|
72
72
|
}
|
73
|
-
exports.assertWorkspaceValidity = assertWorkspaceValidity;
|
74
73
|
function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDeps, projectConfigurations, projects) {
|
75
74
|
const invalidProjectsOrGlobs = desiredImplicitDeps.filter((implicit) => {
|
76
75
|
const projectName = implicit.startsWith('!')
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.isAsyncIterator = isAsyncIterator;
|
4
|
+
exports.getLastValueFromAsyncIterableIterator = getLastValueFromAsyncIterableIterator;
|
4
5
|
function isAsyncIterator(v) {
|
5
6
|
return typeof v?.[Symbol.asyncIterator] === 'function';
|
6
7
|
}
|
7
|
-
exports.isAsyncIterator = isAsyncIterator;
|
8
8
|
async function getLastValueFromAsyncIterableIterator(i) {
|
9
9
|
let prev;
|
10
10
|
let current;
|
@@ -16,4 +16,3 @@ async function getLastValueFromAsyncIterableIterator(i) {
|
|
16
16
|
} while (!current.done);
|
17
17
|
return current.value !== undefined || !prev ? current.value : prev.value;
|
18
18
|
}
|
19
|
-
exports.getLastValueFromAsyncIterableIterator = getLastValueFromAsyncIterableIterator;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.workspaceDataDirectory = exports.
|
3
|
+
exports.workspaceDataDirectory = exports.cacheDir = void 0;
|
4
|
+
exports.cacheDirectoryForWorkspace = cacheDirectoryForWorkspace;
|
4
5
|
const fs_1 = require("fs");
|
5
6
|
const path_1 = require("path");
|
6
7
|
const fileutils_1 = require("./fileutils");
|
@@ -61,7 +62,6 @@ exports.cacheDir = cacheDirectory(workspace_root_1.workspaceRoot, readCacheDirec
|
|
61
62
|
function cacheDirectoryForWorkspace(workspaceRoot) {
|
62
63
|
return cacheDirectory(workspaceRoot, readCacheDirectoryProperty(workspaceRoot));
|
63
64
|
}
|
64
|
-
exports.cacheDirectoryForWorkspace = cacheDirectoryForWorkspace;
|
65
65
|
exports.workspaceDataDirectory = absolutePath(workspace_root_1.workspaceRoot, process.env.NX_WORKSPACE_DATA_DIRECTORY ??
|
66
66
|
process.env.NX_PROJECT_GRAPH_CACHE_DIRECTORY ??
|
67
67
|
defaultWorkspaceDataDirectory(workspace_root_1.workspaceRoot));
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.PseudoTtyProcess =
|
3
|
+
exports.PseudoTtyProcess = void 0;
|
4
|
+
exports.runNxSync = runNxSync;
|
5
|
+
exports.runNxAsync = runNxAsync;
|
4
6
|
const child_process_1 = require("child_process");
|
5
7
|
const fs_1 = require("fs");
|
6
8
|
const path_1 = require("path");
|
@@ -24,7 +26,6 @@ function runNxSync(cmd, options) {
|
|
24
26
|
}
|
25
27
|
(0, child_process_1.execSync)(`${baseCmd} ${cmd}`, options);
|
26
28
|
}
|
27
|
-
exports.runNxSync = runNxSync;
|
28
29
|
async function runNxAsync(cmd, options) {
|
29
30
|
let baseCmd;
|
30
31
|
if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'))) {
|
@@ -60,7 +61,6 @@ async function runNxAsync(cmd, options) {
|
|
60
61
|
}
|
61
62
|
});
|
62
63
|
}
|
63
|
-
exports.runNxAsync = runNxAsync;
|
64
64
|
function messageToCode(message) {
|
65
65
|
if (message.startsWith('Terminated by ')) {
|
66
66
|
switch (message.replace('Terminated by ', '').trim()) {
|
package/src/utils/chunkify.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.chunkify =
|
3
|
+
exports.chunkify = chunkify;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const TERMINAL_SIZE = process.platform === 'win32' ? 8192 : getUnixTerminalSize();
|
6
6
|
function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500) {
|
@@ -23,7 +23,6 @@ function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500) {
|
|
23
23
|
chunks.push(currentChunk);
|
24
24
|
return chunks;
|
25
25
|
}
|
26
|
-
exports.chunkify = chunkify;
|
27
26
|
function getUnixTerminalSize() {
|
28
27
|
try {
|
29
28
|
const argMax = (0, child_process_1.execSync)('getconf ARG_MAX').toString().trim();
|
package/src/utils/code-frames.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.codeFrameColumns =
|
3
|
+
exports.codeFrameColumns = codeFrameColumns;
|
4
4
|
// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js
|
5
5
|
const chalk = require("chalk");
|
6
6
|
/**
|
@@ -116,4 +116,3 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
116
116
|
.join('\n');
|
117
117
|
return chalk.reset(frame);
|
118
118
|
}
|
119
|
-
exports.codeFrameColumns = codeFrameColumns;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.collapseExpandedOutputs =
|
3
|
+
exports.collapseExpandedOutputs = collapseExpandedOutputs;
|
4
4
|
const path_1 = require("path");
|
5
5
|
/**
|
6
6
|
* Heuristic to prevent writing too many hash files
|
@@ -38,4 +38,3 @@ function collapseExpandedOutputs(expandedOutputs) {
|
|
38
38
|
// If the first level has too many outputs, return that one.
|
39
39
|
return Array.from(tree[Math.max(0, j - 1)]);
|
40
40
|
}
|
41
|
-
exports.collapseExpandedOutputs = collapseExpandedOutputs;
|
@@ -1,6 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createOverrides = createOverrides;
|
4
|
+
exports.splitArgsIntoNxArgsAndOverrides = splitArgsIntoNxArgsAndOverrides;
|
5
|
+
exports.parseFiles = parseFiles;
|
6
|
+
exports.getProjectRoots = getProjectRoots;
|
7
|
+
exports.readGraphFileFromGraphArg = readGraphFileFromGraphArg;
|
4
8
|
const yargsParser = require("yargs-parser");
|
5
9
|
const file_utils_1 = require("../project-graph/file-utils");
|
6
10
|
const output_1 = require("./output");
|
@@ -19,7 +23,6 @@ function createOverrides(__overrides_unparsed__ = []) {
|
|
19
23
|
overrides.__overrides_unparsed__ = __overrides_unparsed__;
|
20
24
|
return overrides;
|
21
25
|
}
|
22
|
-
exports.createOverrides = createOverrides;
|
23
26
|
function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings: true }, nxJson) {
|
24
27
|
// this is to lerna case when this function is invoked imperatively
|
25
28
|
if (args['target'] && !args['targets']) {
|
@@ -127,7 +130,6 @@ function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings:
|
|
127
130
|
}
|
128
131
|
return { nxArgs, overrides };
|
129
132
|
}
|
130
|
-
exports.splitArgsIntoNxArgsAndOverrides = splitArgsIntoNxArgsAndOverrides;
|
131
133
|
function normalizeNxArgsRunner(nxArgs, nxJson, options) {
|
132
134
|
if (!nxArgs.runner) {
|
133
135
|
// TODO: Remove NX_RUNNER environment variable support in Nx v17
|
@@ -201,7 +203,6 @@ function parseFiles(options) {
|
|
201
203
|
};
|
202
204
|
}
|
203
205
|
}
|
204
|
-
exports.parseFiles = parseFiles;
|
205
206
|
function getUncommittedFiles() {
|
206
207
|
return parseGitOutput(`git diff --name-only --no-renames --relative HEAD .`);
|
207
208
|
}
|
@@ -246,10 +247,8 @@ function parseGitOutput(command) {
|
|
246
247
|
function getProjectRoots(projectNames, { nodes }) {
|
247
248
|
return projectNames.map((name) => nodes[name].data.root);
|
248
249
|
}
|
249
|
-
exports.getProjectRoots = getProjectRoots;
|
250
250
|
function readGraphFileFromGraphArg({ graph }) {
|
251
251
|
return typeof graph === 'string' && graph !== 'true' && graph !== ''
|
252
252
|
? graph
|
253
253
|
: undefined;
|
254
254
|
}
|
255
|
-
exports.readGraphFileFromGraphArg = readGraphFileFromGraphArg;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.consumeMessagesFromSocket =
|
3
|
+
exports.consumeMessagesFromSocket = consumeMessagesFromSocket;
|
4
4
|
function consumeMessagesFromSocket(callback) {
|
5
5
|
let message = '';
|
6
6
|
return (data) => {
|
@@ -19,4 +19,3 @@ function consumeMessagesFromSocket(callback) {
|
|
19
19
|
}
|
20
20
|
};
|
21
21
|
}
|
22
|
-
exports.consumeMessagesFromSocket = consumeMessagesFromSocket;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.deduceDefaultBase =
|
3
|
+
exports.deduceDefaultBase = deduceDefaultBase;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
function deduceDefaultBase() {
|
6
6
|
const nxDefaultBase = 'main';
|
@@ -12,4 +12,3 @@ function deduceDefaultBase() {
|
|
12
12
|
return nxDefaultBase;
|
13
13
|
}
|
14
14
|
}
|
15
|
-
exports.deduceDefaultBase = deduceDefaultBase;
|
package/src/utils/dotenv.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.loadRootEnvFiles =
|
3
|
+
exports.loadRootEnvFiles = loadRootEnvFiles;
|
4
4
|
const dotenv_1 = require("dotenv");
|
5
5
|
const dotenv_expand_1 = require("dotenv-expand");
|
6
6
|
const workspace_root_1 = require("./workspace-root");
|
@@ -19,4 +19,3 @@ function loadRootEnvFiles(root = workspace_root_1.workspaceRoot) {
|
|
19
19
|
(0, dotenv_expand_1.expand)(myEnv);
|
20
20
|
}
|
21
21
|
}
|
22
|
-
exports.loadRootEnvFiles = loadRootEnvFiles;
|
package/src/utils/exit-codes.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.signalToCode =
|
3
|
+
exports.signalToCode = signalToCode;
|
4
4
|
/**
|
5
5
|
* Translates NodeJS signals to numeric exit code
|
6
6
|
* @param signal
|
@@ -17,4 +17,3 @@ function signalToCode(signal) {
|
|
17
17
|
return 128;
|
18
18
|
}
|
19
19
|
}
|
20
|
-
exports.signalToCode = signalToCode;
|
package/src/utils/fileutils.d.ts
CHANGED