nx 21.0.0-beta.0 → 21.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/.eslintrc.json +5 -1
  2. package/migrations.json +5 -35
  3. package/package.json +12 -12
  4. package/release/index.d.ts +1 -1
  5. package/release/index.js +2 -1
  6. package/schemas/nx-schema.json +182 -35
  7. package/schemas/project-schema.json +5 -0
  8. package/src/adapter/compat.d.ts +1 -1
  9. package/src/adapter/compat.js +3 -0
  10. package/src/command-line/add/add.js +6 -16
  11. package/src/command-line/affected/command-object.js +6 -6
  12. package/src/command-line/examples.js +0 -4
  13. package/src/command-line/exec/command-object.js +1 -1
  14. package/src/command-line/generate/generator-utils.js +8 -3
  15. package/src/command-line/import/import.js +1 -1
  16. package/src/command-line/init/command-object.js +18 -6
  17. package/src/command-line/init/configure-plugins.d.ts +6 -7
  18. package/src/command-line/init/configure-plugins.js +52 -38
  19. package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
  20. package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
  21. package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
  22. package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
  23. package/src/command-line/init/implementation/deduce-default-base.js +53 -0
  24. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
  25. package/src/command-line/init/implementation/react/index.d.ts +1 -1
  26. package/src/command-line/init/implementation/react/index.js +32 -185
  27. package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
  28. package/src/command-line/init/implementation/utils.d.ts +6 -2
  29. package/src/command-line/init/implementation/utils.js +110 -45
  30. package/src/command-line/init/init-v1.js +1 -1
  31. package/src/command-line/init/init-v2.d.ts +1 -0
  32. package/src/command-line/init/init-v2.js +70 -39
  33. package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
  34. package/src/command-line/migrate/migrate-ui-api.js +227 -0
  35. package/src/command-line/migrate/migrate.d.ts +16 -3
  36. package/src/command-line/migrate/migrate.js +134 -101
  37. package/src/command-line/nx-commands.js +19 -5
  38. package/src/command-line/register/command-object.d.ts +6 -0
  39. package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
  40. package/src/command-line/register/register.d.ts +2 -0
  41. package/src/command-line/register/register.js +9 -0
  42. package/src/command-line/release/changelog.js +18 -15
  43. package/src/command-line/release/command-object.d.ts +8 -0
  44. package/src/command-line/release/command-object.js +9 -0
  45. package/src/command-line/release/config/config.d.ts +8 -7
  46. package/src/command-line/release/config/config.js +139 -45
  47. package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
  48. package/src/command-line/release/config/use-legacy-versioning.js +9 -0
  49. package/src/command-line/release/index.d.ts +4 -0
  50. package/src/command-line/release/index.js +6 -1
  51. package/src/command-line/release/plan-check.js +6 -3
  52. package/src/command-line/release/plan.js +7 -3
  53. package/src/command-line/release/publish.js +7 -3
  54. package/src/command-line/release/release.js +8 -3
  55. package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
  56. package/src/command-line/release/utils/git.d.ts +3 -2
  57. package/src/command-line/release/utils/git.js +65 -9
  58. package/src/command-line/release/utils/github.js +3 -1
  59. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
  60. package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
  61. package/src/command-line/release/utils/semver.d.ts +8 -0
  62. package/src/command-line/release/utils/semver.js +8 -0
  63. package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
  64. package/src/command-line/release/utils/shared-legacy.js +2 -0
  65. package/src/command-line/release/utils/shared.d.ts +11 -17
  66. package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
  67. package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
  68. package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
  69. package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
  70. package/src/command-line/release/version/project-logger.d.ts +8 -0
  71. package/src/command-line/release/version/project-logger.js +45 -0
  72. package/src/command-line/release/version/release-group-processor.d.ts +252 -0
  73. package/src/command-line/release/version/release-group-processor.js +1057 -0
  74. package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
  75. package/src/command-line/release/version/resolve-current-version.js +241 -0
  76. package/src/command-line/release/version/test-utils.d.ts +93 -0
  77. package/src/command-line/release/version/test-utils.js +415 -0
  78. package/src/command-line/release/version/topological-sort.d.ts +9 -0
  79. package/src/command-line/release/version/topological-sort.js +41 -0
  80. package/src/command-line/release/version/version-actions.d.ts +171 -0
  81. package/src/command-line/release/version/version-actions.js +195 -0
  82. package/src/command-line/release/version-legacy.d.ts +46 -0
  83. package/src/command-line/release/version-legacy.js +453 -0
  84. package/src/command-line/release/version.d.ts +0 -40
  85. package/src/command-line/release/version.js +84 -262
  86. package/src/command-line/repair/repair.js +0 -1
  87. package/src/command-line/report/report.d.ts +7 -3
  88. package/src/command-line/report/report.js +52 -18
  89. package/src/command-line/run/command-object.js +2 -2
  90. package/src/command-line/run/executor-utils.d.ts +6 -1
  91. package/src/command-line/run/executor-utils.js +10 -1
  92. package/src/command-line/run/run.js +2 -2
  93. package/src/command-line/run-many/command-object.js +2 -2
  94. package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
  95. package/src/command-line/yargs-utils/shared-options.js +20 -0
  96. package/src/config/misc-interfaces.d.ts +11 -1
  97. package/src/config/nx-json.d.ts +160 -16
  98. package/src/config/project-graph.d.ts +4 -2
  99. package/src/config/project-graph.js +8 -0
  100. package/src/config/workspace-json-project-json.d.ts +2 -2
  101. package/src/core/graph/main.js +1 -1
  102. package/src/core/graph/runtime.js +1 -1
  103. package/src/core/graph/styles.css +2 -2
  104. package/src/core/graph/styles.js +1 -1
  105. package/src/daemon/client/client.d.ts +2 -0
  106. package/src/daemon/client/client.js +15 -0
  107. package/src/daemon/message-types/glob.d.ts +7 -0
  108. package/src/daemon/message-types/glob.js +9 -1
  109. package/src/daemon/message-types/hash-glob.d.ts +6 -0
  110. package/src/daemon/message-types/hash-glob.js +9 -1
  111. package/src/daemon/server/handle-glob.d.ts +1 -0
  112. package/src/daemon/server/handle-glob.js +8 -0
  113. package/src/daemon/server/handle-hash-glob.d.ts +1 -0
  114. package/src/daemon/server/handle-hash-glob.js +8 -0
  115. package/src/daemon/server/logger.js +2 -1
  116. package/src/daemon/server/server.js +7 -0
  117. package/src/devkit-internals.d.ts +3 -2
  118. package/src/devkit-internals.js +5 -1
  119. package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
  120. package/src/executors/run-commands/run-commands.impl.js +14 -42
  121. package/src/executors/run-commands/running-tasks.d.ts +9 -4
  122. package/src/executors/run-commands/running-tasks.js +103 -30
  123. package/src/executors/run-script/run-script.impl.js +4 -3
  124. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
  125. package/src/generators/testing-utils/create-tree.js +5 -1
  126. package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
  127. package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
  128. package/src/native/index.d.ts +98 -19
  129. package/src/native/index.js +16 -2
  130. package/src/native/native-bindings.js +7 -0
  131. package/src/native/nx.wasi-browser.js +20 -19
  132. package/src/native/nx.wasi.cjs +20 -19
  133. package/src/native/nx.wasm32-wasi.wasm +0 -0
  134. package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
  135. package/src/plugins/js/lock-file/lock-file.js +28 -13
  136. package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
  137. package/src/plugins/js/lock-file/utils/package-json.js +8 -6
  138. package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
  139. package/src/plugins/js/lock-file/yarn-parser.js +85 -39
  140. package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
  141. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
  142. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
  143. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
  144. package/src/plugins/js/utils/packages.js +22 -3
  145. package/src/plugins/js/utils/register.js +1 -0
  146. package/src/plugins/js/utils/typescript.js +3 -3
  147. package/src/plugins/package-json/create-nodes.d.ts +1 -1
  148. package/src/plugins/package-json/create-nodes.js +4 -2
  149. package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
  150. package/src/project-graph/error-types.js +32 -2
  151. package/src/project-graph/file-utils.d.ts +1 -10
  152. package/src/project-graph/file-utils.js +2 -77
  153. package/src/project-graph/nx-deps-cache.js +7 -2
  154. package/src/project-graph/plugins/get-plugins.js +2 -1
  155. package/src/project-graph/plugins/in-process-loader.js +1 -1
  156. package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
  157. package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
  158. package/src/project-graph/plugins/loaded-nx-plugin.js +3 -7
  159. package/src/project-graph/plugins/public-api.d.ts +1 -1
  160. package/src/project-graph/plugins/utils.d.ts +2 -2
  161. package/src/project-graph/plugins/utils.js +2 -2
  162. package/src/project-graph/project-graph.js +5 -2
  163. package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
  164. package/src/project-graph/utils/project-configuration-utils.js +54 -21
  165. package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
  166. package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
  167. package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
  168. package/src/tasks-runner/batch/run-batch.js +3 -4
  169. package/src/tasks-runner/cache.d.ts +20 -6
  170. package/src/tasks-runner/cache.js +104 -20
  171. package/src/tasks-runner/create-task-graph.d.ts +0 -1
  172. package/src/tasks-runner/create-task-graph.js +11 -11
  173. package/src/tasks-runner/default-tasks-runner.js +5 -14
  174. package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
  175. package/src/tasks-runner/forked-process-task-runner.js +59 -46
  176. package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
  177. package/src/tasks-runner/init-tasks-runner.js +62 -2
  178. package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
  179. package/src/tasks-runner/is-tui-enabled.js +64 -0
  180. package/src/tasks-runner/life-cycle.d.ts +14 -3
  181. package/src/tasks-runner/life-cycle.js +37 -2
  182. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
  183. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
  184. package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
  185. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
  186. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
  187. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
  188. package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
  189. package/src/tasks-runner/pseudo-terminal.js +37 -35
  190. package/src/tasks-runner/run-command.d.ts +4 -1
  191. package/src/tasks-runner/run-command.js +220 -42
  192. package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
  193. package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
  194. package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
  195. package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
  196. package/src/tasks-runner/task-env.d.ts +1 -4
  197. package/src/tasks-runner/task-env.js +2 -0
  198. package/src/tasks-runner/task-orchestrator.d.ts +26 -10
  199. package/src/tasks-runner/task-orchestrator.js +212 -57
  200. package/src/tasks-runner/tasks-runner.d.ts +1 -0
  201. package/src/tasks-runner/tasks-schedule.d.ts +1 -0
  202. package/src/tasks-runner/tasks-schedule.js +9 -0
  203. package/src/tasks-runner/utils.d.ts +2 -2
  204. package/src/tasks-runner/utils.js +18 -12
  205. package/src/utils/child-process.d.ts +4 -0
  206. package/src/utils/child-process.js +23 -30
  207. package/src/utils/command-line-utils.d.ts +1 -1
  208. package/src/utils/find-matching-projects.js +2 -2
  209. package/src/utils/git-utils.d.ts +1 -1
  210. package/src/utils/git-utils.js +8 -3
  211. package/src/utils/handle-errors.js +15 -0
  212. package/src/utils/is-ci.js +4 -1
  213. package/src/utils/is-using-prettier.d.ts +3 -0
  214. package/src/utils/is-using-prettier.js +62 -0
  215. package/src/utils/nx-key.d.ts +7 -0
  216. package/src/utils/nx-key.js +52 -0
  217. package/src/utils/package-json.d.ts +1 -1
  218. package/src/utils/package-json.js +16 -2
  219. package/src/utils/package-manager.js +2 -2
  220. package/src/utils/path.js +1 -1
  221. package/src/utils/require-nx-key.d.ts +1 -0
  222. package/src/utils/require-nx-key.js +22 -0
  223. package/src/utils/workspace-context.d.ts +2 -0
  224. package/src/utils/workspace-context.js +16 -0
  225. package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
  226. package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
  227. package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
  228. package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
  229. package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
  230. package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
  231. package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
  232. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
  233. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
  234. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
  235. package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
  236. package/src/migrations/update-17-2-0/move-default-base.js +0 -21
  237. package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
  238. package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
  239. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
  240. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
  241. package/src/utils/powerpack.d.ts +0 -5
  242. package/src/utils/powerpack.js +0 -33
