nx 23.2.0-beta.1 → 23.2.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/init-local.js +3 -5
  3. package/dist/bin/nx.js +2 -0
  4. package/dist/release/changelog-renderer/index.js +4 -5
  5. package/dist/release/index.d.ts +1 -1
  6. package/dist/src/adapter/ngcli-adapter.js +60 -1
  7. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
  8. package/dist/src/analytics/analytics.d.ts +6 -0
  9. package/dist/src/analytics/analytics.js +16 -10
  10. package/dist/src/analytics/index.d.ts +1 -1
  11. package/dist/src/analytics/index.js +2 -1
  12. package/dist/src/command-line/add/add.js +5 -0
  13. package/dist/src/command-line/affected/affected.js +1 -0
  14. package/dist/src/command-line/completion/command-object.js +7 -12
  15. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
  16. package/dist/src/command-line/format/format.js +84 -101
  17. package/dist/src/command-line/generate/generate.js +35 -35
  18. package/dist/src/command-line/graph/graph.d.ts +1 -0
  19. package/dist/src/command-line/graph/graph.js +15 -6
  20. package/dist/src/command-line/import/import.js +30 -40
  21. package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
  22. package/dist/src/command-line/init/command-object.js +4 -2
  23. package/dist/src/command-line/init/configure-plugins.js +4 -1
  24. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
  25. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
  26. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
  27. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
  28. package/dist/src/command-line/init/implementation/angular/index.js +10 -15
  29. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
  30. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
  31. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
  32. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
  33. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
  34. package/dist/src/command-line/init/implementation/format.d.ts +18 -0
  35. package/dist/src/command-line/init/implementation/format.js +114 -0
  36. package/dist/src/command-line/init/implementation/utils.js +8 -0
  37. package/dist/src/command-line/init/init-v1.js +15 -18
  38. package/dist/src/command-line/init/init-v2.js +40 -57
  39. package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
  40. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
  41. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
  42. package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
  43. package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
  44. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
  45. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
  46. package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
  47. package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
  48. package/dist/src/command-line/migrate/agentic/runner.js +24 -24
  49. package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
  50. package/dist/src/command-line/migrate/agentic/select.js +30 -32
  51. package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
  52. package/dist/src/command-line/migrate/agentic/types.js +35 -0
  53. package/dist/src/command-line/migrate/command-object.d.ts +6 -0
  54. package/dist/src/command-line/migrate/command-object.js +19 -1
  55. package/dist/src/command-line/migrate/execute-migration.d.ts +28 -9
  56. package/dist/src/command-line/migrate/execute-migration.js +112 -27
  57. package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
  58. package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
  59. package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
  60. package/dist/src/command-line/migrate/migrate-commits.js +130 -15
  61. package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
  62. package/dist/src/command-line/migrate/migrate-config.js +22 -14
  63. package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
  64. package/dist/src/command-line/migrate/migrate-output.js +52 -8
  65. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  66. package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
  67. package/dist/src/command-line/migrate/migrate.d.ts +28 -68
  68. package/dist/src/command-line/migrate/migrate.js +657 -293
  69. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  70. package/dist/src/command-line/migrate/multi-major.js +7 -10
  71. package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
  72. package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
  73. package/dist/src/command-line/migrate/run/agent-output.js +65 -0
  74. package/dist/src/command-line/migrate/run/index.d.ts +9 -0
  75. package/dist/src/command-line/migrate/run/index.js +23 -0
  76. package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
  77. package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
  78. package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
  79. package/dist/src/command-line/migrate/run/run-id.js +56 -0
  80. package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
  81. package/dist/src/command-line/migrate/run/run-state.js +438 -0
  82. package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
  83. package/dist/src/command-line/migrate/run/state-lock.js +76 -0
  84. package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
  85. package/dist/src/command-line/migrate/run/state-machine.js +315 -0
  86. package/dist/src/command-line/migrate/run/util.d.ts +59 -0
  87. package/dist/src/command-line/migrate/run/util.js +148 -0
  88. package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
  89. package/dist/src/command-line/migrate/run/worker.js +682 -0
  90. package/dist/src/command-line/migrate/run-migration-process.js +6 -5
  91. package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
  92. package/dist/src/command-line/migrate/safe-prompt.js +32 -43
  93. package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
  94. package/dist/src/command-line/migrate/sort-migrations.js +32 -0
  95. package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
  96. package/dist/src/command-line/migrate/step-actions.js +12 -0
  97. package/dist/src/command-line/migrate/text.d.ts +18 -0
  98. package/dist/src/command-line/migrate/text.js +26 -0
  99. package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
  100. package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
  101. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
  102. package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
  103. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
  104. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
  105. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
  106. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
  107. package/dist/src/command-line/nx-commands.js +26 -24
  108. package/dist/src/command-line/release/changelog.js +11 -17
  109. package/dist/src/command-line/release/index.d.ts +1 -1
  110. package/dist/src/command-line/release/plan.js +15 -28
  111. package/dist/src/command-line/release/publish.js +5 -0
  112. package/dist/src/command-line/release/release.js +6 -17
  113. package/dist/src/command-line/release/utils/git.js +1 -1
  114. package/dist/src/command-line/release/utils/release-graph.d.ts +18 -0
  115. package/dist/src/command-line/release/utils/release-graph.js +81 -21
  116. package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
  117. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
  118. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
  119. package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
  120. package/dist/src/command-line/release/version/release-group-processor.js +80 -6
  121. package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
  122. package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
  123. package/dist/src/command-line/release/version/version-actions.js +9 -1
  124. package/dist/src/command-line/release/version.js +10 -6
  125. package/dist/src/command-line/reset/reset.js +6 -1
  126. package/dist/src/command-line/run/run-one.js +1 -0
  127. package/dist/src/command-line/run-many/run-many.js +1 -0
  128. package/dist/src/command-line/show/show-target/inputs.js +50 -153
  129. package/dist/src/command-line/show/show-target/outputs.js +48 -173
  130. package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
  131. package/dist/src/command-line/show/show-target/utils.js +83 -3
  132. package/dist/src/command-line/watch/watch.js +13 -0
  133. package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
  134. package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
  135. package/dist/src/config/misc-interfaces.d.ts +19 -7
  136. package/dist/src/config/nx-json.d.ts +4 -2
  137. package/dist/src/core/graph/main.js +1 -1
  138. package/dist/src/core/graph/styles.js +1 -1
  139. package/dist/src/daemon/client/client.d.ts +52 -1
  140. package/dist/src/daemon/client/client.js +160 -36
  141. package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
  142. package/dist/src/daemon/client/daemon-environment.js +110 -2
  143. package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
  144. package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
  145. package/dist/src/daemon/message-types/daemon-message.js +25 -0
  146. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
  147. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
  148. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  149. package/dist/src/daemon/server/latest-nx.js +5 -2
  150. package/dist/src/daemon/server/server.js +31 -4
  151. package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
  152. package/dist/src/daemon/server/shutdown-utils.js +11 -4
  153. package/dist/src/daemon/socket-utils.d.ts +1 -0
  154. package/dist/src/daemon/socket-utils.js +24 -3
  155. package/dist/src/daemon/tmp-dir.d.ts +43 -3
  156. package/dist/src/daemon/tmp-dir.js +437 -15
  157. package/dist/src/devkit-internals.d.ts +106 -8
  158. package/dist/src/devkit-internals.js +225 -7
  159. package/dist/src/executors/run-commands/running-tasks.js +46 -29
  160. package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
  161. package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
  162. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
  163. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
  164. package/dist/src/generators/tree.d.ts +4 -2
  165. package/dist/src/hasher/check-task-files.d.ts +86 -0
  166. package/dist/src/hasher/check-task-files.js +378 -0
  167. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
  168. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
  169. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
  170. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
  171. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
  172. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
  173. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
  174. package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
  175. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
  176. package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
  177. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
  178. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
  179. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
  180. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
  181. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
  182. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
  183. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
  184. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
  185. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
  186. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
  187. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
  188. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
  189. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
  190. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
  191. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
  192. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
  193. package/dist/src/native/index.d.ts +37 -4
  194. package/dist/src/native/index.js +71 -28
  195. package/dist/src/native/native-bindings.js +3 -0
  196. package/dist/src/native/native-file-cache-location.d.ts +17 -1
  197. package/dist/src/native/native-file-cache-location.js +86 -12
  198. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  199. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  200. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
  201. package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
  202. package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
  203. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
  204. package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
  205. package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
  206. package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
  207. package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
  208. package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
  209. package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
  210. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
  211. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
  212. package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
  213. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
  214. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
  215. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
  216. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
  217. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
  218. package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
  219. package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
  220. package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
  221. package/dist/src/project-graph/build-project-graph.js +7 -1
  222. package/dist/src/project-graph/error-types.d.ts +12 -1
  223. package/dist/src/project-graph/error-types.js +27 -2
  224. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
  225. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
  226. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
  227. package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
  228. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
  229. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
  230. package/dist/src/project-graph/project-graph.js +23 -0
  231. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
  232. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
  233. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
  234. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
  235. package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
  236. package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
  237. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
  238. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
  239. package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
  240. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
  241. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
  242. package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
  243. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
  244. package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
  245. package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
  246. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  247. package/dist/src/tasks-runner/life-cycle.js +2 -2
  248. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
  249. package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
  250. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
  251. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
  252. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
  253. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
  254. package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
  255. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  256. package/dist/src/tasks-runner/run-command.js +28 -35
  257. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
  258. package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
  259. package/dist/src/tasks-runner/task-env.d.ts +9 -0
  260. package/dist/src/tasks-runner/task-env.js +31 -4
  261. package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
  262. package/dist/src/tasks-runner/task-orchestrator.js +182 -18
  263. package/dist/src/tasks-runner/utils.js +2 -6
  264. package/dist/src/utils/acknowledge-build-scripts.js +7 -5
  265. package/dist/src/utils/analytics-enabled.d.ts +7 -0
  266. package/dist/src/utils/analytics-enabled.js +11 -0
  267. package/dist/src/utils/analytics-prompt.d.ts +0 -6
  268. package/dist/src/utils/analytics-prompt.js +4 -58
  269. package/dist/src/utils/assert-workspace-validity.js +7 -2
  270. package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
  271. package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
  272. package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
  273. package/dist/src/utils/catalog/bun-manager.js +130 -0
  274. package/dist/src/utils/catalog/index.d.ts +1 -1
  275. package/dist/src/utils/catalog/index.js +1 -1
  276. package/dist/src/utils/catalog/manager-factory.js +3 -0
  277. package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
  278. package/dist/src/utils/catalog/manager-utils.js +9 -4
  279. package/dist/src/utils/catalog/manager.d.ts +13 -1
  280. package/dist/src/utils/catalog/manager.js +30 -0
  281. package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
  282. package/dist/src/utils/catalog/pnpm-manager.js +3 -0
  283. package/dist/src/utils/catalog/types.d.ts +4 -0
  284. package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
  285. package/dist/src/utils/catalog/yarn-manager.js +23 -32
  286. package/dist/src/utils/child-process.d.ts +31 -1
  287. package/dist/src/utils/child-process.js +103 -0
  288. package/dist/src/utils/chunkify.d.ts +7 -1
  289. package/dist/src/utils/chunkify.js +10 -3
  290. package/dist/src/utils/exit-codes.d.ts +9 -0
  291. package/dist/src/utils/exit-codes.js +19 -0
  292. package/dist/src/utils/fileutils.d.ts +5 -0
  293. package/dist/src/utils/fileutils.js +7 -2
  294. package/dist/src/utils/formatters/index.d.ts +13 -0
  295. package/dist/src/utils/formatters/index.js +74 -0
  296. package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
  297. package/dist/src/utils/formatters/oxfmt.js +764 -0
  298. package/dist/src/utils/formatters/prettier.d.ts +26 -0
  299. package/dist/src/utils/formatters/prettier.js +201 -0
  300. package/dist/src/utils/formatters/shared.d.ts +5 -0
  301. package/dist/src/utils/formatters/shared.js +8 -0
  302. package/dist/src/utils/git-utils.d.ts +48 -2
  303. package/dist/src/utils/git-utils.js +220 -14
  304. package/dist/src/utils/git-worktrees.d.ts +30 -0
  305. package/dist/src/utils/git-worktrees.js +212 -0
  306. package/dist/src/utils/has-nx-js-plugin.d.ts +1 -1
  307. package/dist/src/utils/has-nx-js-plugin.js +1 -1
  308. package/dist/src/utils/ignore.d.ts +170 -1
  309. package/dist/src/utils/ignore.js +263 -11
  310. package/dist/src/utils/kill-child-on-host-exit.d.ts +7 -0
  311. package/dist/src/utils/kill-child-on-host-exit.js +42 -0
  312. package/dist/src/utils/long-running-target.d.ts +10 -0
  313. package/dist/src/utils/long-running-target.js +19 -0
  314. package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
  315. package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
  316. package/dist/src/utils/min-release-age/packument.js +1 -1
  317. package/dist/src/utils/nx-console-prompt.js +3 -6
  318. package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
  319. package/dist/src/utils/nx-tmp-dir.js +40 -0
  320. package/dist/src/utils/output.d.ts +153 -0
  321. package/dist/src/utils/output.js +289 -5
  322. package/dist/src/utils/owned-private-dir.d.ts +132 -0
  323. package/dist/src/utils/owned-private-dir.js +323 -0
  324. package/dist/src/utils/package-json.d.ts +2 -0
  325. package/dist/src/utils/package-json.js +11 -7
  326. package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
  327. package/dist/src/utils/package-manager-config/bunfig.js +49 -0
  328. package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
  329. package/dist/src/utils/package-manager-config/npmrc.js +124 -0
  330. package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
  331. package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
  332. package/dist/src/utils/package-manager.d.ts +23 -2
  333. package/dist/src/utils/package-manager.js +262 -42
  334. package/dist/src/utils/params.d.ts +7 -1
  335. package/dist/src/utils/params.js +64 -6
  336. package/dist/src/utils/plugins/core-plugins.js +4 -0
  337. package/dist/src/utils/prompt-helpers.d.ts +53 -0
  338. package/dist/src/utils/prompt-helpers.js +111 -0
  339. package/dist/src/utils/provenance.js +6 -14
  340. package/dist/src/utils/registry-config/bun.d.ts +2 -0
  341. package/dist/src/utils/registry-config/bun.js +257 -0
  342. package/dist/src/utils/registry-config/index.d.ts +13 -0
  343. package/dist/src/utils/registry-config/index.js +102 -0
  344. package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
  345. package/dist/src/utils/registry-config/pnpm.js +1551 -0
  346. package/dist/src/utils/registry-config/utils.d.ts +195 -0
  347. package/dist/src/utils/registry-config/utils.js +496 -0
  348. package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
  349. package/dist/src/utils/registry-config/yarn-berry.js +612 -0
  350. package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
  351. package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
  352. package/dist/src/utils/safe-spawn.d.ts +24 -0
  353. package/dist/src/utils/safe-spawn.js +104 -0
  354. package/dist/src/utils/shell-quoting.d.ts +15 -0
  355. package/dist/src/utils/shell-quoting.js +35 -0
  356. package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
  357. package/dist/src/utils/wait-for-socket-connection.js +14 -8
  358. package/dist/src/utils/workspace-id.d.ts +20 -0
  359. package/dist/src/utils/workspace-id.js +54 -0
  360. package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
  361. package/dist/src/utils/write-formatted-json-file.js +5 -4
  362. package/migrations.json +6 -0
  363. package/package.json +29 -19
  364. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
  365. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
  366. package/dist/src/utils/is-using-prettier.d.ts +0 -3
  367. package/dist/src/utils/is-using-prettier.js +0 -62
  368. package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
  369. package/dist/src/utils/min-release-age/npmrc.js +0 -45
