nx 17.0.3 → 17.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -4
  3. package/bin/init-local.js +10 -60
  4. package/bin/nx-cloud.js +6 -0
  5. package/bin/nx.js +1 -9
  6. package/bin/post-install.js +5 -1
  7. package/bin/run-executor.js +1 -1
  8. package/migrations.json +18 -0
  9. package/package.json +21 -18
  10. package/plugins/package-json.js +1 -1
  11. package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
  12. package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
  13. package/release/index.d.ts +4 -0
  14. package/release/index.js +11 -0
  15. package/schemas/nx-schema.json +203 -19
  16. package/schemas/project-schema.json +20 -0
  17. package/src/adapter/angular-json.js +28 -18
  18. package/src/adapter/compat.d.ts +2 -2
  19. package/src/adapter/compat.js +6 -1
  20. package/src/adapter/ngcli-adapter.d.ts +16 -4
  21. package/src/adapter/ngcli-adapter.js +85 -28
  22. package/src/command-line/add/add.d.ts +2 -0
  23. package/src/command-line/add/add.js +169 -0
  24. package/src/command-line/add/command-object.d.ts +7 -0
  25. package/src/command-line/add/command-object.js +24 -0
  26. package/src/command-line/affected/affected.js +0 -3
  27. package/src/command-line/affected/command-object.d.ts +4 -4
  28. package/src/command-line/affected/command-object.js +53 -26
  29. package/src/command-line/affected/print-affected.js +10 -1
  30. package/src/command-line/connect/command-object.d.ts +1 -2
  31. package/src/command-line/connect/command-object.js +3 -7
  32. package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
  33. package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
  34. package/src/command-line/connect/view-logs.js +5 -21
  35. package/src/command-line/examples.js +18 -0
  36. package/src/command-line/exec/command-object.js +2 -1
  37. package/src/command-line/exec/exec.d.ts +1 -1
  38. package/src/command-line/exec/exec.js +78 -35
  39. package/src/command-line/format/format.js +13 -4
  40. package/src/command-line/generate/generate.js +9 -9
  41. package/src/command-line/generate/generator-utils.d.ts +3 -2
  42. package/src/command-line/generate/generator-utils.js +5 -5
  43. package/src/command-line/graph/graph.d.ts +1 -1
  44. package/src/command-line/graph/graph.js +82 -37
  45. package/src/command-line/init/command-object.js +70 -43
  46. package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
  47. package/src/command-line/init/implementation/add-nx-to-monorepo.js +11 -2
  48. package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
  49. package/src/command-line/init/implementation/add-nx-to-nest.js +9 -6
  50. package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
  51. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +14 -4
  52. package/src/command-line/init/implementation/angular/index.js +4 -1
  53. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
  54. package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
  55. package/src/command-line/init/implementation/angular/types.d.ts +1 -1
  56. package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
  57. package/src/command-line/init/implementation/react/index.d.ts +1 -1
  58. package/src/command-line/init/implementation/react/index.js +4 -2
  59. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
  60. package/src/command-line/init/implementation/utils.d.ts +5 -5
  61. package/src/command-line/init/implementation/utils.js +46 -44
  62. package/src/command-line/init/{init.js → init-v1.js} +5 -13
  63. package/src/command-line/init/init-v2.d.ts +7 -0
  64. package/src/command-line/init/init-v2.js +201 -0
  65. package/src/command-line/list/list.js +6 -5
  66. package/src/command-line/migrate/command-object.js +19 -4
  67. package/src/command-line/migrate/migrate.js +21 -17
  68. package/src/command-line/new/new.js +1 -1
  69. package/src/command-line/nx-commands.js +4 -1
  70. package/src/command-line/release/changelog.d.ts +22 -1
  71. package/src/command-line/release/changelog.js +459 -257
  72. package/src/command-line/release/command-object.d.ts +29 -7
  73. package/src/command-line/release/command-object.js +120 -20
  74. package/src/command-line/release/config/config.d.ts +26 -21
  75. package/src/command-line/release/config/config.js +416 -59
  76. package/src/command-line/release/config/conventional-commits.d.ts +2 -0
  77. package/src/command-line/release/config/conventional-commits.js +98 -0
  78. package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
  79. package/src/command-line/release/config/filter-release-groups.js +38 -1
  80. package/src/command-line/release/index.d.ts +16 -0
  81. package/src/command-line/release/index.js +23 -0
  82. package/src/command-line/release/publish.d.ts +7 -3
  83. package/src/command-line/release/publish.js +89 -37
  84. package/src/command-line/release/release.d.ts +4 -0
  85. package/src/command-line/release/release.js +176 -0
  86. package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
  87. package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
  88. package/src/command-line/release/utils/exec-command.d.ts +1 -0
  89. package/src/command-line/release/utils/exec-command.js +34 -0
  90. package/src/command-line/release/utils/git.d.ts +34 -1
  91. package/src/command-line/release/utils/git.js +238 -34
  92. package/src/command-line/release/utils/github.d.ts +5 -5
  93. package/src/command-line/release/utils/github.js +155 -8
  94. package/src/command-line/release/utils/markdown.js +6 -1
  95. package/src/command-line/release/utils/print-changes.d.ts +1 -1
  96. package/src/command-line/release/utils/print-changes.js +3 -3
  97. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
  98. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
  99. package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
  100. package/src/command-line/release/utils/semver.d.ts +8 -0
  101. package/src/command-line/release/utils/semver.js +30 -1
  102. package/src/command-line/release/utils/shared.d.ts +39 -0
  103. package/src/command-line/release/utils/shared.js +213 -0
  104. package/src/command-line/release/version.d.ts +37 -3
  105. package/src/command-line/release/version.js +312 -117
  106. package/src/command-line/repair/repair.js +13 -9
  107. package/src/command-line/report/report.d.ts +3 -0
  108. package/src/command-line/report/report.js +22 -5
  109. package/src/command-line/run/command-object.d.ts +4 -0
  110. package/src/command-line/run/command-object.js +18 -2
  111. package/src/command-line/run/executor-utils.d.ts +2 -1
  112. package/src/command-line/run/executor-utils.js +4 -4
  113. package/src/command-line/run/run-one.js +3 -6
  114. package/src/command-line/run/run.js +34 -9
  115. package/src/command-line/run-many/command-object.js +4 -1
  116. package/src/command-line/run-many/run-many.js +0 -3
  117. package/src/command-line/show/command-object.d.ts +3 -0
  118. package/src/command-line/show/command-object.js +29 -2
  119. package/src/command-line/show/show.js +9 -0
  120. package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
  121. package/src/command-line/yargs-utils/shared-options.js +23 -9
  122. package/src/commands-runner/command-graph.d.ts +13 -0
  123. package/src/commands-runner/command-graph.js +2 -0
  124. package/src/commands-runner/create-command-graph.d.ts +4 -0
  125. package/src/commands-runner/create-command-graph.js +44 -0
  126. package/src/commands-runner/get-command-projects.d.ts +3 -0
  127. package/src/commands-runner/get-command-projects.js +19 -0
  128. package/src/config/nx-json.d.ts +160 -25
  129. package/src/config/project-graph.d.ts +3 -3
  130. package/src/config/workspace-json-project-json.d.ts +23 -1
  131. package/src/config/workspaces.d.ts +1 -1
  132. package/src/config/workspaces.js +4 -6
  133. package/src/core/graph/3rdpartylicenses.txt +144 -74
  134. package/src/core/graph/environment.js +1 -1
  135. package/src/core/graph/index.html +4 -6
  136. package/src/core/graph/main.js +1 -1
  137. package/src/core/graph/runtime.js +1 -1
  138. package/src/core/graph/styles.css +3 -3
  139. package/src/core/graph/styles.js +1 -1
  140. package/src/daemon/client/client.d.ts +5 -1
  141. package/src/daemon/client/client.js +27 -8
  142. package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
  143. package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
  144. package/src/daemon/daemon-project-graph-error.d.ts +8 -0
  145. package/src/daemon/daemon-project-graph-error.js +13 -0
  146. package/src/daemon/server/handle-hash-tasks.js +12 -2
  147. package/src/daemon/server/handle-request-project-graph.js +1 -1
  148. package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
  149. package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
  150. package/src/daemon/server/shutdown-utils.js +2 -4
  151. package/src/daemon/server/watcher.js +0 -3
  152. package/src/daemon/socket-utils.d.ts +2 -1
  153. package/src/daemon/socket-utils.js +15 -4
  154. package/src/daemon/tmp-dir.d.ts +1 -0
  155. package/src/daemon/tmp-dir.js +4 -4
  156. package/src/devkit-exports.d.ts +2 -2
  157. package/src/devkit-exports.js +3 -2
  158. package/src/devkit-internals.d.ts +3 -0
  159. package/src/devkit-internals.js +7 -1
  160. package/src/executors/noop/schema.json +1 -1
  161. package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
  162. package/src/executors/run-commands/run-commands.impl.js +152 -48
  163. package/src/executors/run-commands/schema.json +11 -1
  164. package/src/executors/run-script/run-script.impl.js +43 -11
  165. package/src/executors/utils/convert-nx-executor.js +1 -1
  166. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
  167. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
  168. package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
  169. package/src/generators/tree.d.ts +1 -0
  170. package/src/generators/utils/glob.js +2 -2
  171. package/src/generators/utils/project-configuration.js +28 -9
  172. package/src/hasher/create-task-hasher.d.ts +4 -0
  173. package/src/hasher/create-task-hasher.js +16 -0
  174. package/src/hasher/hash-task.js +9 -3
  175. package/src/hasher/native-task-hasher-impl.d.ts +19 -0
  176. package/src/hasher/native-task-hasher-impl.js +37 -0
  177. package/src/hasher/node-task-hasher-impl.d.ts +49 -0
  178. package/src/hasher/node-task-hasher-impl.js +431 -0
  179. package/src/hasher/task-hasher.d.ts +33 -21
  180. package/src/hasher/task-hasher.js +30 -428
  181. package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
  182. package/src/migrations/update-15-1-0/set-project-names.js +2 -1
  183. package/src/migrations/update-15-8-2/update-nxw.js +2 -6
  184. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
  185. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
  186. package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
  187. package/src/migrations/update-17-2-0/move-default-base.js +21 -0
  188. package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
  189. package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
  190. package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
  191. package/src/migrations/update-17-3-0/update-nxw.js +7 -0
  192. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
  193. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
  194. package/src/native/index.d.ts +65 -15
  195. package/src/native/index.js +6 -2
  196. package/src/native/transform-objects.js +2 -0
  197. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
  198. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
  199. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
  200. package/src/nx-cloud/update-manager.js +2 -1
  201. package/src/plugins/js/index.d.ts +1 -1
  202. package/src/plugins/js/index.js +3 -3
  203. package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
  204. package/src/plugins/js/lock-file/lock-file.js +15 -3
  205. package/src/plugins/js/package-json/create-package-json.js +1 -1
  206. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
  207. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
  208. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
  209. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
  210. package/src/plugins/js/utils/register.d.ts +1 -1
  211. package/src/plugins/js/utils/register.js +28 -8
  212. package/src/plugins/js/versions.d.ts +1 -1
  213. package/src/plugins/js/versions.js +1 -1
  214. package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
  215. package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
  216. package/src/plugins/package-json-workspaces/index.d.ts +1 -0
  217. package/src/plugins/package-json-workspaces/index.js +4 -0
  218. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
  219. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
  220. package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
  221. package/src/plugins/project-json/build-nodes/project-json.js +6 -44
  222. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
  223. package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
  224. package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
  225. package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
  226. package/src/project-graph/affected/locators/workspace-projects.js +16 -29
  227. package/src/project-graph/build-project-graph.d.ts +20 -1
  228. package/src/project-graph/build-project-graph.js +91 -33
  229. package/src/project-graph/file-map-utils.d.ts +9 -5
  230. package/src/project-graph/file-map-utils.js +16 -63
  231. package/src/project-graph/file-utils.d.ts +1 -1
  232. package/src/project-graph/file-utils.js +44 -2
  233. package/src/project-graph/nx-deps-cache.js +1 -1
  234. package/src/project-graph/project-graph-builder.d.ts +1 -1
  235. package/src/project-graph/project-graph-builder.js +1 -1
  236. package/src/project-graph/project-graph.d.ts +32 -1
  237. package/src/project-graph/project-graph.js +147 -23
  238. package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
  239. package/src/project-graph/utils/build-all-workspace-files.js +15 -0
  240. package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
  241. package/src/project-graph/utils/normalize-project-nodes.js +7 -33
  242. package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
  243. package/src/project-graph/utils/project-configuration-utils.js +509 -62
  244. package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
  245. package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
  246. package/src/tasks-runner/batch/run-batch.js +3 -3
  247. package/src/tasks-runner/cache.js +6 -3
  248. package/src/tasks-runner/create-task-graph.js +1 -1
  249. package/src/tasks-runner/fork.d.ts +1 -0
  250. package/src/tasks-runner/fork.js +23 -0
  251. package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
  252. package/src/tasks-runner/forked-process-task-runner.js +112 -21
  253. package/src/tasks-runner/init-tasks-runner.js +1 -1
  254. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
  255. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
  256. package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
  257. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
  258. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
  259. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
  260. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
  261. package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
  262. package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
  263. package/src/tasks-runner/pseudo-ipc.js +140 -0
  264. package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
  265. package/src/tasks-runner/pseudo-terminal.js +159 -0
  266. package/src/tasks-runner/run-command.d.ts +1 -1
  267. package/src/tasks-runner/run-command.js +13 -19
  268. package/src/tasks-runner/task-env.js +1 -2
  269. package/src/tasks-runner/task-graph-utils.d.ts +7 -3
  270. package/src/tasks-runner/task-graph-utils.js +15 -15
  271. package/src/tasks-runner/task-orchestrator.js +68 -12
  272. package/src/tasks-runner/tasks-schedule.js +3 -3
  273. package/src/tasks-runner/utils.d.ts +16 -7
  274. package/src/tasks-runner/utils.js +30 -16
  275. package/src/utils/ab-testing.d.ts +36 -2
  276. package/src/utils/ab-testing.js +34 -16
  277. package/src/utils/assert-workspace-validity.js +1 -1
  278. package/src/utils/cache-directory.d.ts +1 -0
  279. package/src/utils/cache-directory.js +5 -1
  280. package/src/utils/child-process.d.ts +15 -1
  281. package/src/utils/child-process.js +91 -1
  282. package/src/utils/command-line-utils.js +2 -1
  283. package/src/utils/exit-codes.d.ts +6 -0
  284. package/src/utils/exit-codes.js +20 -0
  285. package/src/utils/fileutils.d.ts +1 -0
  286. package/src/utils/find-matching-projects.js +5 -5
  287. package/src/utils/find-workspace-root.js +1 -0
  288. package/src/utils/ignore.js +8 -1
  289. package/src/utils/json-diff.d.ts +1 -0
  290. package/src/utils/json-diff.js +2 -1
  291. package/src/utils/json.js +3 -1
  292. package/src/utils/logger.js +1 -1
  293. package/src/utils/nx-cloud-utils.d.ts +1 -1
  294. package/src/utils/nx-cloud-utils.js +9 -4
  295. package/src/utils/nx-plugin.d.ts +32 -15
  296. package/src/utils/nx-plugin.deprecated.d.ts +10 -5
  297. package/src/utils/nx-plugin.deprecated.js +23 -0
  298. package/src/utils/nx-plugin.js +71 -80
  299. package/src/utils/output.d.ts +4 -2
  300. package/src/utils/output.js +44 -9
  301. package/src/utils/package-json.d.ts +4 -4
  302. package/src/utils/package-json.js +18 -12
  303. package/src/utils/package-manager.d.ts +7 -0
  304. package/src/utils/package-manager.js +24 -4
  305. package/src/utils/params.d.ts +12 -4
  306. package/src/utils/params.js +37 -4
  307. package/src/utils/plugins/core-plugins.js +8 -0
  308. package/src/utils/plugins/installed-plugins.d.ts +2 -1
  309. package/src/utils/plugins/installed-plugins.js +2 -2
  310. package/src/utils/plugins/local-plugins.js +1 -1
  311. package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
  312. package/src/utils/plugins/plugin-capabilities.js +7 -7
  313. package/src/utils/typescript.js +1 -1
  314. package/src/utils/update-nxw.d.ts +2 -0
  315. package/src/utils/update-nxw.js +12 -0
  316. package/src/utils/workspace-configuration-check.js +1 -1
  317. package/src/utils/workspace-context.d.ts +6 -4
  318. package/src/utils/workspace-context.js +19 -9
  319. package/src/core/graph/polyfills.js +0 -1
  320. /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