@@ -1,29 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PseudoTtyProcessWithSend = exports.PseudoTtyProcess = exports.PseudoTerminal = void 0;
4
- exports.getPseudoTerminal = getPseudoTerminal;
4
+ exports.createPseudoTerminal = createPseudoTerminal;
5
+ const os = require("os");
6
+ const socket_utils_1 = require("../daemon/socket-utils");
5
7
  const native_1 = require("../native");
6
8
  const pseudo_ipc_1 = require("./pseudo-ipc");
7
- const socket_utils_1 = require("../daemon/socket-utils");
8
- const os = require("os");
9
- let pseudoTerminal;
10
- function getPseudoTerminal(skipSupportCheck = false) {
9
+ // Register single event listeners for all pseudo-terminal instances
10
+ const pseudoTerminalShutdownCallbacks = [];
11
+ process.on('SIGINT', () => {
12
+ pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
13
+ });
14
+ process.on('SIGTERM', () => {
15
+ pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
16
+ });
17
+ process.on('SIGHUP', () => {
18
+ pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
19
+ });
20
+ process.on('exit', () => {
21
+ pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
22
+ });
23
+ function createPseudoTerminal(skipSupportCheck = false) {
11
24
  if (!skipSupportCheck && !PseudoTerminal.isSupported()) {
12
25
  throw new Error('Pseudo terminal is not supported on this platform.');
13
26
  }
14
- pseudoTerminal ??= new PseudoTerminal(new native_1.RustPseudoTerminal());
27
+ const pseudoTerminal = new PseudoTerminal(new native_1.RustPseudoTerminal());
28
+ pseudoTerminalShutdownCallbacks.push(pseudoTerminal.shutdown.bind(pseudoTerminal));
15
29
  return pseudoTerminal;
16
30
  }
31
+ let id = 0;
17
32
  class PseudoTerminal {
18
33
  static isSupported() {
19
34
  return process.stdout.isTTY && supportedPtyPlatform();
20
35
  }
21
36
  constructor(rustPseudoTerminal) {
22
37
  this.rustPseudoTerminal = rustPseudoTerminal;
23
- this.pseudoIPCPath = (0, socket_utils_1.getForkedProcessOsSocketPath)(process.pid.toString());
38
+ this.pseudoIPCPath = (0, socket_utils_1.getForkedProcessOsSocketPath)(process.pid.toString() + '-' + id++);
24
39
  this.pseudoIPC = new pseudo_ipc_1.PseudoIPCServer(this.pseudoIPCPath);
25
40
  this.initialized = false;
26
- this.setupProcessListeners();
27
41
  }
28
42
  async init() {
29
43
  if (this.initialized) {
@@ -32,14 +46,19 @@ class PseudoTerminal {
32
46
  await this.pseudoIPC.init();
33
47
  this.initialized = true;
34
48
  }
49
+ shutdown() {
50
+ if (this.initialized) {
51
+ this.pseudoIPC.close();
52
+ }
53
+ }
35
54
  runCommand(command, { cwd, execArgv, jsEnv, quiet, tty, } = {}) {
36
- return new PseudoTtyProcess(this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, execArgv, quiet, tty));
55
+ return new PseudoTtyProcess(this.rustPseudoTerminal, this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, execArgv, quiet, tty));
37
56
  }
38
57
  async fork(id, script, { cwd, execArgv, jsEnv, quiet, }) {
39
58
  if (!this.initialized) {
40
59
  throw new Error('Call init() before forking processes');
41
60
  }
42
- const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet), id, this.pseudoIPC);
61
+ const cp = new PseudoTtyProcessWithSend(this.rustPseudoTerminal, this.rustPseudoTerminal.fork(id, script, this.pseudoIPCPath, cwd, jsEnv, execArgv, quiet), id, this.pseudoIPC);
43
62
  await this.pseudoIPC.waitForChildReady(id);
44
63
  return cp;
45
64
  }