@@ -31,17 +31,18 @@ const command_object_21 = require("./nx-cloud/logout/command-object");
31
31
  const command_object_22 = require("./nx-cloud/record/command-object");
32
32
  const command_object_23 = require("./nx-cloud/start-agent/command-object");
33
33
  const command_object_24 = require("./nx-cloud/start-ci-run/command-object");
34
- const command_object_25 = require("./register/command-object");
35
- const command_object_26 = require("./release/command-object");
36
- const command_object_27 = require("./repair/command-object");
37
- const command_object_28 = require("./report/command-object");
38
- const command_object_29 = require("./reset/command-object");
39
- const command_object_30 = require("./run-many/command-object");
40
- const command_object_31 = require("./run/command-object");
41
- const command_object_32 = require("./show/command-object");
42
- const command_object_33 = require("./sync/command-object");
43
- const command_object_34 = require("./watch/command-object");
44
- const command_object_35 = require("./completion/command-object");
34
+ const command_object_25 = require("./nx-cloud/start-nx-agents/command-object");
35
+ const command_object_26 = require("./register/command-object");
36
+ const command_object_27 = require("./release/command-object");
37
+ const command_object_28 = require("./repair/command-object");
38
+ const command_object_29 = require("./report/command-object");
39
+ const command_object_30 = require("./reset/command-object");
40
+ const command_object_31 = require("./run-many/command-object");
41
+ const command_object_32 = require("./run/command-object");
42
+ const command_object_33 = require("./show/command-object");
43
+ const command_object_34 = require("./sync/command-object");
44
+ const command_object_35 = require("./watch/command-object");
45
+ const command_object_36 = require("./completion/command-object");
45
46
  const trigger_1 = require("./completion/trigger");