@@ -9,6 +9,9 @@ const output_1 = require("../../utils/output");
9
9
  const pretty_time_1 = require("./pretty-time");
10
10
  const formatting_utils_1 = require("./formatting-utils");
11
11
  const view_logs_utils_1 = require("./view-logs-utils");
12
+ const LEFT_PAD = ` `;
13
+ const SPACER = ` `;
14
+ const EXTENDED_LEFT_PAD = ` `;
12
15
  /**
13
16
  * The following function is responsible for creating a life cycle with dynamic
14
17
  * outputs, meaning previous outputs can be rewritten or modified as new outputs
@@ -74,7 +77,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
74
77
  // Create vertical breathing room for cursor position under the pinned footer
75
78
  lines.push('');
76
79
  for (const line of lines) {
77
- output_1.output.overwriteLine(output_1.output.X_PADDING + line);
80
+ output_1.output.overwriteLine(line);
78
81
  }
79
82
  pinnedFooterNumLines = lines.length + additionalLines;
80
83
  // clear any possible text below the cursor's position
@@ -90,7 +93,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
90
93
  switch (status) {
91
94
  case 'local-cache':
92
95
  writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
93
- ' ' +
96
+ SPACER +
94
97
  output_1.output.formatCommand(task.id)} ${output_1.output.dim('[local cache]')}`);
95
98
  if (isVerbose) {
96
99
  writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
@@ -98,7 +101,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
98
101
  break;
99
102
  case 'local-cache-kept-existing':
100
103
  writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
101
- ' ' +
104
+ SPACER +
102
105
  output_1.output.formatCommand(task.id)} ${output_1.output.dim('[existing outputs match the cache, left as is]')}`);
103
106
  if (isVerbose) {
104
107
  writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
@@ -106,7 +109,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
106
109
  break;
107
110
  case 'remote-cache':
108
111
  writeCompletedTaskResultLine(`${output_1.output.colors.green(figures.tick) +
109
- ' ' +
112
+ SPACER +
110
113
  output_1.output.formatCommand(task.id)} ${output_1.output.dim('[remote cache]')}`);
111
114
  if (isVerbose) {
112
115
  writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
@@ -115,7 +118,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
115
118
  case 'success': {
116
119
  const timeTakenText = (0, pretty_time_1.prettyTime)(process.hrtime(tasksToProcessStartTimes[task.id]));
117
120
  writeCompletedTaskResultLine(output_1.output.colors.green(figures.tick) +
118
- ' ' +
121
+ SPACER +
119
122
  output_1.output.formatCommand(task.id) +
120
123
  output_1.output.dim(` (${timeTakenText})`));
121
124
  if (isVerbose) {
@@ -124,9 +127,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
124
127
  break;
125
128
  }
126
129
  case 'failure':
130
+ output_1.output.addNewline();
127
131
  output_1.output.addNewline();
128
132
  writeCompletedTaskResultLine(output_1.output.colors.red(figures.cross) +
129
- ' ' +
133
+ SPACER +
130
134
  output_1.output.formatCommand(output_1.output.colors.red(task.id)));
131
135
  writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
132
136
  break;
@@ -143,10 +147,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
143
147
  const runningTasks = taskRows.filter((row) => row.status === 'running');
144
148
  const remainingTasks = totalTasks - totalCompletedTasks;
145
149
  if (runningTasks.length > 0) {
146
- additionalFooterRows.push(output_1.output.dim(` ${output_1.output.colors.cyan(figures.arrowRight)} Executing ${runningTasks.length}/${remainingTasks} remaining tasks${runningTasks.length > 1 ? ' in parallel' : ''}...`));
150
+ additionalFooterRows.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.colors.cyan(figures.arrowRight)}${SPACER}Executing ${runningTasks.length}/${remainingTasks} remaining tasks${runningTasks.length > 1 ? ' in parallel' : ''}...`));
147
151
  additionalFooterRows.push('');
148
152
  for (const runningTask of runningTasks) {
149
- additionalFooterRows.push(` ${output_1.output.dim.cyan(cli_spinners_1.dots.frames[currentFrame])} ${output_1.output.formatCommand(runningTask.task.id)}`);
153
+ additionalFooterRows.push(`${LEFT_PAD}${output_1.output.dim.cyan(cli_spinners_1.dots.frames[currentFrame])}${SPACER}${output_1.output.formatCommand(runningTask.task.id)}`);
150
154
  }
151
155
  /**
152
156
  * Reduce layout thrashing by ensuring that there is a relatively consistent
@@ -170,21 +174,20 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
170
174
  additionalFooterRows.push('');
171
175
  }
172
176
  if (totalSuccessfulTasks > 0) {
173
- additionalFooterRows.push(` ${output_1.output.colors.green(figures.tick)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
177
+ additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.green(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`);
174
178
  }
175
179
  if (totalFailedTasks > 0) {
176
- additionalFooterRows.push(` ${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
180
+ additionalFooterRows.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`);
177
181
  }
178
182
  moveCursorToStartOfPinnedFooter();
179
183
  if (additionalFooterRows.length > 1) {
180
184
  const text = `Running ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
181
185
  const taskOverridesRows = [];
182
186
  if (Object.keys(overrides).length > 0) {
183
- const leftPadding = `${output_1.output.X_PADDING} `;
184
187
  taskOverridesRows.push('');
185
- taskOverridesRows.push(`${leftPadding}${output_1.output.dim.cyan('With additional flags:')}`);
188
+ taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.cyan('With additional flags:')}`);
186
189
  Object.entries(overrides)
187
- .map(([flag, value]) => output_1.output.dim.cyan((0, formatting_utils_1.formatFlags)(leftPadding, flag, value)))
190
+ .map(([flag, value]) => output_1.output.dim.cyan((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
188
191
  .forEach((arg) => taskOverridesRows.push(arg));
189
192
  }
190
193
  const pinnedFooterLines = [
@@ -221,11 +224,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
221
224
  const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
222
225
  const taskOverridesRows = [];
223
226
  if (Object.keys(overrides).length > 0) {
224
- const leftPadding = `${output_1.output.X_PADDING} `;
225
227
  taskOverridesRows.push('');
226
- taskOverridesRows.push(`${leftPadding}${output_1.output.dim.green('With additional flags:')}`);
228
+ taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
227
229
  Object.entries(overrides)
228
- .map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(leftPadding, flag, value)))
230
+ .map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
229
231
  .forEach((arg) => taskOverridesRows.push(arg));
230
232
  }
231
233
  const pinnedFooterLines = [
@@ -233,7 +235,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
233
235
  ...taskOverridesRows,
234
236
  ];
235
237
  if (totalCachedTasks > 0) {
236
- pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL} Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
238
+ pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
237
239
  }
238
240
  renderPinnedFooter(pinnedFooterLines, 'green');
239
241
  }
@@ -241,11 +243,10 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
241
243
  const text = `Ran ${(0, formatting_utils_1.formatTargetsAndProjects)(projectNames, targets, tasks)}`;
242
244
  const taskOverridesRows = [];
243
245
  if (Object.keys(overrides).length > 0) {
244
- const leftPadding = `${output_1.output.X_PADDING} `;
245
246
  taskOverridesRows.push('');
246
- taskOverridesRows.push(`${leftPadding}${output_1.output.dim.red('With additional flags:')}`);
247
+ taskOverridesRows.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
247
248
  Object.entries(overrides)
248
- .map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(leftPadding, flag, value)))
249
+ .map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
249
250
  .forEach((arg) => taskOverridesRows.push(arg));
250
251
  }
251
252
  const numFailedToPrint = 5;
@@ -254,15 +255,16 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
254
255
  output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim.white(` (${timeTakenText})`)),
255
256
  ...taskOverridesRows,
256
257
  '',
257
- output_1.output.dim(` ${output_1.output.dim(figures.tick)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
258
+ output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`),
259
+ '',
260
+ `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
258
261
  '',
259
- ` ${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
260
262
  `${failedTasksForPrinting
261
- .map((t) => ` ${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
263
+ .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
262
264
  .join('\n ')}`,
263
265
  ];
264
266
  if (failedTasks.size > numFailedToPrint) {
265
- failureSummaryRows.push(output_1.output.dim(` ...and ${failedTasks.size - numFailedToPrint} more...`));
267
+ failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
266
268
  }
267
269
  failureSummaryRows.push(...(0, view_logs_utils_1.viewLogsFooterRows)(failedTasks.size));
268
270
  renderPinnedFooter(failureSummaryRows, 'red');
@@ -314,8 +316,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
314
316
  }
315
317
  exports.createRunManyDynamicOutputRenderer = createRunManyDynamicOutputRenderer;
316
318
  function writeCompletedTaskResultLine(line) {
317
- const additionalXPadding = ' ';
318
- output_1.output.overwriteLine(output_1.output.X_PADDING + additionalXPadding + line);
319
+ output_1.output.overwriteLine(LEFT_PAD + line);
319
320
  }
320
321
  /**
321
322
  * There's not much we can do in order to "neaten up" the outputs of
@@ -326,7 +327,6 @@ function writeCompletedTaskResultLine(line) {
326
327
  function writeCommandOutputBlock(commandOutput) {
327
328
  commandOutput = commandOutput || '';
328
329
  commandOutput = commandOutput.trimStart();
329
- const additionalXPadding = ' ';
330
330
  const lines = commandOutput.split(os_1.EOL);
331
331
  let totalTrailingEmptyLines = 0;
332
332
  for (let i = lines.length - 1; i >= 0; i--) {
@@ -341,5 +341,5 @@ function writeCommandOutputBlock(commandOutput) {
341
341
  }
342
342
  lines.push('');
343
343
  // Indent the command output to make it look more "designed" in the context of the dynamic output
344
- lines.forEach((l) => output_1.output.overwriteLine(`${output_1.output.X_PADDING}${additionalXPadding}${l}`));
344
+ lines.forEach((l) => output_1.output.overwriteLine(`${EXTENDED_LEFT_PAD}${l}`));
345
345
  }
@@ -9,6 +9,9 @@ const output_1 = require("../../utils/output");
9
9
  const pretty_time_1 = require("./pretty-time");
10
10
  const formatting_utils_1 = require("./formatting-utils");
11
11
  const view_logs_utils_1 = require("./view-logs-utils");
12
+ const LEFT_PAD = ` `;
13
+ const SPACER = ` `;
14
+ const EXTENDED_LEFT_PAD = ` `;
12
15
  /**
13
16
  * The following function is responsible for creating a life cycle with dynamic
14
17
  * outputs, meaning previous outputs can be rewritten or modified as new outputs
@@ -57,7 +60,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
57
60
  const moveCursorToStartOfDependentTargetLines = () => {
58
61
  readline.moveCursor(process.stdout, 0, -dependentTargetsNumLines);
59
62
  };
60
- const renderLines = (lines, dividerColor = 'cyan', renderDivider = true, skipPadding = false) => {
63
+ const renderLines = (lines, dividerColor = 'cyan', renderDivider = true) => {
61
64
  let additionalLines = 0;
62
65
  if (renderDivider) {
63
66
  const dividerLines = output_1.output.getVerticalSeparatorLines(dividerColor);
@@ -68,7 +71,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
68
71
  lines.push('');
69
72
  }
70
73
  for (const line of lines) {
71
- output_1.output.overwriteLine((skipPadding ? '' : output_1.output.X_PADDING) + line);
74
+ output_1.output.overwriteLine(line);
72
75
  }
73
76
  dependentTargetsNumLines = lines.length + additionalLines;
74
77
  // clear any possible text below the cursor's position
@@ -86,7 +89,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
86
89
  switch (state) {
87
90
  case 'EXECUTING_DEPENDENT_TARGETS':
88
91
  if (totalFailedTasks === 0) {
89
- linesToRender.push(` ${output_1.output.colors.cyan(cli_spinners_1.dots.frames[dependentTargetsCurrentFrame])} ${output_1.output.dim(`Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from`)} ${initiatingProject}${output_1.output.dim('...')}`);
92
+ linesToRender.push(`${LEFT_PAD}${output_1.output.colors.cyan(cli_spinners_1.dots.frames[dependentTargetsCurrentFrame])}${SPACER}${output_1.output.dim(`Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from`)} ${initiatingProject}${output_1.output.dim('...')}`);
90
93
  if (totalSuccessfulTasks > 0) {
91
94
  linesToRender.push('');
92
95
  }
@@ -94,14 +97,14 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
94
97
  break;
95
98
  }
96
99
  if (totalFailedTasks > 0) {
97
- linesToRender.push(output_1.output.colors.red.dim(` ${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)`));
100
+ linesToRender.push(output_1.output.colors.red.dim(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)`));
98
101
  }
99
102
  if (totalSuccessfulTasks > 0) {
100
- linesToRender.push(output_1.output.dim(` ${output_1.output.dim(figures.tick)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
103
+ linesToRender.push(output_1.output.dim(`${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`));
101
104
  }
102
105
  moveCursorToStartOfDependentTargetLines();
103
106
  if (linesToRender.length > 1) {
104
- renderLines(linesToRender, 'gray', renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS', true);
107
+ renderLines(linesToRender, 'gray', renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS');
105
108
  }
106
109
  else {
107
110
  renderLines([]);
@@ -120,7 +123,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
120
123
  renderDependentTargets(false);
121
124
  if (totalDependentTasksNotFromInitiatingProject > 0) {
122
125
  output_1.output.addNewline();
123
- process.stdout.write(` ${output_1.output.dim('Hint: you can run the command with')} --verbose ${output_1.output.dim('to see the full dependent project outputs')}` + os_1.EOL);
126
+ process.stdout.write(`${LEFT_PAD}${output_1.output.dim('Hint: you can run the command with')} --verbose ${output_1.output.dim('to see the full dependent project outputs')}` + os_1.EOL);
124
127
  output_1.output.addVerticalSeparator('gray');
125
128
  }
126
129
  }
@@ -132,9 +135,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
132
135
  };
133
136
  lifeCycle.printTaskTerminalOutput = (task, cacheStatus, terminalOutput) => {
134
137
  if (task.target.project === initiatingProject) {
135
- output_1.output.logCommand(task.id, cacheStatus);
136
- output_1.output.addNewline();
137
- process.stdout.write(terminalOutput);
138
+ output_1.output.logCommandOutput(task.id, cacheStatus, terminalOutput);
138
139
  }
139
140
  else {
140
141
  tasksToTerminalOutputs[task.id] = terminalOutput;
@@ -163,9 +164,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
163
164
  clearRenderInterval();
164
165
  renderDependentTargets(false);
165
166
  output_1.output.addVerticalSeparator('red');
166
- output_1.output.logCommand(t.task.id, t.status);
167
- output_1.output.addNewline();
168
- process.stdout.write(tasksToTerminalOutputs[t.task.id]);
167
+ output_1.output.logCommandOutput(t.task.id, t.status, tasksToTerminalOutputs[t.task.id]);
169
168
  }
170
169
  break;
171
170
  }
@@ -180,11 +179,10 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
180
179
  const text = `Successfully ran ${(0, formatting_utils_1.formatTargetsAndProjects)([initiatingProject], [targetName], tasks)}`;
181
180
  const taskOverridesLines = [];
182
181
  if (Object.keys(overrides).length > 0) {
183
- const leftPadding = `${output_1.output.X_PADDING} `;
184
182
  taskOverridesLines.push('');
185
- taskOverridesLines.push(`${leftPadding}${output_1.output.dim.green('With additional flags:')}`);
183
+ taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.green('With additional flags:')}`);
186
184
  Object.entries(overrides)
187
- .map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(leftPadding, flag, value)))
185
+ .map(([flag, value]) => output_1.output.dim.green((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
188
186
  .forEach((arg) => taskOverridesLines.push(arg));
189
187
  }
190
188
  const pinnedFooterLines = [
@@ -192,7 +190,7 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
192
190
  ...taskOverridesLines,
193
191
  ];
194
192
  if (totalCachedTasks > 0) {
195
- pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL} Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
193
+ pinnedFooterLines.push(output_1.output.dim(`${os_1.EOL}Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`));
196
194
  }
197
195
  renderLines(pinnedFooterLines, 'green');
198
196
  }
@@ -204,11 +202,10 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
204
202
  }
205
203
  const taskOverridesLines = [];
206
204
  if (Object.keys(overrides).length > 0) {
207
- const leftPadding = `${output_1.output.X_PADDING} `;
208
205
  taskOverridesLines.push('');
209
- taskOverridesLines.push(`${leftPadding}${output_1.output.dim.red('With additional flags:')}`);
206
+ taskOverridesLines.push(`${EXTENDED_LEFT_PAD}${output_1.output.dim.red('With additional flags:')}`);
210
207
  Object.entries(overrides)
211
- .map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(leftPadding, flag, value)))
208
+ .map(([flag, value]) => output_1.output.dim.red((0, formatting_utils_1.formatFlags)(EXTENDED_LEFT_PAD, flag, value)))
212
209
  .forEach((arg) => taskOverridesLines.push(arg));
213
210
  }
214
211
  const viewLogs = (0, view_logs_utils_1.viewLogsFooterRows)(totalFailedTasks);
@@ -216,8 +213,8 @@ async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, arg
216
213
  output_1.output.applyNxPrefix('red', output_1.output.colors.red(text) + output_1.output.dim(` (${timeTakenText})`)),
217
214
  ...taskOverridesLines,
218
215
  '',
219
- ` ${output_1.output.colors.red(figures.cross)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
220
- ` ${output_1.output.dim(figures.tick)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
216
+ `${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
217
+ `${LEFT_PAD}${output_1.output.dim(figures.tick)}${SPACER}${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output_1.output.dim(`[${totalCachedTasks} read from cache]`)}`,
221
218
  ...viewLogs,
222
219
  ], 'red');
223
220
  }
@@ -9,9 +9,7 @@ class EmptyTerminalOutputLifeCycle {
9
9
  cacheStatus === 'failure' ||
10
10
  cacheStatus === 'skipped') {
11
11
  const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
12
- output_1.output.logCommand(args.join(' '), cacheStatus);
13
- output_1.output.addNewline();
14
- process.stdout.write(terminalOutput);
12
+ output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
15
13
  }
16
14
  }
17
15
  }
@@ -61,9 +61,7 @@ class InvokeRunnerTerminalOutputLifeCycle {
61
61
  }
62
62
  printTaskTerminalOutput(task, cacheStatus, terminalOutput) {
63
63
  const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
64
- output_1.output.logCommand(args.join(' '), cacheStatus);
65
- output_1.output.addNewline();
66
- process.stdout.write(terminalOutput);
64
+ output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
67
65
  }
68
66
  }
69
67
  exports.InvokeRunnerTerminalOutputLifeCycle = InvokeRunnerTerminalOutputLifeCycle;
@@ -27,7 +27,7 @@ class StaticRunManyTerminalOutputLifeCycle {
27
27
  output_1.output.logSingleLine(`No projects with ${(0, formatting_utils_1.formatTargetsAndProjects)(this.projectNames, this.args.targets, this.tasks)} were run`);
28
28
  return;
29
29
  }
30
- const bodyLines = this.projectNames.map((affectedProject) => ` ${output_1.output.dim('-')} ${affectedProject}`);
30
+ const bodyLines = this.projectNames.map((affectedProject) => `${output_1.output.dim('-')} ${affectedProject}`);
31
31
  if (Object.keys(this.taskOverrides).length > 0) {
32
32
  bodyLines.push('');
33
33
  bodyLines.push(`${output_1.output.dim('With additional flags:')}`);
@@ -93,9 +93,7 @@ class StaticRunManyTerminalOutputLifeCycle {
93
93
  }
94
94
  printTaskTerminalOutput(task, cacheStatus, terminalOutput) {
95
95
  const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
96
- output_1.output.logCommand(args.join(' '), cacheStatus);
97
- output_1.output.addNewline();
98
- process.stdout.write(terminalOutput);
96
+ output_1.output.logCommandOutput(args.join(' '), cacheStatus, terminalOutput);
99
97
  }
100
98
  }
101
99
  exports.StaticRunManyTerminalOutputLifeCycle = StaticRunManyTerminalOutputLifeCycle;
@@ -19,6 +19,7 @@ export declare class StaticRunOneTerminalOutputLifeCycle implements LifeCycle {
19
19
  constructor(initiatingProject: string, projectNames: string[], tasks: Task[], args: {
20
20
  targets?: string[];
21
21
  configuration?: string;
22
+ verbose?: boolean;
22
23
  });
23
24
  startCommand(): void;
24
25
  endCommand(): void;
@@ -78,13 +78,19 @@ class StaticRunOneTerminalOutputLifeCycle {
78
78
  }
79
79
  }
80
80
  printTaskTerminalOutput(task, status, terminalOutput) {
81
- if (status === 'success' ||
81
+ const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
82
+ if (this.args.verbose ||
83
+ status === 'success' ||
82
84
  status === 'failure' ||
83
85
  task.target.project === this.initiatingProject) {
84
- const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
85
- output_1.output.logCommand(args.join(' '), status);
86
- output_1.output.addNewline();
87
- process.stdout.write(terminalOutput);
86
+ output_1.output.logCommandOutput(args.join(' '), status, terminalOutput);
87
+ }
88
+ else {
89
+ /**
90
+ * Do not show the terminal output in the case where it is not the initiating project and verbose is not set,
91
+ * but still print the command that was run and its status (so that cache hits can still be traced).
92
+ */
93
+ output_1.output.logCommandOutput(args.join(' '), status, '');
88
94
  }