@@ -49,32 +68,11 @@ class PseudoTerminal {
49
68
  onMessageFromChildren(callback) {
50
69
  this.pseudoIPC.onMessageFromChildren(callback);
51
70
  }
52
- setupProcessListeners() {
53
- const shutdown = () => {
54
- this.shutdownPseudoIPC();
55
- };
56
- process.on('SIGINT', () => {
57
- this.shutdownPseudoIPC();
58
- });
59
- process.on('SIGTERM', () => {
60
- this.shutdownPseudoIPC();
61
- });
62
- process.on('SIGHUP', () => {
63
- this.shutdownPseudoIPC();
64
- });
65
- process.on('exit', () => {
66
- this.shutdownPseudoIPC();
67
- });
68
- }
69
- shutdownPseudoIPC() {
70
- if (this.initialized) {
71
- this.pseudoIPC.close();
72
- }
73
- }
74
71
  }
75
72
  exports.PseudoTerminal = PseudoTerminal;
76
73
  class PseudoTtyProcess {
77
- constructor(childProcess) {
74
+ constructor(rustPseudoTerminal, childProcess) {
75
+ this.rustPseudoTerminal = rustPseudoTerminal;
78
76
  this.childProcess = childProcess;
79
77
  this.isAlive = true;
80
78
  this.exitCallbacks = [];
@@ -118,11 +116,15 @@ class PseudoTtyProcess {
118
116
  }
119
117
  }
120
118
  }
119
+ getParserAndWriter() {
120
+ return this.childProcess.getParserAndWriter();
121
+ }
121
122
  }