46
47
  // Ensure that the output takes up the available width of the terminal.
47
48
  yargs.wrap(yargs.terminalWidth());
@@ -59,7 +60,7 @@ exports.commandsObject = yargs
59
60
  .parserConfiguration(exports.parserConfiguration)
60
61
  .usage(pc.bold('Smart Monorepos · Fast Builds'))
61
62
  .demandCommand(1, '')
62
- .command(command_object_25.yargsRegisterCommand)
63
+ .command(command_object_26.yargsRegisterCommand)
63
64
  .command(command_object_1.yargsAddCommand)
64
65
  .command(command_object_3.yargsConfigureAiAgentsCommand)
65
66
  .command(command_object_2.yargsAffectedBuildCommand)
@@ -82,29 +83,30 @@ exports.commandsObject = yargs
82
83
  .command(command_object_13.yargsMigrateCommand)
83
84
  .command(command_object_14.yargsNewCommand)
84
85
  .command(command_objects_1.yargsPrintAffectedCommand)
85
- .command(command_object_26.yargsReleaseCommand)
86
- .command(command_object_27.yargsRepairCommand)
87
- .command(command_object_28.yargsReportCommand)
88
- .command(command_object_29.yargsResetCommand)
89
- .command(command_object_31.yargsRunCommand)
90
- .command(command_object_30.yargsRunManyCommand)
91
- .command(command_object_32.yargsShowCommand)
92
- .command(command_object_33.yargsSyncCommand)
93
- .command(command_object_33.yargsSyncCheckCommand)
86
+ .command(command_object_27.yargsReleaseCommand)
87
+ .command(command_object_28.yargsRepairCommand)
88
+ .command(command_object_29.yargsReportCommand)
89
+ .command(command_object_30.yargsResetCommand)
90
+ .command(command_object_32.yargsRunCommand)
91
+ .command(command_object_31.yargsRunManyCommand)
92
+ .command(command_object_33.yargsShowCommand)
93
+ .command(command_object_34.yargsSyncCommand)
94
+ .command(command_object_34.yargsSyncCheckCommand)
94
95
  .command(command_object_17.yargsViewLogsCommand)