89
95
  }
90
96
  }
@@ -7,7 +7,7 @@ const output_1 = require("../../utils/output");
7
7
  const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.`;
8
8
  function viewLogsFooterRows(failedTasks) {
9
9
  if (failedTasks >= 2 && !(0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
10
- return [``, output_1.output.dim(`${output_1.output.X_PADDING} ${VIEW_LOGS_MESSAGE}`)];
10
+ return [``, output_1.output.dim(` ${VIEW_LOGS_MESSAGE}`)];
11
11
  }
12
12
  else {
13
13
  return [];
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Node IPC is specific to Node, but when spawning child processes in Rust, it won't have IPC.
3
+ *
4
+ * Thus, this is a wrapper which is spawned by Rust, which will create a Node IPC channel and pipe it to a ZeroMQ Channel
5
+ *
6
+ * Main Nx Process
7
+ * * Calls Rust Fork Function
8
+ * * `node fork.js`
9
+ * * Create a Rust - Node.js Agnostic Channel aka Pseudo IPC Channel
10
+ * * This returns RustChildProcess
11
+ * * RustChildProcess.onMessage(msg => ());
12
+ * * pseudo_ipc_channel.on_message() => tx.send(msg);
13
+ * * Node.js Fork Wrapper (fork.js)
14
+ * * fork(run-command.js) with `inherit` and `ipc`
15
+ * * This will create a Node IPC Channel
16
+ * * channel = getPseudoIpcChannel(process.env.NX_IPC_CHANNEL_ID)
17
+ * * forkChildProcess.on('message', writeToPseudoIpcChannel)
18
+ */
19
+ /// <reference types="node" />
20
+ import { Serializable } from 'child_process';
21
+ export interface PseudoIPCMessage {
22
+ type: 'TO_CHILDREN_FROM_PARENT' | 'TO_PARENT_FROM_CHILDREN' | 'CHILD_READY';
23
+ id: string | undefined;
24
+ message: Serializable;
25
+ }
26
+ export declare class PseudoIPCServer {
27
+ private path;
28
+ private sockets;
29
+ private server;
30
+ private childMessages;
31
+ constructor(path: string);
32
+ init(): Promise<void>;
33
+ private childReadyMap;
34
+ waitForChildReady(childId: string): Promise<void>;
35
+ private registerChildMessages;
36
+ sendMessageToChildren(message: Serializable): void;
37
+ sendMessageToChild(id: string, message: Serializable): void;
38
+ onMessageFromChildren(onMessage: (message: Serializable) => void, onClose?: () => void, onError?: (err: Error) => void): void;
39
+ close(): void;
40
+ }
41
+ export declare class PseudoIPCClient {
42
+ private path;
43
+ private socket;
44
+ constructor(path: string);
45
+ sendMessageToParent(message: Serializable): void;
46
+ notifyChildIsReady(id: string): void;
47
+ onMessageFromParent(forkId: string, onMessage: (message: Serializable) => void, onClose?: () => void, onError?: (err: Error) => void): this;
48
+ close(): void;
49
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ /**
3
+ * Node IPC is specific to Node, but when spawning child processes in Rust, it won't have IPC.
4
+ *
5
+ * Thus, this is a wrapper which is spawned by Rust, which will create a Node IPC channel and pipe it to a ZeroMQ Channel
6
+ *
7
+ * Main Nx Process
8
+ * * Calls Rust Fork Function
9
+ * * `node fork.js`
10
+ * * Create a Rust - Node.js Agnostic Channel aka Pseudo IPC Channel
11
+ * * This returns RustChildProcess
12
+ * * RustChildProcess.onMessage(msg => ());
13
+ * * pseudo_ipc_channel.on_message() => tx.send(msg);
14
+ * * Node.js Fork Wrapper (fork.js)
15
+ * * fork(run-command.js) with `inherit` and `ipc`
16
+ * * This will create a Node IPC Channel
17
+ * * channel = getPseudoIpcChannel(process.env.NX_IPC_CHANNEL_ID)
18
+ * * forkChildProcess.on('message', writeToPseudoIpcChannel)
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.PseudoIPCClient = exports.PseudoIPCServer = void 0;
22
+ const net_1 = require("net");
23
+ const consume_messages_from_socket_1 = require("../utils/consume-messages-from-socket");
24
+ class PseudoIPCServer {
25
+ constructor(path) {
26
+ this.path = path;
27
+ this.sockets = new Set();
28
+ this.childMessages = [];
29
+ this.childReadyMap = new Map();
30
+ }
31
+ init() {
32
+ return new Promise((res) => {
33
+ this.server = new net_1.Server((socket) => {
34
+ this.sockets.add(socket);
35
+ this.registerChildMessages(socket);
36
+ socket.on('close', () => {
37
+ this.sockets.delete(socket);
38
+ });
39
+ });
40
+ this.server.listen(this.path, () => {
41
+ res();
42
+ });
43
+ });
44
+ }
45
+ async waitForChildReady(childId) {
46
+ return new Promise((res) => {
47
+ this.childReadyMap.set(childId, res);
48
+ });
49
+ }
50
+ registerChildMessages(socket) {
51
+ socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(async (rawMessage) => {
52
+ const { type, message } = JSON.parse(rawMessage);
53
+ if (type === 'TO_PARENT_FROM_CHILDREN') {
54
+ for (const childMessage of this.childMessages) {
55
+ childMessage.onMessage(message);
56
+ }
57
+ }
58
+ else if (type === 'CHILD_READY') {
59
+ const childId = message;
60
+ if (this.childReadyMap.has(childId)) {
61
+ this.childReadyMap.get(childId)();
62
+ }
63
+ }
64
+ }));
65
+ socket.on('close', () => {
66
+ for (const childMessage of this.childMessages) {
67
+ childMessage.onClose?.();
68
+ }
69
+ });
70
+ socket.on('error', (err) => {
71
+ for (const childMessage of this.childMessages) {
72
+ childMessage.onError?.(err);
73
+ }
74
+ });
75
+ }
76
+ sendMessageToChildren(message) {
77
+ this.sockets.forEach((socket) => {
78
+ socket.write(JSON.stringify({ type: 'TO_CHILDREN_FROM_PARENT', message }));
79
+ // send EOT to indicate that the message has been fully written
80
+ socket.write(String.fromCodePoint(4));
81
+ });
82
+ }
83
+ sendMessageToChild(id, message) {
84
+ this.sockets.forEach((socket) => {
85
+ socket.write(JSON.stringify({ type: 'TO_CHILDREN_FROM_PARENT', id, message }));
86
+ socket.write(String.fromCodePoint(4));
87
+ });
88
+ }
89
+ onMessageFromChildren(onMessage, onClose = () => { }, onError = (err) => { }) {
90
+ this.childMessages.push({
91
+ onMessage,
92
+ onClose,
93
+ onError,
94
+ });
95
+ }
96
+ close() {
97
+ this.server?.close();
98
+ this.sockets.forEach((s) => s.destroy());
99
+ }
100
+ }
101
+ exports.PseudoIPCServer = PseudoIPCServer;
102
+ class PseudoIPCClient {
103
+ constructor(path) {
104
+ this.path = path;
105
+ this.socket = (0, net_1.connect)(this.path);
106
+ }
107
+ sendMessageToParent(message) {
108
+ this.socket.write(JSON.stringify({ type: 'TO_PARENT_FROM_CHILDREN', message }));
109
+ // send EOT to indicate that the message has been fully written
110
+ this.socket.write(String.fromCodePoint(4));
111
+ }
112
+ notifyChildIsReady(id) {
113
+ this.socket.write(JSON.stringify({
114
+ type: 'CHILD_READY',
115
+ message: id,
116
+ }));
117
+ // send EOT to indicate that the message has been fully written
118
+ this.socket.write(String.fromCodePoint(4));
119
+ }
120
+ onMessageFromParent(forkId, onMessage, onClose = () => { }, onError = (err) => { }) {
121
+ this.socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(async (rawMessage) => {
122
+ const { id, type, message } = JSON.parse(rawMessage);
123
+ if (type === 'TO_CHILDREN_FROM_PARENT') {
124
+ if (id && id === forkId) {
125
+ onMessage(message);
126
+ }
127
+ else if (id === undefined) {
128
+ onMessage(message);
129
+ }
130
+ }
131
+ }));
132
+ this.socket.on('close', onClose);
133
+ this.socket.on('error', onError);
134
+ return this;
135
+ }
136
+ close() {
137
+ this.socket?.destroy();
138
+ }
139
+ }
140
+ exports.PseudoIPCClient = PseudoIPCClient;
@@ -0,0 +1,43 @@
1
+ /// <reference types="node" />
2
+ import { ChildProcess, RustPseudoTerminal } from '../native';
3
+ import { PseudoIPCServer } from './pseudo-ipc';
4
+ import { Serializable } from 'child_process';
5
+ export declare function getPseudoTerminal(skipSupportCheck?: boolean): PseudoTerminal;
6
+ export declare class PseudoTerminal {
7
+ private rustPseudoTerminal;
8
+ private pseudoIPCPath;
9
+ private pseudoIPC;
10
+ private initialized;
11
+ static isSupported(): boolean;
12
+ constructor(rustPseudoTerminal: RustPseudoTerminal);
13
+ init(): Promise<void>;
14
+ runCommand(command: string, { cwd, jsEnv, quiet, }?: {
15
+ cwd?: string;
16
+ jsEnv?: Record<string, string>;
17
+ quiet?: boolean;
18
+ }): PseudoTtyProcess;
19
+ fork(id: string, script: string, { cwd, jsEnv, quiet, }: {
20
+ cwd?: string;
21
+ jsEnv?: Record<string, string>;
22
+ quiet?: boolean;
23
+ }): Promise<PseudoTtyProcessWithSend>;
24
+ sendMessageToChildren(message: Serializable): void;
25
+ onMessageFromChildren(callback: (message: Serializable) => void): void;
26
+ private setupProcessListeners;
27
+ private shutdownPseudoIPC;
28
+ }
29
+ export declare class PseudoTtyProcess {
30
+ private childProcess;
31
+ isAlive: boolean;
32
+ exitCallbacks: any[];
33
+ constructor(childProcess: ChildProcess);
34
+ onExit(callback: (code: number) => void): void;
35
+ onOutput(callback: (message: string) => void): void;
36
+ kill(): void;
37
+ }
38
+ export declare class PseudoTtyProcessWithSend extends PseudoTtyProcess {
39
+ private id;
40
+ private pseudoIpc;
41
+ constructor(_childProcess: ChildProcess, id: string, pseudoIpc: PseudoIPCServer);
42
+ send(message: Serializable): void;
43
+ }