122
123
  exports.PseudoTtyProcess = PseudoTtyProcess;
123
124
  class PseudoTtyProcessWithSend extends PseudoTtyProcess {
124
- constructor(_childProcess, id, pseudoIpc) {
125
- super(_childProcess);
125
+ constructor(rustPseudoTerminal, _childProcess, id, pseudoIpc) {
126
+ super(rustPseudoTerminal, _childProcess);
127
+ this.rustPseudoTerminal = rustPseudoTerminal;
126
128
  this.id = id;
127
129
  this.pseudoIpc = pseudoIpc;
128
130
  }
@@ -17,7 +17,8 @@ export declare function runCommandForTasks(projectsToRun: ProjectGraphProjectNod
17
17
  excludeTaskDependencies: boolean;
18
18
  loadDotEnvFiles: boolean;
19
19
  }): Promise<TaskResults>;
20
- export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, }: {
20
+ export declare function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean): void;
21
+ export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, }: {
21
22
  tasks: Task[];
22
23
  projectGraph: ProjectGraph;
23
24
  taskGraph: TaskGraph;
@@ -26,9 +27,11 @@ export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, life
26
27
  nxArgs: NxArgs;
27
28
  loadDotEnvFiles: boolean;
28
29
  initiatingProject: string | null;
30
+ initiatingTasks: Task[];
29
31
  }): Promise<{
30
32
  [id: string]: TaskResult;
31
33
  }>;