95
- .command(command_object_34.yargsWatchCommand)
96
- .command(command_object_31.yargsNxInfixCommand)
96
+ .command(command_object_35.yargsWatchCommand)
97
+ .command(command_object_32.yargsNxInfixCommand)
97
98
  .command(command_object_20.yargsLoginCommand)
98
99
  .command(command_object_21.yargsLogoutCommand)
99
100
  .command(command_object_22.yargsRecordCommand)
100
101
  .command(command_object_24.yargsStartCiRunCommand)
102
+ .command(command_object_25.yargsStartNxAgentsCommand)
101
103
  .command(command_object_23.yargsStartAgentCommand)
102
104
  .command(command_object_16.yargsStopAllAgentsCommand)
103
105
  .command(command_object_19.yargsFixCiCommand)
104
106
  .command(command_object_15.yargsApplyLocallyCommand)
105
107
  .command(command_object_18.yargsDownloadCloudClientCommand)
106
108
  .command(command_object_12.yargsMcpCommand)
107
- .command(command_object_35.yargsCompletionCommand)
109
+ .command(command_object_36.yargsCompletionCommand)
108
110
  .command(resolveConformanceCommandObject())
109
111
  .command(resolveConformanceCheckCommandObject())
110
112
  .scriptName('nx')
@@ -5,7 +5,7 @@ exports.isChangelogEffectivelyEnabled = isChangelogEffectivelyEnabled;
5
5
  exports.createAPI = createAPI;
6
6
  const tslib_1 = require("tslib");
7
7
  const pc = tslib_1.__importStar(require("picocolors"));
8
- const enquirer_1 = require("enquirer");
8
+ const prompt_helpers_1 = require("../../utils/prompt-helpers");
9
9
  const node_fs_1 = require("node:fs");
10
10
  const semver_1 = require("semver");
11
11
  const tmp_1 = require("tmp");
@@ -305,6 +305,11 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
305
305
  const projectNodes = projects.map((name) => projectGraph.nodes[name]);
