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,8 @@ const package_manager_1 = require("../../utils/package-manager");
9
9
  const command_object_1 = require("./command-object");
10
10
  const logger_1 = require("../../utils/logger");
11
11
  const task_env_1 = require("../../tasks-runner/task-env");
12
+ const build_project_graph_1 = require("../../project-graph/build-project-graph");
13
+ const client_1 = require("../../daemon/client/client");
12
14
  /**
13
15
  * @deprecated Use showProjectsHandler, generateGraph, or affected (without the print-affected mode) instead.
14
16
  */
@@ -35,7 +37,14 @@ exports.printAffected = printAffected;
35
37
  async function createTasks(affectedProjectsWithTargetAndConfig, projectGraph, nxArgs, nxJson, overrides) {
36
38
  const defaultDependencyConfigs = (0, create_task_graph_1.mapTargetDefaultsToDependencies)(nxJson.targetDefaults);
37
39
  const taskGraph = (0, create_task_graph_1.createTaskGraph)(projectGraph, defaultDependencyConfigs, affectedProjectsWithTargetAndConfig.map((p) => p.name), nxArgs.targets, nxArgs.configuration, overrides);
38
- const hasher = new task_hasher_1.InProcessTaskHasher({}, [], projectGraph, nxJson, {});
40
+ let hasher;
41
+ if (client_1.daemonClient.enabled()) {
42
+ hasher = new task_hasher_1.DaemonBasedTaskHasher(client_1.daemonClient, {});
43
+ }
44
+ else {
45
+ const { fileMap, allWorkspaceFiles, rustReferences } = (0, build_project_graph_1.getFileMap)();
46
+ hasher = new task_hasher_1.InProcessTaskHasher(fileMap?.projectFileMap, allWorkspaceFiles, projectGraph, nxJson, rustReferences, {});
47
+ }
39
48
  const execCommand = (0, package_manager_1.getPackageManagerCommand)().exec;
40
49
  const tasks = Object.values(taskGraph.tasks);
41
50
  await Promise.all(tasks.map((t) => (0, hash_task_1.hashTask)(hasher, projectGraph, taskGraph, t,
@@ -1,4 +1,3 @@
1
1
  import { CommandModule } from 'yargs';
2
- import type { ConnectToNxCloudOptions } from './connect-to-nx-cloud';
3
- export declare const yargsConnectCommand: CommandModule<{}, ConnectToNxCloudOptions>;
2
+ export declare const yargsConnectCommand: CommandModule;
4
3
  export declare const yargsViewLogsCommand: CommandModule;
@@ -6,13 +6,9 @@ exports.yargsConnectCommand = {
6
6
  command: 'connect',
7
7
  aliases: ['connect-to-nx-cloud'],
8
8
  describe: `Connect workspace to Nx Cloud`,
9
- builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs.option('interactive', {
10
- type: 'boolean',
11
- description: 'Prompt for confirmation',
12
- default: true,
13
- }), 'connect-to-nx-cloud'),
14
- handler: async (options) => {
15
- await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand(options);
9
+ builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs, 'connect-to-nx-cloud'),
10
+ handler: async () => {
11
+ await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand();
16
12
  process.exit(0);
17
13
  },
18
14
  };
@@ -1,9 +1,8 @@
1
1
  import { NxJsonConfiguration } from '../../config/nx-json';
2
2
  import { NxArgs } from '../../utils/command-line-utils';
3
+ import { MessageKey } from '../../utils/ab-testing';
3
4
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
4
5
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
5
- export interface ConnectToNxCloudOptions {
6
- interactive: boolean;
7
- promptOverride?: string;
8
- }
9
- export declare function connectToNxCloudCommand({ promptOverride, interactive, }: ConnectToNxCloudOptions): Promise<boolean>;
6
+ export declare function connectToNxCloudCommand(): Promise<boolean>;
7
+ export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
8
+ export declare function connectExistingRepoToNxCloudPrompt(key?: MessageKey): Promise<boolean>;
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.connectToNxCloudCommand = exports.connectToNxCloudIfExplicitlyAsked = exports.onlyDefaultRunnerIsUsed = void 0;
3
+ exports.connectExistingRepoToNxCloudPrompt = exports.connectToNxCloudWithPrompt = exports.connectToNxCloudCommand = exports.connectToNxCloudIfExplicitlyAsked = exports.onlyDefaultRunnerIsUsed = void 0;
4
4
  const output_1 = require("../../utils/output");
5
5
  const configuration_1 = require("../../config/configuration");
6
6
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
7
7
  const child_process_1 = require("../../utils/child-process");
8
+ const ab_testing_1 = require("../../utils/ab-testing");
9
+ const versions_1 = require("../../utils/versions");
10
+ const chalk = require("chalk");
8
11
  function onlyDefaultRunnerIsUsed(nxJson) {
9
12
  const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
10
13
  if (!defaultRunner) {
11
14
  // No tasks runner options OR no default runner defined:
12
15
  // - If access token defined, uses cloud runner
13
16
  // - If no access token defined, uses default
14
- return !nxJson.nxCloudAccessToken;
17
+ return !(nxJson.nxCloudAccessToken ?? process.env.NX_CLOUD_ACCESS_TOKEN);
15
18
  }
16
19
  return defaultRunner === 'nx/tasks-runners/default';
17
20
  }
@@ -34,48 +37,57 @@ async function connectToNxCloudIfExplicitlyAsked(opts) {
34
37
  }
35
38
  }
36
39
  exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
37
- async function connectToNxCloudCommand({ promptOverride, interactive, }) {
40
+ async function connectToNxCloudCommand() {
38
41
  const nxJson = (0, configuration_1.readNxJson)();
39
42
  if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
40
43
  output_1.output.log({
41
- title: ' This workspace is already connected to Nx Cloud.',
44
+ title: ' This workspace already has Nx Cloud set up',
42
45
  bodyLines: [
43
- 'This means your workspace can use computation caching, distributed task execution, and show you run analytics.',
44
- 'Go to https://nx.app to learn more.',
45
- ' ',
46
- 'If you have not done so already, please claim this workspace:',
47
- `${(0, nx_cloud_utils_1.getNxCloudUrl)(nxJson)}/orgs/workspace-setup?accessToken=${(0, nx_cloud_utils_1.getNxCloudToken)(nxJson)}`,
46
+ 'If you have not done so already, connect your workspace to your Nx Cloud account:',
47
+ `- Login at ${(0, nx_cloud_utils_1.getNxCloudUrl)(nxJson)} to connect your repository`,
48
48
  ],
49
49
  });
50
50
  return false;
51
51
  }
52
- const res = interactive ? await connectToNxCloudPrompt(promptOverride) : true;
53
- if (!res)
54
- return false;
55
52
  (0, child_process_1.runNxSync)(`g nx:connect-to-nx-cloud --quiet --no-interactive`, {
56
53
  stdio: [0, 1, 2],
57
54
  });
58
55
  return true;
59
56
  }
60
57
  exports.connectToNxCloudCommand = connectToNxCloudCommand;
61
- async function connectToNxCloudPrompt(prompt) {
58
+ async function connectToNxCloudWithPrompt(command) {
59
+ const setNxCloud = await nxCloudPrompt('setupNxCloud');
60
+ const useCloud = setNxCloud === 'yes' ? await connectToNxCloudCommand() : false;
61
+ await (0, ab_testing_1.recordStat)({
62
+ command,
63
+ nxVersion: versions_1.nxVersion,
64
+ useCloud,
65
+ meta: ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
66
+ });
67
+ }
68
+ exports.connectToNxCloudWithPrompt = connectToNxCloudWithPrompt;
69
+ async function connectExistingRepoToNxCloudPrompt(key = 'setupNxCloud') {
70
+ return nxCloudPrompt(key).then((value) => value === 'yes');
71
+ }
72
+ exports.connectExistingRepoToNxCloudPrompt = connectExistingRepoToNxCloudPrompt;
73
+ async function nxCloudPrompt(key) {
74
+ const { message, choices, initial, footer, hint } = ab_testing_1.messages.getPrompt(key);
75
+ const promptConfig = {
76
+ name: 'NxCloud',
77
+ message,
78
+ type: 'autocomplete',
79
+ choices,
80
+ initial,
81
+ }; // meeroslav: types in enquirer are not up to date
82
+ if (footer) {
83
+ promptConfig.footer = () => chalk.dim(footer);
84
+ }
85
+ if (hint) {
86
+ promptConfig.hint = () => chalk.dim(hint);
87
+ }
62
88
  return await (await Promise.resolve().then(() => require('enquirer')))
63
- .prompt([
64
- {
65
- name: 'NxCloud',
66
- message: prompt ?? `Enable distributed caching to make your CI faster`,
67
- type: 'autocomplete',
68
- choices: [
69
- {
70
- name: 'Yes',
71
- hint: 'I want faster builds',
72
- },
73
- {
74
- name: 'No',
75
- },
76
- ],
77
- initial: 'Yes',
78
- },
79
- ])
80
- .then((a) => a.NxCloud === 'Yes');
89
+ .prompt([promptConfig])
90
+ .then((a) => {
91
+ return a.NxCloud;
92
+ });
81
93
  }
@@ -7,6 +7,7 @@ const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
7
7
  const output_1 = require("../../utils/output");
8
8
  const child_process_2 = require("../../utils/child-process");
9
9
  const nx_json_1 = require("../../config/nx-json");
10
+ const connect_to_nx_cloud_1 = require("./connect-to-nx-cloud");
10
11
  async function viewLogs() {
11
12
  const cloudUsed = (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)());
12
13
  if (cloudUsed) {
@@ -18,28 +19,10 @@ async function viewLogs() {
18
19
  });
19
20
  return 1;
20
21
  }
21
- const installCloud = await (await Promise.resolve().then(() => require('enquirer')))
22
- .prompt([
23
- {
24
- name: 'NxCloud',
25
- message: `To view the logs, Nx needs to connect your workspace to Nx Cloud and upload the most recent run details.`,
26
- type: 'autocomplete',
27
- choices: [
28
- {
29
- name: 'Yes',
30
- hint: 'Connect to Nx Cloud and upload the run details',
31
- },
32
- {
33
- name: 'No',
34
- },
35
- ],
36
- initial: 'Yes',
37
- },
38
- ])
39
- .then((a) => a.NxCloud === 'Yes');
40
- if (!installCloud)
22
+ const setupNxCloud = await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)('setupViewLogs');
23
+ if (!setupNxCloud) {
41
24
  return;
42
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
25
+ }
43
26
  try {
44
27
  output_1.output.log({
45
28
  title: 'Connecting to Nx Cloud',
@@ -55,6 +38,7 @@ async function viewLogs() {
55
38
  console.log(e);
56
39
  return 1;
57
40
  }
41
+ const pmc = (0, package_manager_1.getPackageManagerCommand)();
58
42
  (0, child_process_1.execSync)(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
59
43
  stdio: [0, 1, 2],
60
44
  });
@@ -311,6 +311,10 @@ exports.examples = {
311
311
  command: 'show project my-app --json false',
312
312
  description: 'Show information about "my-app" in a human readable format.',
313
313
  },
314
+ {
315
+ command: 'show project my-app --web',
316
+ description: 'Opens a web browser to explore the configuration of "my-app"',
317
+ },
314
318
  ],
315
319
  watch: [
316
320
  {
@@ -326,4 +330,18 @@ exports.examples = {
326
330
  description: 'Watch all projects (including newly created projects) in the workspace',
327
331
  },
328
332
  ],
333
+ add: [
334
+ {
335
+ command: 'add @nx/react',
336
+ description: 'Install the `@nx/react` package matching the installed version of the `nx` package and run its `@nx/react:init` generator',
337
+ },
338
+ {
339
+ command: 'add non-core-nx-plugin',
340
+ description: 'Install the latest version of the `non-core-nx-plugin` package and run its `non-core-nx-plugin:init` generator if available',
341
+ },
342
+ {
343
+ command: 'add @nx/react@17.0.0',
344
+ description: 'Install version `17.0.0` of the `@nx/react` package and run its `@nx/react:init` generator',
345
+ },
346
+ ],
329
347
  };
@@ -5,13 +5,14 @@ const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  exports.yargsExecCommand = {
6
6
  command: 'exec',
7
7
  describe: 'Executes any command as if it was a target on the project',
8
- builder: (yargs) => (0, shared_options_1.withRunOneOptions)(yargs),
8
+ builder: (yargs) => (0, shared_options_1.withRunManyOptions)(yargs),
9
9
  handler: async (args) => {
10
10
  try {
11
11
  await (await Promise.resolve().then(() => require('./exec'))).nxExecCommand((0, shared_options_1.withOverrides)(args));
12
12
  process.exit(0);
13
13
  }
14
14
  catch (e) {
15
+ console.error(e);
15
16
  process.exit(1);
16
17
  }
17
18
  },
@@ -1 +1 @@
1
- export declare function nxExecCommand(args: Record<string, string[]>): Promise<unknown>;
1
+ export declare function nxExecCommand(args: Record<string, string | string[] | boolean>): Promise<unknown>;
@@ -5,6 +5,8 @@ const child_process_1 = require("child_process");
5
5
  const path_1 = require("path");
6
6
  const process_1 = require("process");
7
7
  const yargs = require("yargs-parser");
8
+ const fs_1 = require("fs");
9
+ const find_matching_projects_1 = require("../../utils/find-matching-projects");
8
10
  const configuration_1 = require("../../config/configuration");
9
11
  const project_graph_1 = require("../../project-graph/project-graph");
10
12
  const command_line_utils_1 = require("../../utils/command-line-utils");
@@ -12,9 +14,17 @@ const fileutils_1 = require("../../utils/fileutils");
12
14
  const output_1 = require("../../utils/output");
13
15
  const package_manager_1 = require("../../utils/package-manager");
14
16
  const workspace_root_1 = require("../../utils/workspace-root");
17
+ const path_2 = require("../../utils/path");
15
18
  const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
19
+ const get_command_projects_1 = require("../../commands-runner/get-command-projects");
16
20
  async function nxExecCommand(args) {
17
- const scriptArgV = readScriptArgV(args);
21
+ const nxJson = (0, configuration_1.readNxJson)();
22
+ const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
23
+ if (nxArgs.verbose) {
24
+ process.env.NX_VERBOSE_LOGGING = 'true';
25
+ }
26
+ const scriptArgV = readScriptArgV(overrides);
27
+ const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
18
28
  // NX is already running
19
29
  if (process.env.NX_TASK_TARGET_PROJECT) {
20
30
  const command = scriptArgV
@@ -22,32 +32,58 @@ async function nxExecCommand(args) {
22
32
  .trim();
23
33
  (0, child_process_1.execSync)(command, {
24
34
  stdio: 'inherit',
25
- env: process.env,
35
+ env: {
36
+ ...process.env,
37
+ NX_PROJECT_NAME: process.env.NX_TASK_TARGET_PROJECT,
38
+ NX_PROJECT_ROOT_PATH: projectGraph.nodes?.[process.env.NX_TASK_TARGET_PROJECT]?.data?.root,
39
+ },
26
40
  });
27
41
  }
28
42
  else {
29
43
  // nx exec is being ran inside of Nx's context
30
- return runScriptAsNxTarget(scriptArgV);
44
+ return runScriptAsNxTarget(projectGraph, scriptArgV, nxArgs);
31
45
  }
32
46
  }
33
47
  exports.nxExecCommand = nxExecCommand;
34
- async function runScriptAsNxTarget(argv) {
35
- const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
36
- const { projectName, project } = getProject(projectGraph);
48
+ async function runScriptAsNxTarget(projectGraph, argv, nxArgs) {
37
49
  // NPM, Yarn, and PNPM set this to the name of the currently executing script. Lets use it if we can.
38
50
  const targetName = process.env.npm_lifecycle_event;
39
- const scriptDefinition = getScriptDefinition(project, targetName);
51
+ if (targetName) {
52
+ const defaultPorject = getDefaultProject(projectGraph);
53
+ const scriptDefinition = getScriptDefinition(targetName, defaultPorject);
54
+ if (scriptDefinition) {
55
+ runTargetOnProject(scriptDefinition, targetName, defaultPorject, defaultPorject.name, argv);
56
+ return;
57
+ }
58
+ }
59
+ const projects = getProjects(projectGraph, nxArgs);
60
+ const projectsToRun = (0, get_command_projects_1.getCommandProjects)(projectGraph, projects, nxArgs);
61
+ projectsToRun.forEach((projectName) => {
62
+ const command = argv.reduce((cmd, arg) => cmd + `"${arg}" `, '').trim();
63
+ (0, child_process_1.execSync)(command, {
64
+ stdio: 'inherit',
65
+ env: {
66
+ ...process.env,
67
+ NX_PROJECT_NAME: projectGraph.nodes?.[projectName]?.name,
68
+ NX_PROJECT_ROOT_PATH: projectGraph.nodes?.[projectName]?.data?.root,
69
+ },
70
+ cwd: projectGraph.nodes?.[projectName]?.data?.root
71
+ ? (0, path_2.joinPathFragments)(workspace_root_1.workspaceRoot, projectGraph.nodes?.[projectName]?.data?.root)
72
+ : workspace_root_1.workspaceRoot,
73
+ });
74
+ });
75
+ }
76
+ function runTargetOnProject(scriptDefinition, targetName, project, projectName, argv) {
40
77
  ensureNxTarget(project, targetName);
41
78
  // Get ArgV that is provided in npm script definition
42
79
  const providedArgs = yargs(scriptDefinition)._.slice(2);
43
80
  const extraArgs = providedArgs.length === argv.length ? [] : argv.slice(providedArgs.length);
44
81
  const pm = (0, package_manager_1.getPackageManagerCommand)();
45
82
  // `targetName` might be an npm script with `:` like: `start:dev`, `start:debug`.
46
- let command = `${pm.exec} nx run ${projectName}:\\\"${targetName}\\\" ${extraArgs.join(' ')}`;
47
- return (0, child_process_1.execSync)(command, { stdio: 'inherit' });
83
+ const command = `${pm.exec} nx run ${projectName}:\\\"${targetName}\\\" ${extraArgs.join(' ')}`;
84
+ (0, child_process_1.execSync)(command, { stdio: 'inherit' });
48
85
  }
49
- function readScriptArgV(args) {
50
- const { overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-one', { printWarnings: false }, (0, configuration_1.readNxJson)());
86
+ function readScriptArgV(overrides) {
51
87
  const scriptSeparatorIdx = process.argv.findIndex((el) => el === '--');
52
88
  if (scriptSeparatorIdx === -1) {
53
89
  output_1.output.error({
@@ -57,18 +93,15 @@ function readScriptArgV(args) {
57
93
  }
58
94
  return overrides.__overrides_unparsed__;
59
95
  }
60
- function getScriptDefinition(project, targetName) {
61
- const scriptDefinition = (0, fileutils_1.readJsonFile)((0, path_1.join)(workspace_root_1.workspaceRoot, project.data.root, 'package.json')).scripts[targetName];
62
- if (!scriptDefinition) {
63
- output_1.output.error({
64
- title: "`nx exec` is meant to be used in a project's package.json scripts",
65
- bodyLines: [
66
- `Nx was unable to find a npm script matching ${targetName} for ${project.name}`,
67
- ],
68
- });
69
- process.exit(1);
96
+ function getScriptDefinition(targetName, project) {
97
+ if (!project) {
98
+ return;
99
+ }
100
+ const packageJsonPath = (0, path_1.join)(workspace_root_1.workspaceRoot, project.data.root, 'package.json');
101
+ if ((0, fs_1.existsSync)(packageJsonPath)) {
102
+ const scriptDefinition = (0, fileutils_1.readJsonFile)(packageJsonPath).scripts?.[targetName];
103
+ return scriptDefinition;
70
104
  }
71
- return scriptDefinition;
72
105
  }
73
106
  function ensureNxTarget(project, targetName) {
74
107
  if (!project.data.targets[targetName]) {
@@ -81,18 +114,28 @@ function ensureNxTarget(project, targetName) {
81
114
  (0, process_1.exit)(1);
82
115
  }
83
116
  }
84
- function getProject(projectGraph) {
85
- const projectName = (0, calculate_default_project_name_1.calculateDefaultProjectName)(process.cwd(), workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), (0, configuration_1.readNxJson)());
86
- if (!projectName) {
87
- output_1.output.error({
88
- title: 'Unable to determine project name for `nx exec`',
89
- bodyLines: [
90
- "`nx exec` should be ran from within an Nx project's root directory.",
91
- 'Does this package.json belong to an Nx project?',
92
- ],
93
- });
94
- process.exit(1);
117
+ function getDefaultProject(projectGraph) {
118
+ const defaultProjectName = (0, calculate_default_project_name_1.calculateDefaultProjectName)(process.cwd(), workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), (0, configuration_1.readNxJson)());
119
+ if (defaultProjectName && projectGraph.nodes[defaultProjectName]) {
120
+ return projectGraph.nodes[defaultProjectName];
121
+ }
122
+ }
123
+ function getProjects(projectGraph, nxArgs) {
124
+ let selectedProjects = {};
125
+ // get projects matched
126
+ if (nxArgs.projects?.length) {
127
+ const matchingProjects = (0, find_matching_projects_1.findMatchingProjects)(nxArgs.projects, projectGraph.nodes);
128
+ for (const project of matchingProjects) {
129
+ selectedProjects[project] = projectGraph.nodes[project];
130
+ }
131
+ }
132
+ else {
133
+ // if no project specified, return all projects
134
+ selectedProjects = { ...projectGraph.nodes };
135
+ }
136
+ const excludedProjects = (0, find_matching_projects_1.findMatchingProjects)(nxArgs.exclude, selectedProjects);
137
+ for (const excludedProject of excludedProjects) {
138
+ delete selectedProjects[excludedProject];
95
139
  }
96
- const project = projectGraph.nodes[projectName];
97
- return { projectName, project };
140
+ return Object.values(selectedProjects);
98
141
  }
@@ -16,6 +16,8 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
16
16
  const configuration_1 = require("../../config/configuration");
17
17
  const chunkify_1 = require("../../utils/chunkify");
18
18
  const all_file_data_1 = require("../../utils/all-file-data");
19
+ const workspace_root_1 = require("../../utils/workspace-root");
20
+ const output_1 = require("../../utils/output");
19
21
  const PRETTIER_PATH = getPrettierPath();
20
22
  async function format(command, args) {
21
23
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
@@ -52,21 +54,28 @@ async function getPatterns(args) {
52
54
  }
53
55
  const p = (0, command_line_utils_1.parseFiles)(args);
54
56
  // In prettier v3 the getSupportInfo result is a promise
55
- const supportedExtensions = (await prettier.getSupportInfo()).languages
57
+ const supportedExtensions = new Set((await prettier.getSupportInfo()).languages
56
58
  .flatMap((language) => language.extensions)
57
59
  .filter((extension) => !!extension)
58
60
  // Prettier supports ".swcrc" as a file instead of an extension
59
61
  // So we add ".swcrc" as a supported extension manually
60
62
  // which allows it to be considered for calculating "patterns"
61
- .concat('.swcrc');
62
- const patterns = p.files.filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.includes(path.extname(f)));
63
+ .concat('.swcrc'));
64
+ const patterns = p.files
65
+ .map((f) => path.relative(workspace_root_1.workspaceRoot, f))
66
+ .filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.has(path.extname(f)));
63
67
  // exclude patterns in .nxignore or .gitignore
64
68
  const nonIgnoredPatterns = (0, ignore_1.getIgnoreObject)().filter(patterns);
65
69
  return args.libsAndApps
66
70
  ? await getPatternsFromApps(nonIgnoredPatterns, await (0, all_file_data_1.allFileData)(), graph)
67
71
  : nonIgnoredPatterns;
68
72
  }
69
- catch {
73
+ catch (err) {
74
+ output_1.output.error({
75
+ title: err?.message ||
76
+ 'Something went wrong when resolving the list of files for the formatter',
77
+ bodyLines: [`Defaulting to all files pattern: "${allFilesPattern}"`],
78
+ });
70
79
  return allFilesPattern;
71
80
  }
72
81
  }
@@ -36,7 +36,7 @@ async function promptForCollection(generatorName, interactive, projectsConfigura
36
36
  const deprecatedChoices = new Set();
37
37
  for (const collectionName of installedCollections) {
38
38
  try {
39
- const { resolvedCollectionName, normalizedGeneratorName, generatorConfiguration: { ['x-deprecated']: deprecated, hidden }, } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, workspace_root_1.workspaceRoot);
39
+ const { resolvedCollectionName, normalizedGeneratorName, generatorConfiguration: { ['x-deprecated']: deprecated, hidden }, } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, workspace_root_1.workspaceRoot, projectsConfiguration.projects);
40
40
  if (hidden) {
41
41
  continue;
42
42
  }
@@ -52,7 +52,7 @@ async function promptForCollection(generatorName, interactive, projectsConfigura
52
52
  const choicesFromLocalPlugins = [];
53
53
  for (const [name] of localPlugins) {
54
54
  try {
55
- const { resolvedCollectionName, normalizedGeneratorName, generatorConfiguration: { ['x-deprecated']: deprecated, hidden }, } = (0, generator_utils_1.getGeneratorInformation)(name, generatorName, workspace_root_1.workspaceRoot);
55
+ const { resolvedCollectionName, normalizedGeneratorName, generatorConfiguration: { ['x-deprecated']: deprecated, hidden }, } = (0, generator_utils_1.getGeneratorInformation)(name, generatorName, workspace_root_1.workspaceRoot, projectsConfiguration.projects);
56
56
  if (hidden) {
57
57
  continue;
58
58
  }
@@ -106,7 +106,7 @@ async function promptForCollection(generatorName, interactive, projectsConfigura
106
106
  return true;
107
107
  }
108
108
  try {
109
- (0, generator_utils_1.getGeneratorInformation)(value, generatorName, workspace_root_1.workspaceRoot);
109
+ (0, generator_utils_1.getGeneratorInformation)(value, generatorName, workspace_root_1.workspaceRoot, projectsConfiguration.projects);
110
110
  return true;
111
111
  }
112
112
  catch {
@@ -210,12 +210,12 @@ async function generate(cwd, args) {
210
210
  process.env.NX_VERBOSE_LOGGING = 'true';
211
211
  }
212
212
  const verbose = process.env.NX_VERBOSE_LOGGING === 'true';
213
- const nxJsonConfiguration = (0, configuration_1.readNxJson)();
214
- const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
215
- const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
216
213
  return (0, params_1.handleErrors)(verbose, async () => {
214
+ const nxJsonConfiguration = (0, configuration_1.readNxJson)();
215
+ const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
216
+ const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
217
217
  const opts = await convertToGenerateOptions(args, 'generate', projectsConfigurations);
218
- const { normalizedGeneratorName, schema, implementationFactory, generatorConfiguration: { aliases, hidden, ['x-deprecated']: deprecated, ['x-use-standalone-layout']: isStandalonePreset, }, } = (0, generator_utils_1.getGeneratorInformation)(opts.collectionName, opts.generatorName, workspace_root_1.workspaceRoot);
218
+ const { normalizedGeneratorName, schema, implementationFactory, generatorConfiguration: { aliases, hidden, ['x-deprecated']: deprecated, ['x-use-standalone-layout']: isStandalonePreset, }, } = (0, generator_utils_1.getGeneratorInformation)(opts.collectionName, opts.generatorName, workspace_root_1.workspaceRoot, projectsConfigurations.projects);
219
219
  if (deprecated) {
220
220
  logger_1.logger.warn([
221
221
  `${logger_1.NX_PREFIX}: ${opts.collectionName}:${normalizedGeneratorName} is deprecated`,
@@ -230,7 +230,7 @@ async function generate(cwd, args) {
230
230
  return 0;
231
231
  }
232
232
  const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), verbose);
233
- if ((0, generator_utils_1.getGeneratorInformation)(opts.collectionName, normalizedGeneratorName, workspace_root_1.workspaceRoot).isNxGenerator) {
233
+ if ((0, generator_utils_1.getGeneratorInformation)(opts.collectionName, normalizedGeneratorName, workspace_root_1.workspaceRoot, projectsConfigurations.projects).isNxGenerator) {
234
234
  const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
235
235
  const implementation = implementationFactory();
236
236
  // @todo(v17): Remove this, isStandalonePreset property is defunct.
@@ -259,7 +259,7 @@ async function generate(cwd, args) {
259
259
  return (await Promise.resolve().then(() => require('../../adapter/ngcli-adapter'))).generate(workspace_root_1.workspaceRoot, {
260
260
  ...opts,
261
261
  generatorOptions: combinedOpts,
262
- }, verbose);
262
+ }, projectsConfigurations.projects, verbose);
263
263
  }
264
264
  });
265
265
  }
@@ -1,5 +1,6 @@
1
1
  import { Generator, GeneratorsJson, GeneratorsJsonEntry } from '../../config/misc-interfaces';
2
- export declare function getGeneratorInformation(collectionName: string, generatorName: string, root: string | null): {
2
+ import { ProjectConfiguration } from '../../config/workspace-json-project-json';
3
+ export declare function getGeneratorInformation(collectionName: string, generatorName: string, root: string | null, projects: Record<string, ProjectConfiguration>): {
3
4
  resolvedCollectionName: string;
4
5
  normalizedGeneratorName: string;
5
6
  schema: any;
@@ -8,7 +9,7 @@ export declare function getGeneratorInformation(collectionName: string, generato
8
9
  isNxGenerator: boolean;
9
10
  generatorConfiguration: GeneratorsJsonEntry;
10
11
  };
11
- export declare function readGeneratorsJson(collectionName: string, generator: string, root: string | null): {
12
+ export declare function readGeneratorsJson(collectionName: string, generator: string, root: string | null, projects: Record<string, ProjectConfiguration>): {
12
13
  generatorsFilePath: string;
13
14
  generatorsJson: GeneratorsJson;
14
15
  normalizedGeneratorName: string;
@@ -5,9 +5,9 @@ const path_1 = require("path");
5
5
  const schema_utils_1 = require("../../config/schema-utils");
6
6
  const fileutils_1 = require("../../utils/fileutils");
7
7
  const nx_plugin_1 = require("../../utils/nx-plugin");
8
- function getGeneratorInformation(collectionName, generatorName, root) {
8
+ function getGeneratorInformation(collectionName, generatorName, root, projects) {
9
9
  try {
10
- const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root);
10
+ const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
11
11
  const generatorsDir = (0, path_1.dirname)(generatorsFilePath);
12
12
  const generatorConfig = generatorsJson.generators?.[normalizedGeneratorName] ||
13
13
  generatorsJson.schematics?.[normalizedGeneratorName];
@@ -40,7 +40,7 @@ function getGeneratorInformation(collectionName, generatorName, root) {
40
40
  }
41
41
  }
42
42
  exports.getGeneratorInformation = getGeneratorInformation;
43
- function readGeneratorsJson(collectionName, generator, root) {
43
+ function readGeneratorsJson(collectionName, generator, root, projects) {
44
44
  let generatorsFilePath;
45
45
  if (collectionName.endsWith('.json')) {
46
46
  generatorsFilePath = require.resolve(collectionName, {
@@ -48,7 +48,7 @@ function readGeneratorsJson(collectionName, generator, root) {
48
48
  });
49
49
  }
50
50
  else {
51
- const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(collectionName, root ? [root, __dirname] : [__dirname]);
51
+ const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
52
52
  const generatorsFile = packageJson.generators ?? packageJson.schematics;
53
53
  if (!generatorsFile) {
54
54
  throw new Error(`The "${collectionName}" package does not support Nx generators.`);
@@ -61,7 +61,7 @@ function readGeneratorsJson(collectionName, generator, root) {
61
61
  if (!normalizedGeneratorName) {
62
62
  for (let parent of generatorsJson.extends || []) {
63
63
  try {
64
- return readGeneratorsJson(parent, generator, root);
64
+ return readGeneratorsJson(parent, generator, root, projects);
65
65
  }
66
66
  catch (e) { }
67
67
  }
@@ -29,7 +29,7 @@ export declare function generateGraph(args: {
29
29
  groupByFolder?: boolean;
30
30
  watch?: boolean;
31
31
  open?: boolean;
32
- view: 'projects' | 'tasks';
32
+ view: 'projects' | 'tasks' | 'project-details';
33
33
  projects?: string[];
34
34
  all?: boolean;
35
35
  targets?: string[];