34
+ export declare function constructLifeCycles(lifeCycle: LifeCycle): LifeCycle[];
32
35
  export declare function getRunner(nxArgs: NxArgs, nxJson: NxJsonConfiguration): {
33
36
  tasksRunner: TasksRunner;
34
37
  runnerOptions: any;
@@ -2,26 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCommand = runCommand;
4
4
  exports.runCommandForTasks = runCommandForTasks;
5
+ exports.setEnvVarsBasedOnArgs = setEnvVarsBasedOnArgs;
5
6
  exports.invokeTasksRunner = invokeTasksRunner;
7
+ exports.constructLifeCycles = constructLifeCycles;
6
8
  exports.getRunner = getRunner;
7
9
  exports.getRunnerOptions = getRunnerOptions;
8
10
  const enquirer_1 = require("enquirer");
11
+ const node_path_1 = require("node:path");
12
+ const node_util_1 = require("node:util");
9
13
  const ora = require("ora");
10
- const path_1 = require("path");
11
14
  const nx_json_1 = require("../config/nx-json");
12
15
  const client_1 = require("../daemon/client/client");
13
16
  const create_task_hasher_1 = require("../hasher/create-task-hasher");
14
17
  const hash_task_1 = require("../hasher/hash-task");
15
- const native_1 = require("../native");
18
+ const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
16
19
  const project_graph_1 = require("../project-graph/project-graph");
17
20
  const fileutils_1 = require("../utils/fileutils");
21
+ const handle_errors_1 = require("../utils/handle-errors");
18
22
  const is_ci_1 = require("../utils/is-ci");
19
23
  const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
24
+ const nx_key_1 = require("../utils/nx-key");
20
25
  const output_1 = require("../utils/output");
21
- const handle_errors_1 = require("../utils/handle-errors");
22
26
  const sync_generators_1 = require("../utils/sync-generators");
23
27
  const workspace_root_1 = require("../utils/workspace-root");
24
28
  const create_task_graph_1 = require("./create-task-graph");
29
+ const is_tui_enabled_1 = require("./is-tui-enabled");
25
30
  const life_cycle_1 = require("./life-cycle");
26
31
  const dynamic_run_many_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-many-terminal-output-life-cycle");
27
32
  const dynamic_run_one_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-one-terminal-output-life-cycle");
@@ -29,21 +34,180 @@ const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/stat
29
34
  const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
30
35
  const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
31
36
  const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
32
- const task_history_life_cycle_old_1 = require("./life-cycles/task-history-life-cycle-old");
33
37
  const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
34
- const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
35
38
  const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
39
+ const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
40
+ const tui_summary_life_cycle_1 = require("./life-cycles/tui-summary-life-cycle");
36
41
  const task_graph_utils_1 = require("./task-graph-utils");
37
42
  const utils_1 = require("./utils");
38
43
  const chalk = require("chalk");
39
- const powerpack_1 = require("../utils/powerpack");
40
- const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
41
- async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {
44
+ const originalStdoutWrite = process.stdout.write.bind(process.stdout);
45
+ const originalStderrWrite = process.stderr.write.bind(process.stderr);
46
+ const originalConsoleLog = console.log.bind(console);
47
+ const originalConsoleError = console.error.bind(console);
48
+ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides) {
49
+ const overridesWithoutHidden = { ...overrides };
50
+ delete overridesWithoutHidden['__overrides_unparsed__'];
51
+ if ((0, is_tui_enabled_1.isTuiEnabled)(nxJson)) {
52
+ const interceptedNxCloudLogs = [];
53
+ const createPatchedConsoleMethod = (originalMethod) => {
54
+ return (...args) => {
55
+ // Check if the log came from the Nx Cloud client, otherwise invoke the original write method
56
+ const stackTrace = new Error().stack;
57
+ const isNxCloudLog = stackTrace.includes((0, node_path_1.join)(workspace_root_1.workspaceRoot, '.nx', 'cache', 'cloud'));
58
+ if (!isNxCloudLog) {
59
+ return originalMethod(...args);
60
+ }
61
+ // No-op the Nx Cloud client logs
62
+ };
63
+ };
64
+ // The cloud client calls console.log when NX_VERBOSE_LOGGING is set to true
65
+ console.log = createPatchedConsoleMethod(originalConsoleLog);
66
+ console.error = createPatchedConsoleMethod(originalConsoleError);
67
+ const patchedWrite = (_chunk, _encoding, callback) => {
68
+ // Preserve original behavior around callback and return value, just in case
69
+ if (callback) {
70
+ callback();
71
+ }
72
+ return true;
73
+ };
74
+ process.stdout.write = patchedWrite;
75
+ process.stderr.write = patchedWrite;
76
+ const { AppLifeCycle, restoreTerminal } = await Promise.resolve().then(() => require('../native'));
77
+ let appLifeCycle;
78
+ const isRunOne = initiatingProject != null;
79
+ const pinnedTasks = [];
80
+ const taskText = tasks.length === 1 ? 'task' : 'tasks';
81
+ const projectText = projectNames.length === 1 ? 'project' : 'projects';
82
+ let titleText = '';
83
+ if (isRunOne) {
84
+ const mainTaskId = initiatingTasks[0].id;
85
+ pinnedTasks.push(mainTaskId);
86
+ const mainContinuousDependencies = taskGraph.continuousDependencies[mainTaskId];
87
+ if (mainContinuousDependencies.length > 0) {
88
+ pinnedTasks.push(mainContinuousDependencies[0]);
89
+ }
90
+ const [project, target] = mainTaskId.split(':');
91
+ titleText = `${target} ${project}`;
92
+ if (tasks.length > 1) {
93
+ titleText += `, and ${tasks.length - 1} requisite ${taskText}`;
94
+ }
95
+ }
96
+ else {
97
+ titleText =
98
+ nxArgs.targets.join(', ') +
99
+ ` for ${projectNames.length} ${projectText}`;
100
+ if (tasks.length > projectNames.length) {
101
+ titleText += `, and ${tasks.length - projectNames.length} requisite ${taskText}`;
102
+ }
103
+ }
104
+ let resolveRenderIsDonePromise;
105
+ // Default renderIsDone that will be overridden if the TUI is used
106
+ let renderIsDone = new Promise((resolve) => (resolveRenderIsDonePromise = resolve));
107
+ const { lifeCycle: tsLifeCycle, printSummary } = (0, tui_summary_life_cycle_1.getTuiTerminalSummaryLifeCycle)({
108
+ projectNames,
109
+ tasks,
110
+ args: nxArgs,
111
+ overrides: overridesWithoutHidden,
112
+ initiatingProject,
113
+ initiatingTasks,
114
+ resolveRenderIsDonePromise,
115
+ });
116
+ if (tasks.length === 0) {
117
+ renderIsDone = renderIsDone.then(() => {
118
+ // Revert the patched methods
119
+ process.stdout.write = originalStdoutWrite;
120
+ process.stderr.write = originalStderrWrite;
121
+ console.log = originalConsoleLog;
122
+ console.error = originalConsoleError;
123
+ });
124
+ }
125
+ const lifeCycles = [tsLifeCycle];
126
+ // Only run the TUI if there are tasks to run
127
+ if (tasks.length > 0) {
128
+ appLifeCycle = new AppLifeCycle(tasks, pinnedTasks, nxArgs ?? {}, nxJson.tui ?? {}, titleText);
129
+ lifeCycles.unshift(appLifeCycle);
130
+ /**
131
+ * Patch stdout.write and stderr.write methods to pass Nx Cloud client logs to the TUI via the lifecycle
132
+ */
133
+ const createPatchedLogWrite = (originalWrite) => {
134
+ // @ts-ignore
135
+ return (chunk, encoding, callback) => {
136
+ // Check if the log came from the Nx Cloud client, otherwise invoke the original write method
137
+ const stackTrace = new Error().stack;
138
+ const isNxCloudLog = stackTrace.includes((0, node_path_1.join)(workspace_root_1.workspaceRoot, '.nx', 'cache', 'cloud'));
139
+ if (isNxCloudLog) {
140
+ interceptedNxCloudLogs.push(chunk);
141
+ // Do not bother to store logs with only whitespace characters, they aren't relevant for the TUI
142
+ const trimmedChunk = chunk.toString().trim();
143
+ if (trimmedChunk.length) {
144
+ // Remove ANSI escape codes, the TUI will control the formatting
145
+ appLifeCycle?.__setCloudMessage((0, node_util_1.stripVTControlCharacters)(trimmedChunk));
146
+ }
147
+ }
148
+ // Preserve original behavior around callback and return value, just in case
149
+ if (callback) {
150
+ callback();
151
+ }
152
+ return true;
153
+ };
154
+ };
155
+ const createPatchedConsoleMethod = (originalMethod) => {
156
+ return (...args) => {
157
+ // Check if the log came from the Nx Cloud client, otherwise invoke the original write method
158
+ const stackTrace = new Error().stack;
159
+ const isNxCloudLog = stackTrace.includes((0, node_path_1.join)(workspace_root_1.workspaceRoot, '.nx', 'cache', 'cloud'));
160
+ if (!isNxCloudLog) {
161
+ return originalMethod(...args);
162
+ }
163
+ // No-op the Nx Cloud client logs
164
+ };
165
+ };
166
+ process.stdout.write = createPatchedLogWrite(originalStdoutWrite);
167
+ process.stderr.write = createPatchedLogWrite(originalStderrWrite);
168
+ // The cloud client calls console.log when NX_VERBOSE_LOGGING is set to true
169
+ console.log = createPatchedConsoleMethod(originalConsoleLog);
170
+ console.error = createPatchedConsoleMethod(originalConsoleError);
171
+ renderIsDone = new Promise((resolve) => {
172
+ appLifeCycle.__init(() => {
173
+ resolve();
174
+ });
175
+ })
176
+ .then(() => {
177
+ restoreTerminal();
178
+ })
179
+ .finally(() => {
180
+ // Revert the patched methods
181
+ process.stdout.write = originalStdoutWrite;
182
+ process.stderr.write = originalStderrWrite;
183
+ console.log = originalConsoleLog;
184
+ console.error = originalConsoleError;
185
+ // Print the intercepted Nx Cloud logs
186
+ for (const log of interceptedNxCloudLogs) {
187
+ const logString = log.toString().trimStart();
188
+ process.stdout.write(logString);
189
+ if (logString) {
190
+ process.stdout.write('\n');
191
+ }
192
+ }
193
+ });
194
+ }
195
+ return {
196
+ lifeCycle: new life_cycle_1.CompositeLifeCycle(lifeCycles),
197
+ restoreTerminal: () => {
198
+ process.stdout.write = originalStdoutWrite;
199
+ process.stderr.write = originalStderrWrite;
200
+ console.log = originalConsoleLog;
201
+ console.error = originalConsoleError;
202
+ restoreTerminal();
203
+ },
204
+ printSummary,
205
+ renderIsDone,
206
+ };
207
+ }
42
208
  const { runnerOptions } = getRunner(nxArgs, nxJson);
43
209
  const isRunOne = initiatingProject != null;
44
210
  const useDynamicOutput = shouldUseDynamicLifeCycle(tasks, runnerOptions, nxArgs.outputStyle);
45
- const overridesWithoutHidden = { ...overrides };
46
- delete overridesWithoutHidden['__overrides_unparsed__'];
47
211
  if (isRunOne) {
48
212
  if (useDynamicOutput) {
49
213
  return await (0, dynamic_run_one_terminal_output_life_cycle_1.createRunOneDynamicOutputRenderer)({
@@ -127,26 +291,41 @@ async function runCommand(projectsToRun, currentProjectGraph, { nxJson }, nxArgs
127
291
  }
128
292
  async function runCommandForTasks(projectsToRun, currentProjectGraph, { nxJson }, nxArgs, overrides, initiatingProject, extraTargetDependencies, extraOptions) {
129
293
  const projectNames = projectsToRun.map((t) => t.name);
294
+ const projectNameSet = new Set(projectNames);
130
295
  const { projectGraph, taskGraph } = await ensureWorkspaceIsInSyncAndGetGraphs(currentProjectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions);
131
296
  const tasks = Object.values(taskGraph.tasks);
132
- const { lifeCycle, renderIsDone } = await getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides);
133
- const taskResults = await invokeTasksRunner({
134
- tasks,
135
- projectGraph,
136
- taskGraph,
137
- lifeCycle,
138
- nxJson,
139
- nxArgs,
140
- loadDotEnvFiles: extraOptions.loadDotEnvFiles,
141
- initiatingProject,
142
- });
143
- await renderIsDone;
144
- await (0, powerpack_1.printPowerpackLicense)();
145
- return taskResults;
297
+ const initiatingTasks = tasks.filter((t) => projectNameSet.has(t.target.project) &&
298
+ nxArgs.targets.includes(t.target.target));
299
+ const { lifeCycle, renderIsDone, printSummary, restoreTerminal } = await getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides);
300
+ try {
301
+ const taskResults = await invokeTasksRunner({
302
+ tasks,
303
+ projectGraph,
304
+ taskGraph,
305
+ lifeCycle,
306
+ nxJson,
307
+ nxArgs,
308
+ loadDotEnvFiles: extraOptions.loadDotEnvFiles,
309
+ initiatingProject,
310
+ initiatingTasks,
311
+ });
312
+ await renderIsDone;
313
+ if (printSummary) {
314
+ printSummary();
315
+ }
316
+ await (0, nx_key_1.printNxKey)();
317
+ return taskResults;
318
+ }
319
+ catch (e) {
320
+ if (restoreTerminal) {
321
+ restoreTerminal();
322
+ }
323
+ throw e;
324
+ }
146
325
  }
147
326
  async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
148
327
  let taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
149
- if (nxArgs.skipSync) {
328
+ if (nxArgs.skipSync || (0, is_ci_1.isCI)()) {
150
329
  return { projectGraph, taskGraph };
151
330
  }
152
331
  // collect unique syncGenerators from the tasks
@@ -166,9 +345,8 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
166
345
  const outOfSyncTitle = 'The workspace is out of sync';
167
346
  const resultBodyLines = (0, sync_generators_1.getSyncGeneratorSuccessResultsMessageLines)(results);
168
347
  const fixMessage = 'Make sure to run `nx sync` to apply the identified changes or set `sync.applyChanges` to `true` in your `nx.json` to apply them automatically when running tasks in interactive environments.';
169
- const willErrorOnCiMessage = 'This will result in an error in CI.';
170
- if ((0, is_ci_1.isCI)() || !process.stdout.isTTY) {
171
- // If the user is running in CI or is running in a non-TTY environment we
348
+ if (!process.stdout.isTTY) {
349
+ // If the user is running a non-TTY environment we
172
350
  // throw an error to stop the execution of the tasks.
173
351
  if (areAllResultsFailures) {
174
352
  output_1.output.error({
@@ -216,7 +394,6 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
216
394
  ...resultBodyLines,
217
395
  '',
218
396
  'Your workspace is set to not apply the identified changes automatically (`sync.applyChanges` is set to `false` in your `nx.json`).',
219
- willErrorOnCiMessage,
220
397
  fixMessage,
221
398
  ],
222
399
  });
@@ -235,10 +412,12 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
235
412
  title: outOfSyncTitle,
236
413
  bodyLines: [
237
414
  ...resultBodyLines,
238
- '',
239
- nxJson.sync?.applyChanges === true
240
- ? 'Proceeding to sync the identified changes automatically (`sync.applyChanges` is set to `true` in your `nx.json`).'
241
- : willErrorOnCiMessage,
415
+ ...(nxJson.sync?.applyChanges === true
416
+ ? [
417
+ '',
418
+ 'Proceeding to sync the identified changes automatically (`sync.applyChanges` is set to `true` in your `nx.json`).',
419
+ ]
420
+ : []),
242
421
  ],
243
422
  });
244
423
  const applyChanges = nxJson.sync?.applyChanges === true ||
@@ -377,7 +556,7 @@ function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
377
556
  process.env.NX_LOAD_DOT_ENV_FILES = 'true';
378
557
  }
379
558
  }
380
- async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, }) {
559
+ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, }) {
381
560
  setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles);