306
306
  if (releaseGroup.projectsRelationship === 'independent') {
307
307
  for (const project of projectNodes) {
308
+ if (!projectsVersionData[project.name] ||
309
+ (projectsVersionData[project.name].newVersion === null &&
310
+ !projectsVersionData[project.name].dockerVersion)) {
311
+ continue;
312
+ }
308
313
  let changes = null;
309
314
  if (releaseGroup.resolvedVersionPlans) {
310
315
  changes = (0, version_plan_utils_1.createChangesFromProjectsVersionPlans)(releaseGroup.resolvedVersionPlans, project.name);
@@ -838,22 +843,11 @@ async function filterProjectCommits({ fromSHA, toSHA, projectPath, }) {
838
843
  return allCommits.filter((c) => c.affectedFiles.find((f) => f.startsWith(projectPath)));
839
844
  }
840
845
  async function promptForRemoteRelease() {
841
- try {
842
- const result = await (0, enquirer_1.prompt)([
843
- {
844
- name: 'confirmation',
845
- message: `Do you want to create a ${remoteReleaseProviderName ?? 'remote'} release anyway?`,
846
- type: 'confirm',
847
- },
848
- ]);
849
- return result.confirmation;
850
- }
851
- catch {
852
- // Ensure the cursor is always restored
853
- process.stdout.write('\u001b[?25h');
854
- // Handle the case where the user exits the prompt with ctrl+c
855
- return false;
856
- }
846
+ return (0, prompt_helpers_1.confirmationPrompt)({
847
+ message: `Do you want to create a ${remoteReleaseProviderName ?? 'remote'} release anyway?`,
848
+ // Cancelling declines the release rather than failing the run.
849
+ onCancel: () => false,
850
+ });
857
851
  }
858
852
  async function resolveWorkspaceChangelogChanges({ releaseGraph, nxReleaseConfig, args, workspacePreid, projectsPreid, useAutomaticFromRef, toSHA, fromSHA, }) {
859
853
  // NOTE: If there are multiple release groups, we'll just skip the workspace changelog anyway.
@@ -46,4 +46,4 @@ export declare const release: typeof defaultClient.release;
46
46
  /**
47
47
  * @public
48
48
  */
49
- export { AfterAllProjectsVersioned, VersionActions, } from './version/version-actions';
49
+ export { AfterAllProjectsVersioned, ResolveVersionForDependency, VersionActions, } from './version/version-actions';
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releasePlanCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
- const enquirer_1 = require("enquirer");
5
+ const prompt_helpers_1 = require("../../utils/prompt-helpers");
6
6
  const node_fs_1 = require("node:fs");
7
7
  const promises_1 = require("node:fs/promises");
8
8
  const node_path_1 = require("node:path");
@@ -199,25 +199,16 @@ async function createVersionPlanFileForBumps(args, versionPlanBumps) {
199
199
  }
200
200
  }
201
201
  async function promptForVersion(message) {
202
- try {
203
- const reply = await (0, enquirer_1.prompt)([
204
- {
205
- name: 'version',
206
- message,
207
- type: 'select',
208
- choices: [...semver_1.RELEASE_TYPES, 'none'],
209
- },
210
- ]);
211
- return reply.version;
212
- }
213
- catch {
214
- output_1.output.log({
215
- title: 'Cancelled version plan creation.',
216
- });
217
- // Ensure the cursor is always restored before exiting
218
- process.stdout.write('\u001b[?25h');
219
- process.exit(0);
220
- }
202
+ return (0, prompt_helpers_1.selectPrompt)({
203
+ message,
204
+ choices: [...semver_1.RELEASE_TYPES, 'none'],
205
+ onCancel: () => {
206
+ output_1.output.log({
207
+ title: 'Cancelled version plan creation.',
208
+ });
209
+ process.exit(0);
210
+ },
211
+ });
221
212
  }
222
213
  async function promptForMessage(versionPlanName) {
223
214
  let message;
@@ -228,14 +219,10 @@ async function promptForMessage(versionPlanName) {
228
219
  }
229
220
  async function _promptForMessage(versionPlanName) {
230
221
  try {
231
- const reply = await (0, enquirer_1.prompt)([
232
- {
233
- name: 'message',
234
- message: 'What changelog message would you like associated with this change? (Leave blank to open an external editor for multi-line messages/easier editing)',
235
- type: 'input',
236
- },
237
- ]);
238
- let message = reply.message.trim();
222
+ const reply = await (0, prompt_helpers_1.textPrompt)({
223
+ message: 'What changelog message would you like associated with this change? (Leave blank to open an external editor for multi-line messages/easier editing)',
224
+ });
225
+ let message = reply.trim();
239
226
  if (!message.length) {
240
227
  const tmpDir = (0, tmp_1.dirSync)().name;
241
228
  const messageFilePath = (0, node_path_1.join)(tmpDir, `DRAFT_MESSAGE__${versionPlanName}.md`);
@@ -209,6 +209,11 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, ex
209
209
  process.env.NX_TUI = 'false';
210
210
  const { taskResults } = await (0, run_command_1.runCommandForTasks)(projectsWithTarget, projectGraph, { nxJson }, {
211
211
  targets: [requiredTargetName],
212
+ // Everything this command reports — the registry, the tag, the
213
+ // package.json diff, the dry-run summary — is printed from inside the
214
+ // task, so the failures-only default would swallow all of it (under
215
+ // --dry-run every task succeeds by definition). An explicit
216
+ // --output-style still wins, since it comes in through the spread.
212
217
  outputStyle: 'static',
213
218
  ...args,
214
219
  // It is possible for workspaces to have circular dependencies between packages and still release them to a registry
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
- const enquirer_1 = require("enquirer");
5
+ const prompt_helpers_1 = require("../../utils/prompt-helpers");
6
6
  const node_fs_1 = require("node:fs");
7
7
  const nx_json_1 = require("../../config/nx-json");
8
8
  const file_map_utils_1 = require("../../project-graph/file-map-utils");
@@ -285,22 +285,11 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
285
285
  };
286
286
  }
287
287
  async function promptForPublish() {
288
- try {
289
- const reply = await (0, enquirer_1.prompt)([
290
- {
291
- name: 'confirmation',
292
- message: 'Do you want to publish these versions?',
293
- type: 'confirm',
294
- },
295
- ]);
296
- return reply.confirmation;
297
- }
298
- catch {
299
- // Ensure the cursor is always restored before exiting
300
- process.stdout.write('\u001b[?25h');
301
- // Handle the case where the user exits the prompt with ctrl+c
302
- return false;
303
- }
288
+ return (0, prompt_helpers_1.confirmationPrompt)({
289
+ message: 'Do you want to publish these versions?',
290
+ // Cancelling is a decision not to publish, not a failure.
291
+ onCancel: () => false,
292
+ });
304
293
  }
305
294
  function shouldCreateRemoteRelease(changelogConfig) {
306
295
  if (changelogConfig === false) {
@@ -468,7 +468,7 @@ function getAllAuthorsForCommit(commit) {
468
468
  }
469
469
  // https://www.conventionalcommits.org/en/v1.0.0/
470
470
  // https://regex101.com/r/FSfNvA/1
471
- const ConventionalCommitRegex = /(?<type>[a-z]+)(\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)/i;
471
+ const ConventionalCommitRegex = /^(?<type>[^\s():!]+)(?:\s*\((?<scope>.+)\))?(?<breaking>!)?: (?<description>.+)$/u;
472
472
  const CoAuthoredByRegex = /co-authored-by:\s*(?<name>.+)(<(?<email>.+)>)/gim;
473
473
  // GitHub style PR references
474
474
  const PullRequestRE = /\([ a-z]*(#\d+)\s*\)/gm;
@@ -91,6 +91,7 @@ export declare class ReleaseGraph {
91
91
  }[]>;
92
92
  readonly releaseGroupToFilteredProjects: Map<ReleaseGroupWithName, Set<string>>;
93
93
  private originalFilteredProjects;
94
+ private matchedProjectsForFilter;
94
95
  /**
95
96
  * Store the affected graph per commit per project
96
97
  * to avoid recomputation of the graph on workspace
@@ -161,6 +162,23 @@ export declare class ReleaseGraph {
161
162
  * Resolve current versions for all projects that will be processed
162
163
  */
163
164
  private resolveCurrentVersionsForProjects;
165
+ /**
166
+ * Resolve the current version of a single project via its configured
167
+ * `currentVersionResolver` (honoring `fallbackCurrentVersionResolver`),
168
+ * performing the git-tag lookup when applicable.
169
+ *
170
+ * Extracted from `resolveCurrentVersionsForProjects` so it can also be
171
+ * invoked on-demand for projects that are NOT part of `allProjectsToProcess`.
172
+ */
173
+ private resolveCurrentVersionForProject;
174
+ /**
175
+ * Resolve and cache the current version of a dependency that is not already
176
+ * being versioned. Ecosystem-specific VersionActions call this lazily when
177
+ * they need a concrete version that is absent from `dependenciesToUpdate`.
178
+ *
179
+ * @internal
180
+ */
181
+ resolveCurrentVersionForDependency(tree: Tree, projectGraph: ProjectGraph, projectName: string, preid: string): Promise<string>;
164
182
  /**
165
183
  * Build dependency relationships between release groups
166
184
  */
@@ -4,6 +4,7 @@ exports.ReleaseGraph = exports.validReleaseVersionPrefixes = void 0;
4
4
  exports.createReleaseGraph = createReleaseGraph;
5
5
  const affected_project_graph_1 = require("../../../project-graph/affected/affected-project-graph");
6
6
  const file_utils_1 = require("../../../project-graph/file-utils");
7
+ const find_matching_projects_1 = require("../../../utils/find-matching-projects");
7
8
  const config_1 = require("../config/config");
8
9
  const project_logger_1 = require("../version/project-logger");
9
10
  const resolve_current_version_1 = require("../version/resolve-current-version");
@@ -43,6 +44,7 @@ class ReleaseGraph {
43
44
  this.originalDependentProjectsPerProject = new Map();
44
45
  this.releaseGroupToFilteredProjects = new Map();
45
46
  this.originalFilteredProjects = new Set();
47
+ this.matchedProjectsForFilter = new Set();
46
48
  /**
47
49
  * Store the affected graph per commit per project
48
50
  * to avoid recomputation of the graph on workspace
@@ -61,6 +63,12 @@ class ReleaseGraph {
61
63
  * @internal - Called by createReleaseGraph(), not meant for external use
62
64
  */
63
65
  async init(options) {
66
+ if (this.filters.projects?.length) {
67
+ this.matchedProjectsForFilter = new Set((0, find_matching_projects_1.findMatchingProjects)([...this.filters.projects], options.projectGraph.nodes));
68
+ if (this.matchedProjectsForFilter.size === 0) {
69
+ throw new Error(`Your --projects filter "${this.filters.projects}" did not match any projects in the workspace`);
70
+ }
71
+ }
64
72
  // Step 1: Setup project to release group mapping
65
73
  this.setupProjectReleaseGroupMapping();
66
74
  // Step 2: Apply initial filtering to determine base set of projects and groups to process
@@ -122,7 +130,7 @@ class ReleaseGraph {
122
130
  const filteredProjects = new Set();
123
131
  for (const project of releaseGroup.projects) {
124
132
  if (this.filters.projects?.length &&
125
- !this.filters.projects.includes(project)) {
133
+ !this.matchedProjectsForFilter.has(project)) {
126
134
  continue;
127
135
  }
128
136
  filteredProjects.add(project);
@@ -162,7 +170,7 @@ class ReleaseGraph {
162
170
  if (filters.groups?.includes(groupName)) {
163
171
  projectsToProcess.add(project);
164
172
  }
165
- else if (filters.projects?.includes(project)) {
173
+ else if (this.matchedProjectsForFilter.has(project)) {
166
174
  projectsToProcess.add(project);
167
175
  }
168
176
  const projectGraphNode = projectGraph.nodes[project];
@@ -373,31 +381,79 @@ class ReleaseGraph {
373
381
  async resolveCurrentVersionsForProjects(tree, projectGraph, preid) {
374
382
  for (const [, releaseGroupNode] of this.groupGraph) {
375
383
  for (const projectName of releaseGroupNode.group.projects) {
376
- const projectGraphNode = projectGraph.nodes[projectName];
377
384
  if (!this.allProjectsToProcess.has(projectName)) {
378
385
  continue;
379
386
  }
380
- const versionActions = this.projectsToVersionActions.get(projectName);
381
- const finalConfigForProject = this.finalConfigsByProject.get(projectName);
382
- let latestMatchingGitTag;
383
- const releaseTagPattern = releaseGroupNode.group.releaseTag.pattern;
384
- if (finalConfigForProject.currentVersionResolver === 'git-tag') {
385
- latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
386
- projectName: (0, git_1.sanitizeProjectNameForGitTag)(projectGraphNode.name),
387
- releaseGroupName: releaseGroupNode.group.name,
388
- }, this.resolveRepositoryTags.bind(this), {
389
- checkAllBranchesWhen: releaseGroupNode.group.releaseTag.checkAllBranchesWhen,
390
- preid: preid,
391
- requireSemver: releaseGroupNode.group.releaseTag.requireSemver,
392
- strictPreid: releaseGroupNode.group.releaseTag.strictPreid,
393
- });
394
- this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
395
- }
396
- const currentVersion = await (0, resolve_current_version_1.resolveCurrentVersion)(tree, projectGraphNode, releaseGroupNode.group, versionActions, this.projectLoggers.get(projectName), this.currentVersionsPerFixedReleaseGroup, finalConfigForProject, releaseTagPattern, latestMatchingGitTag);
387
+ const currentVersion = await this.resolveCurrentVersionForProject(tree, projectGraph, releaseGroupNode.group, projectName, preid);
397
388
  this.cachedCurrentVersions.set(projectName, currentVersion);
398
389
  }
399
390
  }
400
391
  }
392
+ /**
393
+ * Resolve the current version of a single project via its configured
394
+ * `currentVersionResolver` (honoring `fallbackCurrentVersionResolver`),
395
+ * performing the git-tag lookup when applicable.
396
+ *
397
+ * Extracted from `resolveCurrentVersionsForProjects` so it can also be
398
+ * invoked on-demand for projects that are NOT part of `allProjectsToProcess`.
399
+ */
400
+ async resolveCurrentVersionForProject(tree, projectGraph, releaseGroup, projectName, preid) {
401
+ const projectGraphNode = projectGraph.nodes[projectName];
402
+ const versionActions = this.projectsToVersionActions.get(projectName);
403
+ const finalConfigForProject = this.finalConfigsByProject.get(projectName);
404
+ let latestMatchingGitTag;
405
+ const releaseTagPattern = releaseGroup.releaseTag.pattern;
406
+ if (finalConfigForProject.currentVersionResolver === 'git-tag') {
407
+ latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
408
+ projectName: (0, git_1.sanitizeProjectNameForGitTag)(projectGraphNode.name),
409
+ releaseGroupName: releaseGroup.name,
410
+ }, this.resolveRepositoryTags.bind(this), {
411
+ checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
412
+ preid: preid,
413
+ requireSemver: releaseGroup.releaseTag.requireSemver,
414
+ strictPreid: releaseGroup.releaseTag.strictPreid,
415
+ });
416
+ this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
417
+ }
418
+ return (0, resolve_current_version_1.resolveCurrentVersion)(tree, projectGraphNode, releaseGroup, versionActions, this.projectLoggers.get(projectName), this.currentVersionsPerFixedReleaseGroup, finalConfigForProject, releaseTagPattern, latestMatchingGitTag);
419
+ }
420
+ /**
421
+ * Resolve and cache the current version of a dependency that is not already
422
+ * being versioned. Ecosystem-specific VersionActions call this lazily when
423
+ * they need a concrete version that is absent from `dependenciesToUpdate`.
424
+ *
425
+ * @internal
426
+ */
427
+ async resolveCurrentVersionForDependency(tree, projectGraph, projectName, preid) {
428
+ if (this.cachedCurrentVersions.has(projectName)) {
429
+ const currentVersion = this.cachedCurrentVersions.get(projectName);
430
+ if (currentVersion) {
431
+ return currentVersion;
432
+ }
433
+ const currentVersionResolver = this.finalConfigsByProject.get(projectName)?.currentVersionResolver;
434
+ throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because its "currentVersionResolver" is set to "${currentVersionResolver}" and did not resolve a version. Configure a resolver that can determine the current version.`);
435
+ }
436
+ const releaseGroup = this.projectToReleaseGroup.get(projectName);
437
+ if (!releaseGroup ||
438
+ !this.projectsToVersionActions.has(projectName) ||
439
+ !this.finalConfigsByProject.has(projectName)) {
440
+ throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because it is not configured for Nx Release. Include the project in an Nx Release group so that its current version resolver can be configured.`);
441
+ }
442
+ let currentVersion;
443
+ try {
444
+ currentVersion = await this.resolveCurrentVersionForProject(tree, projectGraph, releaseGroup, projectName, preid);
445
+ }
446
+ catch (err) {
447
+ const errorMessage = err instanceof Error ? err.message : String(err);
448
+ throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}". ${errorMessage}`);
449
+ }
450
+ if (!currentVersion) {
451
+ const finalConfigForProject = this.finalConfigsByProject.get(projectName);
452
+ throw new Error(`Cannot resolve a concrete current version for dependency project "${projectName}" because its "currentVersionResolver" is set to "${finalConfigForProject.currentVersionResolver}" and did not resolve a version. Configure a resolver that can determine the current version.`);
453
+ }
454
+ this.cachedCurrentVersions.set(projectName, currentVersion);
455
+ return currentVersion;
456
+ }
401
457
  /**
402
458
  * Build dependency relationships between release groups
403
459
  */
@@ -662,7 +718,11 @@ Valid values are: ${exports.validReleaseVersionPrefixes
662
718
  head: commit.shortHash,
663
719
  });
664
720
  // Use the same affected detection logic as `nx affected`
665
- affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles);
721
+ affectedGraph = await (0, affected_project_graph_1.filterAffected)(projectGraph, touchedFiles, undefined, undefined,
722
+ // Release evaluates historical commits against the current project
723
+ // graph. A project configuration which no longer exists must not make
724
+ // every surviving release project relevant to that commit.
725
+ false);
666
726
  this.affectedGraphPerCommit.set(shortHash, affectedGraph);
667
727
  return affectedGraph;
668
728
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GithubRemoteReleaseClient = exports.defaultCreateReleaseProvider = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const pc = tslib_1.__importStar(require("picocolors"));
6
- const enquirer_1 = require("enquirer");
6
+ const prompt_helpers_1 = require("../../../../utils/prompt-helpers");
7
7
  const node_child_process_1 = require("node:child_process");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_os_1 = require("node:os");
@@ -104,6 +104,12 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
104
104
  await Promise.all([...authors.keys()].map(async (authorName) => {
105
105
  const meta = authors.get(authorName);
106
106
  for (const email of meta.email) {
107
+ // An empty email makes the URL `/users/find/`, so ungh attributes
108
+ // the commit to the "find" user rather than the real author.
109
+ // Non-emails just 404, but skip those too to avoid a wasted lookup.
110
+ if (!email || !email.includes('@')) {
111
+ continue;
112
+ }
107
113
  if (email.endsWith('@users.noreply.github.com')) {
108
114
  const match = email.match(/^(\d+\+)?([^@]+)@users\.noreply\.github\.com$/);
109
115
  if (match && match[2]) {
@@ -235,7 +241,7 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
235
241
  if (!shouldContinueInGitHub) {
236
242
  return;
237
243
  }
238
- const open = require('open');
244
+ const { default: open } = await new Function('return import("open")')();
239
245
  await open(result.url)
240
246
  .then(() => {
241
247
  console.info(`\nFollow up in the browser to manually create the release:\n\n` +
@@ -250,29 +256,17 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
250
256
  }
251
257
  async promptForContinueInGitHub() {
252
258
  try {
253
- const reply = await (0, enquirer_1.prompt)([
254
- {
255
- name: 'open',
256
- message: 'Do you want to finish creating the release manually in your browser?',
257
- type: 'autocomplete',
258
- choices: [
259
- {
260
- name: 'Yes',
261
- hint: 'It will pre-populate the form for you',
262
- },
263
- {
264
- name: 'No',
265
- },
266
- ],
267
- initial: 0,
268
- },
269
- ]);
270
- return reply.open === 'Yes';
259
+ const open = await (0, prompt_helpers_1.selectPrompt)({
260
+ message: 'Do you want to finish creating the release manually in your browser?',
261
+ choices: [
262
+ { value: 'Yes', hint: 'It will pre-populate the form for you' },
263
+ { value: 'No' },
264
+ ],
265
+ onCancel: () => process.exit(1),
266
+ });
267
+ return open === 'Yes';
271
268
  }
272
269
  catch {
273
- // Ensure the cursor is always restored before exiting
274
- process.stdout.write('\u001b[?25h');
275
- // Handle the case where the user exits the prompt with ctrl+c
276
270
  process.exit(1);
277
271
  }
278
272
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GitLabRemoteReleaseClient = exports.defaultCreateReleaseProvider = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const pc = tslib_1.__importStar(require("picocolors"));
6
- const enquirer_1 = require("enquirer");
6
+ const prompt_helpers_1 = require("../../../../utils/prompt-helpers");
7
7
  const node_child_process_1 = require("node:child_process");
8
8
  const output_1 = require("../../../../utils/output");
9
9
  const extract_repo_slug_1 = require("./extract-repo-slug");
@@ -157,7 +157,7 @@ class GitLabRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
157
157
  if (!shouldContinueInGitLab) {
158
158
  return;
159
159
  }
160
- const open = require('open');
160
+ const { default: open } = await new Function('return import("open")')();
161
161
  await open(result.url)
162
162
  .then(() => {
163
163
  console.info(`\nFollow up in the browser to manually create the release:\n\n` +
@@ -172,29 +172,20 @@ class GitLabRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
172
172
  }
173
173
  async promptForContinueInGitLab() {
174
174
  try {
175
- const reply = await (0, enquirer_1.prompt)([
176
- {
177
- name: 'open',
178
- message: 'Do you want to create the release manually in your browser?',
179
- type: 'autocomplete',
180
- choices: [
181
- {
182
- name: 'Yes',
183
- hint: 'It will open the GitLab release page for you',
184
- },
185
- {
186
- name: 'No',
187
- },
188
- ],
189
- initial: 0,
190
- },
191
- ]);
192
- return reply.open === 'Yes';
175
+ const open = await (0, prompt_helpers_1.selectPrompt)({
176
+ message: 'Do you want to create the release manually in your browser?',
177
+ choices: [
178
+ {
179
+ value: 'Yes',
180
+ hint: 'It will open the GitLab release page for you',
181
+ },
182
+ { value: 'No' },
183
+ ],
184
+ onCancel: () => process.exit(1),
185
+ });
186
+ return open === 'Yes';
193
187
  }
194
188
  catch {
195
- // Ensure the cursor is always restored before exiting
196
- process.stdout.write('\u001b[?25h');
197
- // Handle the case where the user exits the prompt with ctrl+c
198
189
  process.exit(1);
199
190
  }
200
191
  }