382
561
  // this needs to be done before we start to run the tasks
383
562
  const taskDetails = (0, hash_task_1.getTaskDetails)();
@@ -397,6 +576,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
397
576
  lifeCycle: compositedLifeCycle,
398
577
  }, {
399
578
  initiatingProject: nxArgs.outputStyle === 'compact' ? null : initiatingProject,
579
+ initiatingTasks,
400
580
  projectGraph,
401
581
  nxJson,
402
582
  nxArgs,
@@ -467,10 +647,9 @@ function constructLifeCycles(lifeCycle) {
467
647
  if (process.env.NX_PROFILE) {
468
648
  lifeCycles.push(new task_profiling_life_cycle_1.TaskProfilingLifeCycle(process.env.NX_PROFILE));
469
649
  }
470
- if (!(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
471
- lifeCycles.push(process.env.NX_DISABLE_DB !== 'true' && !native_1.IS_WASM
472
- ? new task_history_life_cycle_1.TaskHistoryLifeCycle()
473
- : new task_history_life_cycle_old_1.LegacyTaskHistoryLifeCycle());
650
+ const historyLifeCycle = (0, task_history_life_cycle_1.getTasksHistoryLifeCycle)();
651
+ if (historyLifeCycle) {
652
+ lifeCycles.push(historyLifeCycle);
474
653
  }
475
654
  return lifeCycles;
476
655
  }
@@ -535,10 +714,9 @@ function getRunner(nxArgs, nxJson) {
535
714
  try {
536
715
  if (isCustomRunnerPath(modulePath)) {
537
716
  output_1.output.warn({
538
- title: `Custom task runners will no longer be supported in Nx 21.`,
717
+ title: `Custom task runners will be replaced by a new API starting with Nx 21.`,
539
718
  bodyLines: [
540
- `Use Nx Cloud or the Nx Powerpack caches instead.`,
541
- `For more information, see https://nx.dev/nx-enterprise/powerpack/custom-caching`,
719
+ `For more information, see https://nx.dev/deprecated/custom-tasks-runner`,
542
720
  ],
543
721
  });
544
722
  }
@@ -557,7 +735,7 @@ function getTasksRunnerPath(runner, nxJson) {
557
735
  let modulePath = nxJson.tasksRunnerOptions?.[runner]?.runner;
558
736
  if (modulePath) {
559
737
  if ((0, fileutils_1.isRelativePath)(modulePath)) {
560
- return (0, path_1.join)(workspace_root_1.workspaceRoot, modulePath);
738
+ return (0, node_path_1.join)(workspace_root_1.workspaceRoot, modulePath);
561
739
  }
562
740
  return modulePath;
563
741
  }
@@ -153,18 +153,11 @@ class NodeChildProcessWithDirectOutput {
153
153
  this.exitCallbacks.push(cb);
154
154
  }
155
155
  async getResults() {
156
- const terminalOutput = this.getTerminalOutput();
157
- if (this.exited) {
158
- return Promise.resolve({
159
- code: this.exitCode,
160
- terminalOutput,
161
- });
156
+ if (!this.exited) {
157
+ await this.waitForExit();
162
158
  }
163
- await this.waitForExit();
164
- return Promise.resolve({
165
- code: this.exitCode,
166
- terminalOutput,
167
- });
159
+ const terminalOutput = this.getTerminalOutput();
160
+ return { code: this.exitCode, terminalOutput };
168
161
  }
169
162
  waitForExit() {
170
163
  return new Promise((res) => {
@@ -1,3 +1,4 @@
1
+ import type { Serializable } from 'child_process';
1
2
  export declare abstract class RunningTask {
2
3
  abstract getResults(): Promise<{
3
4
  code: number;
@@ -5,4 +6,6 @@ export declare abstract class RunningTask {
5
6
  }>;
6
7
  abstract onExit(cb: (code: number) => void): void;
7
8
  abstract kill(signal?: NodeJS.Signals | number): Promise<void> | void;
9
+ abstract onOutput?(cb: (output: string) => void): void;
10
+ abstract send?(message: Serializable): void;
8
11
  }
@@ -0,0 +1,14 @@
1
+ import { RunningTask } from './running-task';
2
+ import { RunningTasksService } from '../../native';
3
+ export declare class SharedRunningTask implements RunningTask {
4
+ private runningTasksService;
5
+ private exitCallbacks;
6
+ constructor(runningTasksService: RunningTasksService, taskId: string);
7
+ getResults(): Promise<{
8
+ code: number;
9
+ terminalOutput: string;
10
+ }>;
11
+ kill(): void;
12
+ onExit(cb: (code: number) => void): void;
13
+ private waitForTaskToFinish;
14
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharedRunningTask = void 0;
4
+ class SharedRunningTask {
5
+ constructor(runningTasksService, taskId) {
6
+ this.runningTasksService = runningTasksService;
7
+ this.exitCallbacks = [];
8
+ this.waitForTaskToFinish(taskId).then(() => {
9
+ // notify exit callbacks
10
+ this.exitCallbacks.forEach((cb) => cb(0));
11
+ });
12
+ }
13
+ async getResults() {
14
+ throw new Error('Results cannot be retrieved from a shared task');
15
+ }
16
+ kill() {
17
+ this.exitCallbacks.forEach((cb) => cb(0));
18
+ }
19
+ onExit(cb) {
20
+ this.exitCallbacks.push(cb);
21
+ }
22
+ async waitForTaskToFinish(taskId) {
23
+ console.log(`Waiting for ${taskId} in another nx process`);
24
+ // wait for the running task to finish
25
+ do {
26
+ await new Promise((resolve) => setTimeout(resolve, 100));
27
+ } while (this.runningTasksService.getRunningTasks([taskId]).length);
28
+ }
29
+ }
30
+ exports.SharedRunningTask = SharedRunningTask;
@@ -1,10 +1,7 @@
1
1
  import { Task } from '../config/task-graph';
2
2
  export declare function getEnvVariablesForBatchProcess(skipNxCache: boolean, captureStderr: boolean): NodeJS.ProcessEnv;
3
3
  export declare function getTaskSpecificEnv(task: Task): NodeJS.ProcessEnv;
4
- export declare function getEnvVariablesForTask(task: Task, taskSpecificEnv: NodeJS.ProcessEnv, forceColor: string, skipNxCache: boolean, captureStderr: boolean, outputPath: string, streamOutput: boolean): {
5
- [x: string]: string;
6
- TZ?: string;
7
- };
4
+ export declare function getEnvVariablesForTask(task: Task, taskSpecificEnv: NodeJS.ProcessEnv, forceColor: string, skipNxCache: boolean, captureStderr: boolean, outputPath: string, streamOutput: boolean): NodeJS.ProcessEnv;
8
5
  /**
9
6
  * This function loads a .env file and expands the variables in it.
10
7
  * @param filename the .env file to load
@@ -75,6 +75,8 @@ function getNxEnvVariablesForTask(task, forceColor, skipNxCache, captureStderr,
75
75
  return {
76
76
  ...getNxEnvVariablesForForkedProcess(forceColor, skipNxCache, captureStderr, outputPath, streamOutput),
77
77
  ...env,
78
+ // Ensure the TUI does not get spawned within the TUI if ever tasks invoke Nx again
79
+ NX_TUI: 'false',
78
80
  };
79
81
  }
80
82
  /**