nx 21.0.0-beta.1 → 21.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/.eslintrc.json +5 -1
  2. package/migrations.json +5 -35
  3. package/package.json +12 -12
  4. package/release/index.d.ts +1 -1
  5. package/release/index.js +2 -1
  6. package/schemas/nx-schema.json +182 -35
  7. package/schemas/project-schema.json +5 -0
  8. package/src/adapter/compat.d.ts +1 -1
  9. package/src/adapter/compat.js +3 -0
  10. package/src/command-line/add/add.js +6 -16
  11. package/src/command-line/affected/command-object.js +6 -6
  12. package/src/command-line/examples.js +0 -4
  13. package/src/command-line/exec/command-object.js +1 -1
  14. package/src/command-line/generate/generator-utils.js +8 -3
  15. package/src/command-line/import/import.js +1 -1
  16. package/src/command-line/init/command-object.js +18 -6
  17. package/src/command-line/init/configure-plugins.d.ts +6 -7
  18. package/src/command-line/init/configure-plugins.js +52 -38
  19. package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
  20. package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
  21. package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
  22. package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
  23. package/src/command-line/init/implementation/deduce-default-base.js +53 -0
  24. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
  25. package/src/command-line/init/implementation/react/index.d.ts +1 -1
  26. package/src/command-line/init/implementation/react/index.js +32 -185
  27. package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
  28. package/src/command-line/init/implementation/utils.d.ts +6 -2
  29. package/src/command-line/init/implementation/utils.js +110 -45
  30. package/src/command-line/init/init-v1.js +1 -1
  31. package/src/command-line/init/init-v2.d.ts +1 -0
  32. package/src/command-line/init/init-v2.js +70 -39
  33. package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
  34. package/src/command-line/migrate/migrate-ui-api.js +227 -0
  35. package/src/command-line/migrate/migrate.d.ts +16 -3
  36. package/src/command-line/migrate/migrate.js +113 -83
  37. package/src/command-line/nx-commands.js +19 -5
  38. package/src/command-line/register/command-object.d.ts +6 -0
  39. package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
  40. package/src/command-line/register/register.d.ts +2 -0
  41. package/src/command-line/register/register.js +9 -0
  42. package/src/command-line/release/changelog.js +18 -15
  43. package/src/command-line/release/command-object.d.ts +8 -0
  44. package/src/command-line/release/command-object.js +9 -0
  45. package/src/command-line/release/config/config.d.ts +8 -7
  46. package/src/command-line/release/config/config.js +139 -45
  47. package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
  48. package/src/command-line/release/config/use-legacy-versioning.js +9 -0
  49. package/src/command-line/release/index.d.ts +4 -0
  50. package/src/command-line/release/index.js +6 -1
  51. package/src/command-line/release/plan-check.js +6 -3
  52. package/src/command-line/release/plan.js +7 -3
  53. package/src/command-line/release/publish.js +7 -3
  54. package/src/command-line/release/release.js +8 -3
  55. package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
  56. package/src/command-line/release/utils/git.d.ts +3 -2
  57. package/src/command-line/release/utils/git.js +65 -9
  58. package/src/command-line/release/utils/github.js +3 -1
  59. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
  60. package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
  61. package/src/command-line/release/utils/semver.d.ts +8 -0
  62. package/src/command-line/release/utils/semver.js +8 -0
  63. package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
  64. package/src/command-line/release/utils/shared-legacy.js +2 -0
  65. package/src/command-line/release/utils/shared.d.ts +11 -17
  66. package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
  67. package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
  68. package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
  69. package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
  70. package/src/command-line/release/version/project-logger.d.ts +8 -0
  71. package/src/command-line/release/version/project-logger.js +45 -0
  72. package/src/command-line/release/version/release-group-processor.d.ts +252 -0
  73. package/src/command-line/release/version/release-group-processor.js +1057 -0
  74. package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
  75. package/src/command-line/release/version/resolve-current-version.js +241 -0
  76. package/src/command-line/release/version/test-utils.d.ts +93 -0
  77. package/src/command-line/release/version/test-utils.js +415 -0
  78. package/src/command-line/release/version/topological-sort.d.ts +9 -0
  79. package/src/command-line/release/version/topological-sort.js +41 -0
  80. package/src/command-line/release/version/version-actions.d.ts +171 -0
  81. package/src/command-line/release/version/version-actions.js +195 -0
  82. package/src/command-line/release/version-legacy.d.ts +46 -0
  83. package/src/command-line/release/version-legacy.js +453 -0
  84. package/src/command-line/release/version.d.ts +0 -40
  85. package/src/command-line/release/version.js +84 -262
  86. package/src/command-line/repair/repair.js +0 -1
  87. package/src/command-line/report/report.d.ts +7 -3
  88. package/src/command-line/report/report.js +52 -18
  89. package/src/command-line/run/command-object.js +2 -2
  90. package/src/command-line/run/executor-utils.d.ts +6 -1
  91. package/src/command-line/run/executor-utils.js +10 -1
  92. package/src/command-line/run/run.js +2 -2
  93. package/src/command-line/run-many/command-object.js +2 -2
  94. package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
  95. package/src/command-line/yargs-utils/shared-options.js +20 -0
  96. package/src/config/misc-interfaces.d.ts +11 -1
  97. package/src/config/nx-json.d.ts +160 -16
  98. package/src/config/project-graph.d.ts +4 -2
  99. package/src/config/project-graph.js +8 -0
  100. package/src/config/workspace-json-project-json.d.ts +2 -2
  101. package/src/core/graph/main.js +1 -1
  102. package/src/core/graph/runtime.js +1 -1
  103. package/src/core/graph/styles.css +2 -2
  104. package/src/core/graph/styles.js +1 -1
  105. package/src/daemon/client/client.d.ts +2 -0
  106. package/src/daemon/client/client.js +15 -0
  107. package/src/daemon/message-types/glob.d.ts +7 -0
  108. package/src/daemon/message-types/glob.js +9 -1
  109. package/src/daemon/message-types/hash-glob.d.ts +6 -0
  110. package/src/daemon/message-types/hash-glob.js +9 -1
  111. package/src/daemon/server/handle-glob.d.ts +1 -0
  112. package/src/daemon/server/handle-glob.js +8 -0
  113. package/src/daemon/server/handle-hash-glob.d.ts +1 -0
  114. package/src/daemon/server/handle-hash-glob.js +8 -0
  115. package/src/daemon/server/logger.js +2 -1
  116. package/src/daemon/server/server.js +7 -0
  117. package/src/devkit-internals.d.ts +3 -2
  118. package/src/devkit-internals.js +5 -1
  119. package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
  120. package/src/executors/run-commands/run-commands.impl.js +14 -42
  121. package/src/executors/run-commands/running-tasks.d.ts +9 -4
  122. package/src/executors/run-commands/running-tasks.js +103 -30
  123. package/src/executors/run-script/run-script.impl.js +4 -3
  124. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
  125. package/src/generators/testing-utils/create-tree.js +5 -1
  126. package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
  127. package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
  128. package/src/native/index.d.ts +98 -19
  129. package/src/native/index.js +16 -2
  130. package/src/native/native-bindings.js +7 -0
  131. package/src/native/nx.wasi-browser.js +20 -19
  132. package/src/native/nx.wasi.cjs +20 -19
  133. package/src/native/nx.wasm32-wasi.wasm +0 -0
  134. package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
  135. package/src/plugins/js/lock-file/lock-file.js +28 -13
  136. package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
  137. package/src/plugins/js/lock-file/utils/package-json.js +8 -6
  138. package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
  139. package/src/plugins/js/lock-file/yarn-parser.js +85 -39
  140. package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
  141. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
  142. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
  143. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
  144. package/src/plugins/js/utils/packages.js +22 -3
  145. package/src/plugins/js/utils/register.js +1 -0
  146. package/src/plugins/js/utils/typescript.js +3 -3
  147. package/src/plugins/package-json/create-nodes.d.ts +1 -1
  148. package/src/plugins/package-json/create-nodes.js +4 -2
  149. package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
  150. package/src/project-graph/error-types.js +32 -2
  151. package/src/project-graph/file-utils.d.ts +1 -10
  152. package/src/project-graph/file-utils.js +2 -77
  153. package/src/project-graph/plugins/get-plugins.js +2 -1
  154. package/src/project-graph/plugins/in-process-loader.js +1 -1
  155. package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
  156. package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
  157. package/src/project-graph/plugins/public-api.d.ts +1 -1
  158. package/src/project-graph/plugins/utils.d.ts +2 -2
  159. package/src/project-graph/plugins/utils.js +2 -2
  160. package/src/project-graph/project-graph.js +1 -1
  161. package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
  162. package/src/project-graph/utils/project-configuration-utils.js +54 -21
  163. package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
  164. package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
  165. package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
  166. package/src/tasks-runner/batch/run-batch.js +3 -4
  167. package/src/tasks-runner/cache.d.ts +20 -6
  168. package/src/tasks-runner/cache.js +104 -20
  169. package/src/tasks-runner/create-task-graph.d.ts +0 -1
  170. package/src/tasks-runner/create-task-graph.js +11 -11
  171. package/src/tasks-runner/default-tasks-runner.js +5 -14
  172. package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
  173. package/src/tasks-runner/forked-process-task-runner.js +59 -46
  174. package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
  175. package/src/tasks-runner/init-tasks-runner.js +62 -2
  176. package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
  177. package/src/tasks-runner/is-tui-enabled.js +64 -0
  178. package/src/tasks-runner/life-cycle.d.ts +14 -3
  179. package/src/tasks-runner/life-cycle.js +37 -2
  180. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
  181. package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
  182. package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
  183. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
  184. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
  185. package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
  186. package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
  187. package/src/tasks-runner/pseudo-terminal.js +37 -35
  188. package/src/tasks-runner/run-command.d.ts +4 -1
  189. package/src/tasks-runner/run-command.js +220 -42
  190. package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
  191. package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
  192. package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
  193. package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
  194. package/src/tasks-runner/task-env.d.ts +1 -4
  195. package/src/tasks-runner/task-env.js +2 -0
  196. package/src/tasks-runner/task-orchestrator.d.ts +26 -10
  197. package/src/tasks-runner/task-orchestrator.js +212 -57
  198. package/src/tasks-runner/tasks-runner.d.ts +1 -0
  199. package/src/tasks-runner/tasks-schedule.d.ts +1 -0
  200. package/src/tasks-runner/tasks-schedule.js +9 -0
  201. package/src/tasks-runner/utils.d.ts +2 -2
  202. package/src/tasks-runner/utils.js +18 -12
  203. package/src/utils/child-process.d.ts +4 -0
  204. package/src/utils/child-process.js +23 -30
  205. package/src/utils/command-line-utils.d.ts +1 -1
  206. package/src/utils/find-matching-projects.js +2 -2
  207. package/src/utils/git-utils.d.ts +1 -1
  208. package/src/utils/git-utils.js +8 -3
  209. package/src/utils/handle-errors.js +15 -0
  210. package/src/utils/is-ci.js +4 -1
  211. package/src/utils/is-using-prettier.d.ts +3 -0
  212. package/src/utils/is-using-prettier.js +62 -0
  213. package/src/utils/nx-key.d.ts +7 -0
  214. package/src/utils/nx-key.js +52 -0
  215. package/src/utils/package-json.d.ts +1 -1
  216. package/src/utils/package-json.js +16 -2
  217. package/src/utils/package-manager.js +2 -2
  218. package/src/utils/path.js +1 -1
  219. package/src/utils/require-nx-key.d.ts +1 -0
  220. package/src/utils/require-nx-key.js +22 -0
  221. package/src/utils/workspace-context.d.ts +2 -0
  222. package/src/utils/workspace-context.js +16 -0
  223. package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
  224. package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
  225. package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
  226. package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
  227. package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
  228. package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
  229. package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
  230. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
  231. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
  232. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
  233. package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
  234. package/src/migrations/update-17-2-0/move-default-base.js +0 -21
  235. package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
  236. package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
  237. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
  238. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
  239. package/src/utils/powerpack.d.ts +0 -5
  240. package/src/utils/powerpack.js +0 -33
@@ -1,36 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.releaseVersionCLIHandler = exports.validReleaseVersionPrefixes = exports.deriveNewSemverVersion = void 0;
3
+ exports.releaseVersionCLIHandler = exports.validReleaseVersionPrefixes = void 0;
4
4
  exports.createAPI = createAPI;
5
5
  const chalk = require("chalk");
6
6
  const node_child_process_1 = require("node:child_process");
7
7
  const node_fs_1 = require("node:fs");
8
- const node_path_1 = require("node:path");
9
8
  const nx_json_1 = require("../../config/nx-json");
9
+ const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
10
10
  const tree_1 = require("../../generators/tree");
11
11
  const file_map_utils_1 = require("../../project-graph/file-map-utils");
12
12
  const project_graph_1 = require("../../project-graph/project-graph");
13
+ const handle_errors_1 = require("../../utils/handle-errors");
13
14
  const output_1 = require("../../utils/output");
14
- const params_1 = require("../../utils/params");
15
15
  const path_1 = require("../../utils/path");
16
16
  const workspace_root_1 = require("../../utils/workspace-root");
17
- const generate_1 = require("../generate/generate");
18
- const generator_utils_1 = require("../generate/generator-utils");
19
17
  const config_1 = require("./config/config");
20
18
  const deep_merge_json_1 = require("./config/deep-merge-json");
21
19
  const filter_release_groups_1 = require("./config/filter-release-groups");
22
20
  const version_plans_1 = require("./config/version-plans");
23
- const batch_projects_by_generator_config_1 = require("./utils/batch-projects-by-generator-config");
24
21
  const git_1 = require("./utils/git");
25
22
  const print_changes_1 = require("./utils/print-changes");
26
23
  const print_config_1 = require("./utils/print-config");
27
24
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
28
25
  const shared_1 = require("./utils/shared");
29
- const handle_errors_1 = require("../../utils/handle-errors");
26
+ const version_legacy_1 = require("./version-legacy");
27
+ const release_group_processor_1 = require("./version/release-group-processor");
28
+ const use_legacy_versioning_1 = require("./config/use-legacy-versioning");
30
29
  const LARGE_BUFFER = 1024 * 1000000;
31
30
  // Reexport some utils for use in plugin release-version generator implementations
32
- var semver_1 = require("./utils/semver");
33
- Object.defineProperty(exports, "deriveNewSemverVersion", { enumerable: true, get: function () { return semver_1.deriveNewSemverVersion; } });
34
31
  exports.validReleaseVersionPrefixes = ['auto', '', '~', '^', '='];
35
32
  const releaseVersionCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
36
33
  exports.releaseVersionCLIHandler = releaseVersionCLIHandler;
@@ -42,13 +39,13 @@ function createAPI(overrideReleaseConfig) {
42
39
  */
43
40
  return async function releaseVersion(args) {
44
41
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
45
- const { projects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
46
42
  const nxJson = (0, nx_json_1.readNxJson)();
47
43
  const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
44
+ const USE_LEGACY_VERSIONING = (0, use_legacy_versioning_1.shouldUseLegacyVersioning)(userProvidedReleaseConfig);
48
45
  // Apply default configuration to any optional user configuration
49
46
  const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
50
47
  if (configError) {
51
- return await (0, config_1.handleNxReleaseConfigError)(configError);
48
+ return await (0, config_1.handleNxReleaseConfigError)(configError, USE_LEGACY_VERSIONING);
52
49
  }
53
50
  // --print-config exits directly as it is not designed to be combined with any other programmatic operations
54
51
  if (args.printConfig) {
@@ -58,6 +55,10 @@ function createAPI(overrideReleaseConfig) {
58
55
  isDebug: args.printConfig === 'debug',
59
56
  });
60
57
  }
58
+ // TODO(v22): Remove support for the legacy versioning implementation in Nx v22
59
+ if (USE_LEGACY_VERSIONING) {
60
+ return await (0, version_legacy_1.releaseVersionLegacy)(projectGraph, args, nxJson, nxReleaseConfig, userProvidedReleaseConfig);
61
+ }
61
62
  // The nx release top level command will always override these three git args. This is how we can tell
62
63
  // if the top level release command was used or if the user is using the changelog subcommand.
63
64
  // If the user explicitly overrides these args, then it doesn't matter if the top level config is set,
@@ -98,169 +99,75 @@ function createAPI(overrideReleaseConfig) {
98
99
  // default to not delete version plans after versioning as they may be needed for changelog generation
99
100
  args.deleteVersionPlans = false;
100
101
  }
102
+ /**
103
+ * Run any configured top level pre-version command
104
+ */
101
105
  runPreVersionCommand(nxReleaseConfig.version.preVersionCommand, {
102
106
  dryRun: args.dryRun,
103
107
  verbose: args.verbose,
104
108
  });
109
+ /**
110
+ * Run any configured pre-version command for the selected release groups
111
+ */
112
+ for (const releaseGroup of releaseGroups) {
113
+ runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
114
+ dryRun: args.dryRun,
115
+ verbose: args.verbose,
116
+ }, releaseGroup);
117
+ }
105
118
  const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose);
106
- const versionData = {};
107
119
  const commitMessage = args.gitCommitMessage || nxReleaseConfig.version.git.commitMessage;
108
- const generatorCallbacks = [];
109
120
  /**
110
121
  * additionalChangedFiles are files which need to be updated as a side-effect of versioning (such as package manager lock files),
111
122
  * and need to get staged and committed as part of the existing commit, if applicable.
112
123
  */
113
124
  const additionalChangedFiles = new Set();
114
125
  const additionalDeletedFiles = new Set();
115
- if (args.projects?.length) {
116
- /**
117
- * Run versioning for all remaining release groups and filtered projects within them
118
- */
119
- for (const releaseGroup of releaseGroups) {
120
- const releaseGroupName = releaseGroup.name;
121
- const releaseGroupProjectNames = Array.from(releaseGroupToFilteredProjects.get(releaseGroup));
122
- const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
123
- // Only batch based on the filtered projects within the release group
124
- releaseGroupProjectNames);
125
- for (const [generatorConfigString, projectNames,] of projectBatches.entries()) {
126
- const [generatorName, generatorOptions] = JSON.parse(generatorConfigString);
127
- // Resolve the generator for the batch and run versioning on the projects within the batch
128
- const generatorData = resolveGeneratorData({
129
- ...extractGeneratorCollectionAndName(`batch "${JSON.stringify(projectNames)}" for release-group "${releaseGroupName}"`, generatorName),
130
- configGeneratorOptions: generatorOptions,
131
- // all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
132
- projects,
133
- });
134
- const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
135
- // Capture the callback so that we can run it after flushing the changes to disk
136
- generatorCallbacks.push(async () => {
137
- const result = await generatorCallback(tree, {
138
- dryRun: !!args.dryRun,
139
- verbose: !!args.verbose,
140
- generatorOptions: {
141
- ...generatorOptions,
142
- ...args.generatorOptionsOverrides,
143
- },
144
- });
145
- const { changedFiles, deletedFiles } = parseGeneratorCallbackResult(result);
146
- changedFiles.forEach((f) => additionalChangedFiles.add(f));
147
- deletedFiles.forEach((f) => additionalDeletedFiles.add(f));
148
- });
149
- }
150
- }
151
- // Resolve any git tags as early as possible so that we can hard error in case of any duplicates before reaching the actual git command
152
- const gitTagValues = args.gitTag ?? nxReleaseConfig.version.git.tag
153
- ? (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionData)
154
- : [];
155
- (0, shared_1.handleDuplicateGitTags)(gitTagValues);
156
- printAndFlushChanges(tree, !!args.dryRun);
157
- for (const generatorCallback of generatorCallbacks) {
158
- await generatorCallback();
159
- }
160
- const changedFiles = [
161
- ...tree.listChanges().map((f) => f.path),
162
- ...additionalChangedFiles,
163
- ];
164
- // No further actions are necessary in this scenario (e.g. if conventional commits detected no changes)
165
- if (!changedFiles.length) {
166
- return {
167
- // An overall workspace version cannot be relevant when filtering to independent projects
168
- workspaceVersion: undefined,
169
- projectsVersionData: versionData,
170
- };
171
- }
172
- if (args.gitCommit ?? nxReleaseConfig.version.git.commit) {
173
- await (0, shared_1.commitChanges)({
174
- changedFiles,
175
- deletedFiles: Array.from(additionalDeletedFiles),
176
- isDryRun: !!args.dryRun,
177
- isVerbose: !!args.verbose,
178
- gitCommitMessages: (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage),
179
- gitCommitArgs: args.gitCommitArgs || nxReleaseConfig.version.git.commitArgs,
180
- });
181
- }
182
- else if (args.stageChanges ??
183
- nxReleaseConfig.version.git.stageChanges) {
184
- output_1.output.logSingleLine(`Staging changed files with git`);
185
- await (0, git_1.gitAdd)({
186
- changedFiles,
187
- dryRun: args.dryRun,
188
- verbose: args.verbose,
189
- });
190
- }
191
- if (args.gitTag ?? nxReleaseConfig.version.git.tag) {
192
- output_1.output.logSingleLine(`Tagging commit with git`);
193
- for (const tag of gitTagValues) {
194
- await (0, git_1.gitTag)({
195
- tag,
196
- message: args.gitTagMessage || nxReleaseConfig.version.git.tagMessage,
197
- additionalArgs: args.gitTagArgs || nxReleaseConfig.version.git.tagArgs,
198
- dryRun: args.dryRun,
199
- verbose: args.verbose,
200
- });
201
- }
202
- }
203
- if (args.gitPush ?? nxReleaseConfig.version.git.push) {
204
- output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote}"`);
205
- await (0, git_1.gitPush)({
206
- gitRemote: args.gitRemote,
207
- dryRun: args.dryRun,
208
- verbose: args.verbose,
209
- });
126
+ const processor = new release_group_processor_1.ReleaseGroupProcessor(tree, projectGraph, nxReleaseConfig, releaseGroups, releaseGroupToFilteredProjects, {
127
+ dryRun: args.dryRun,
128
+ verbose: args.verbose,
129
+ firstRelease: args.firstRelease,
130
+ preid: args.preid ?? '',
131
+ userGivenSpecifier: args.specifier,
132
+ filters: {
133
+ projects: args.projects,
134
+ groups: args.groups,
135
+ },
136
+ versionActionsOptionsOverrides: args.versionActionsOptionsOverrides,
137
+ });
138
+ try {
139
+ await processor.init();
140
+ await processor.processGroups();
141
+ // Delete processed version plan files if applicable
142
+ if (args.deleteVersionPlans) {
143
+ processor.deleteProcessedVersionPlanFiles();
210
144
  }
211
- return {
212
- // An overall workspace version cannot be relevant when filtering to independent projects
213
- workspaceVersion: undefined,
214
- projectsVersionData: versionData,
215
- };
145
+ }
146
+ catch (err) {
147
+ // Flush any pending project logs before printing the error to make troubleshooting easier
148
+ processor.flushAllProjectLoggers();
149
+ // Bubble up the error so that the CLI can print the error and exit, or the programmatic API can handle it
150
+ throw err;
216
151
  }
217
152
  /**
218
- * Run versioning for all remaining release groups
153
+ * Ensure that formatting is applied so that version bump diffs are as minimal as possible
154
+ * within the context of the user's workspace.
219
155
  */
220
- for (const releaseGroup of releaseGroups) {
221
- const releaseGroupName = releaseGroup.name;
222
- runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
223
- dryRun: args.dryRun,
224
- verbose: args.verbose,
225
- }, releaseGroup);
226
- const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
227
- // Batch based on all projects within the release group
228
- releaseGroup.projects);
229
- for (const [generatorConfigString, projectNames,] of projectBatches.entries()) {
230
- const [generatorName, generatorOptions] = JSON.parse(generatorConfigString);
231
- // Resolve the generator for the batch and run versioning on the projects within the batch
232
- const generatorData = resolveGeneratorData({
233
- ...extractGeneratorCollectionAndName(`batch "${JSON.stringify(projectNames)}" for release-group "${releaseGroupName}"`, generatorName),
234
- configGeneratorOptions: generatorOptions,
235
- // all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
236
- projects,
237
- });
238
- const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
239
- // Capture the callback so that we can run it after flushing the changes to disk
240
- generatorCallbacks.push(async () => {
241
- const result = await generatorCallback(tree, {
242
- dryRun: !!args.dryRun,
243
- verbose: !!args.verbose,
244
- generatorOptions: {
245
- ...generatorOptions,
246
- ...args.generatorOptionsOverrides,
247
- },
248
- });
249
- const { changedFiles, deletedFiles } = parseGeneratorCallbackResult(result);
250
- changedFiles.forEach((f) => additionalChangedFiles.add(f));
251
- deletedFiles.forEach((f) => additionalDeletedFiles.add(f));
252
- });
253
- }
254
- }
156
+ await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, { silent: true });
157
+ const versionData = processor.getVersionData();
255
158
  // Resolve any git tags as early as possible so that we can hard error in case of any duplicates before reaching the actual git command
256
159
  const gitTagValues = args.gitTag ?? nxReleaseConfig.version.git.tag
257
160
  ? (0, shared_1.createGitTagValues)(releaseGroups, releaseGroupToFilteredProjects, versionData)
258
161
  : [];
259
162
  (0, shared_1.handleDuplicateGitTags)(gitTagValues);
260
163
  printAndFlushChanges(tree, !!args.dryRun);
261
- for (const generatorCallback of generatorCallbacks) {
262
- await generatorCallback();
263
- }
164
+ const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
165
+ ...nxReleaseConfig.version
166
+ .versionActionsOptions,
167
+ ...(args.versionActionsOptionsOverrides ?? {}),
168
+ });
169
+ changed.forEach((f) => additionalChangedFiles.add(f));
170
+ deleted.forEach((f) => additionalDeletedFiles.add(f));
264
171
  // Only applicable when there is a single release group with a fixed relationship
265
172
  let workspaceVersion = undefined;
266
173
  if (releaseGroups.length === 1) {
@@ -314,11 +221,12 @@ function createAPI(overrideReleaseConfig) {
314
221
  }
315
222
  }
316
223
  if (args.gitPush ?? nxReleaseConfig.version.git.push) {
317
- output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote}"`);
224
+ output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote ?? 'origin'}"`);
318
225
  await (0, git_1.gitPush)({
319
226
  gitRemote: args.gitRemote,
320
227
  dryRun: args.dryRun,
321
228
  verbose: args.verbose,
229
+ additionalArgs: args.gitPushArgs || nxReleaseConfig.version.git.pushArgs,
322
230
  });
323
231
  }
324
232
  return {
@@ -327,109 +235,34 @@ function createAPI(overrideReleaseConfig) {
327
235
  };
328
236
  };
329
237
  }
330
- function appendVersionData(existingVersionData, newVersionData) {
331
- // Mutate the existing version data
332
- for (const [key, value] of Object.entries(newVersionData)) {
333
- if (existingVersionData[key]) {
334
- throw new Error(`Version data key "${key}" already exists in version data. This is likely a bug, please report your use-case on https://github.com/nrwl/nx`);
335
- }
336
- existingVersionData[key] = value;
337
- }
338
- return existingVersionData;
339
- }
340
- async function runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, generatorOverrides, projectNames, releaseGroup, versionData, conventionalCommitsConfig) {
341
- const generatorOptions = {
342
- // Always ensure a string to avoid generator schema validation errors
343
- specifier: args.specifier ?? '',
344
- preid: args.preid ?? '',
345
- ...generatorData.configGeneratorOptions,
346
- ...(generatorOverrides ?? {}),
347
- // The following are not overridable by user config
348
- projects: projectNames.map((p) => projectGraph.nodes[p]),
349
- projectGraph,
350
- releaseGroup,
351
- firstRelease: args.firstRelease ?? false,
352
- conventionalCommitsConfig,
353
- deleteVersionPlans: args.deleteVersionPlans,
354
- };
355
- // Apply generator defaults from schema.json file etc
356
- const combinedOpts = await (0, params_1.combineOptionsForGenerator)(generatorOptions, generatorData.collectionName, generatorData.normalizedGeneratorName, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), nxJson, generatorData.schema, false, null, (0, node_path_1.relative)(process.cwd(), workspace_root_1.workspaceRoot), args.verbose);
357
- const releaseVersionGenerator = generatorData.implementationFactory();
358
- // We expect all version generator implementations to return a ReleaseVersionGeneratorResult object, rather than a GeneratorCallback
359
- const versionResult = (await releaseVersionGenerator(tree, combinedOpts));
360
- if (typeof versionResult === 'function') {
361
- throw new Error(`The version generator ${generatorData.collectionName}:${generatorData.normalizedGeneratorName} returned a function instead of an expected ReleaseVersionGeneratorResult`);
362
- }
363
- // Merge the extra version data into the existing
364
- appendVersionData(versionData, versionResult.data);
365
- return versionResult.callback;
366
- }
367
238
  function printAndFlushChanges(tree, isDryRun) {
368
239
  const changes = tree.listChanges();
369
240
  console.log('');
370
- // Print the changes
371
- changes.forEach((f) => {
372
- if (f.type === 'CREATE') {
373
- console.error(`${chalk.green('CREATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
374
- (0, print_changes_1.printDiff)('', f.content?.toString() || '');
375
- }
376
- else if (f.type === 'UPDATE') {
377
- console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
378
- const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
379
- (0, print_changes_1.printDiff)(currentContentsOnDisk, f.content?.toString() || '');
380
- }
381
- else if (f.type === 'DELETE' && !f.path.includes('.nx')) {
382
- throw new Error('Unexpected DELETE change, please report this as an issue');
383
- }
384
- });
385
- if (!isDryRun) {
386
- (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
387
- }
388
- }
389
- function extractGeneratorCollectionAndName(description, generatorString) {
390
- let collectionName;
391
- let generatorName;
392
- const parsedGeneratorString = (0, generate_1.parseGeneratorString)(generatorString);
393
- collectionName = parsedGeneratorString.collection;
394
- generatorName = parsedGeneratorString.generator;
395
- if (!collectionName || !generatorName) {
396
- throw new Error(`Invalid generator string: ${generatorString} used for ${description}. Must be in the format of [collectionName]:[generatorName]`);
397
- }
398
- return { collectionName, generatorName };
399
- }
400
- function resolveGeneratorData({ collectionName, generatorName, configGeneratorOptions, projects, }) {
401
- try {
402
- const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, workspace_root_1.workspaceRoot, projects);
403
- return {
404
- collectionName,
405
- generatorName,
406
- configGeneratorOptions,
407
- normalizedGeneratorName,
408
- schema,
409
- implementationFactory,
410
- };
411
- }
412
- catch (err) {
413
- if (err.message.startsWith('Unable to resolve')) {
414
- // See if it is because the plugin is not installed
415
- try {
416
- require.resolve(collectionName);
417
- // is installed
418
- throw new Error(`Unable to resolve the generator called "${generatorName}" within the "${collectionName}" package`);
241
+ if (changes.length > 0) {
242
+ // Print the changes
243
+ changes.forEach((f) => {
244
+ if (f.type === 'CREATE') {
245
+ console.error(`${chalk.green('CREATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
246
+ (0, print_changes_1.printDiff)('', f.content?.toString() || '');
419
247
  }
420
- catch {
421
- /**
422
- * Special messaging for the most common case (especially as the user is unlikely to explicitly have
423
- * the @nx/js generator config in their nx.json so we need to be clear about what the problem is)
424
- */
425
- if (collectionName === '@nx/js') {
426
- throw new Error('The @nx/js plugin is required in order to version your JavaScript packages. Run "nx add @nx/js" to add it to your workspace.');
427
- }
428
- throw new Error(`Unable to resolve the package ${collectionName} in order to load the generator called ${generatorName}. Is the package installed?`);
248
+ else if (f.type === 'UPDATE') {
249
+ console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
250
+ const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
251
+ (0, print_changes_1.printDiff)(currentContentsOnDisk, f.content?.toString() || '');
429
252
  }
430
- }
431
- // Unexpected error, rethrow
432
- throw err;
253
+ else if (f.type === 'DELETE' && !f.path.includes('.nx')) {
254
+ throw new Error('Unexpected DELETE change, please report this as an issue');
255
+ }
256
+ });
257
+ }
258
+ else {
259
+ let text = isDryRun ? ' would be ' : ' ';
260
+ output_1.output.warn({
261
+ title: `No files${text}changed as a result of running versioning`,
262
+ });
263
+ }
264
+ if (!isDryRun) {
265
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
433
266
  }
434
267
  }
435
268
  function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup) {
@@ -470,14 +303,3 @@ function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGro
470
303
  process.exit(1);
471
304
  }
472
305
  }
473
- function parseGeneratorCallbackResult(result) {
474
- if (Array.isArray(result)) {
475
- return {
476
- changedFiles: result,
477
- deletedFiles: [],
478
- };
479
- }
480
- else {
481
- return result;
482
- }
483
- }
@@ -12,7 +12,6 @@ async function repair(args, extraMigrations = []) {
12
12
  if (!skip) {
13
13
  agg.push({
14
14
  package: 'nx',
15
- cli: 'nx',
16
15
  name,
17
16
  description: migration.description,
18
17
  version: migration.version,
@@ -1,7 +1,7 @@
1
1
  import { PackageManager } from '../../utils/package-manager';
2
2
  import { PackageJson } from '../../utils/package-json';
3
3
  import { NxJsonConfiguration } from '../../config/nx-json';
4
- import type { PowerpackLicense } from '@nx/powerpack-license';
4
+ import { type NxKey } from '@nx/key';
5
5
  export declare const packagesWeCareAbout: string[];
6
6
  export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
7
7
  /**
@@ -16,8 +16,8 @@ export declare function reportHandler(): Promise<void>;
16
16
  export interface ReportData {
17
17
  pm: PackageManager;
18
18
  pmVersion: string;
19
- powerpackLicense: PowerpackLicense | null;
20
- powerpackError: Error | null;
19
+ nxKey: NxKey | null;
20
+ nxKeyError: Error | null;
21
21
  powerpackPlugins: PackageJson[];
22
22
  localPlugins: string[];
23
23
  communityPlugins: PackageJson[];
@@ -36,6 +36,10 @@ export interface ReportData {
36
36
  };
37
37
  projectGraphError?: Error | null;
38
38
  nativeTarget: string | null;
39
+ cache: {
40
+ max: number;
41
+ used: number;
42
+ } | null;
39
43
  }
40
44
  export declare function getReportData(): Promise<ReportData>;
41
45
  interface OutOfSyncPackageGroup {
@@ -21,7 +21,10 @@ const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
21
21
  const installation_directory_1 = require("../../utils/installation-directory");
22
22
  const nx_json_1 = require("../../config/nx-json");
23
23
  const error_types_1 = require("../../project-graph/error-types");
24
- const powerpack_1 = require("../../utils/powerpack");
24
+ const nx_key_1 = require("../../utils/nx-key");
25
+ const cache_1 = require("../../tasks-runner/cache");
26
+ const native_1 = require("../../native");
27
+ const cache_directory_1 = require("../../utils/cache-directory");
25
28
  const nxPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(__dirname, '../../../package.json'));
26
29
  exports.packagesWeCareAbout = [
27
30
  'lerna',
@@ -46,7 +49,7 @@ const LINE_SEPARATOR = '---------------------------------------';
46
49
  *
47
50
  */
48
51
  async function reportHandler() {
49
- const { pm, pmVersion, powerpackLicense, powerpackError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
52
+ const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, cache, } = await getReportData();
50
53
  const fields = [
51
54
  ['Node', process.versions.node],
52
55
  ['OS', `${process.platform}-${process.arch}`],
@@ -61,13 +64,31 @@ async function reportHandler() {
61
64
  packageVersionsWeCareAbout.forEach((p) => {
62
65
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
63
66
  });
64
- if (powerpackLicense) {
67
+ if (nxKey) {
65
68
  bodyLines.push('');
66
69
  bodyLines.push(LINE_SEPARATOR);
67
- bodyLines.push(chalk.green('Nx Powerpack'));
68
- bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount === 9999
69
- ? 'an unlimited number of'
70
- : powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''} until ${new Date((powerpackLicense.realExpiresAt ?? powerpackLicense.expiresAt) * 1000).toLocaleDateString()}`);
70
+ bodyLines.push(chalk.green('Nx key licensed packages'));
71
+ bodyLines.push((0, nx_key_1.createNxKeyLicenseeInformation)(nxKey));
72
+ if (nxKey.realExpiresAt || nxKey.expiresAt) {
73
+ const licenseExpiryDate = new Date((nxKey.realExpiresAt ?? nxKey.expiresAt) * 1000);
74
+ // license is not expired
75
+ if (licenseExpiryDate.getTime() >= Date.now()) {
76
+ if ('perpetualNxVersion' in nxKey) {
77
+ bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
78
+ }
79
+ else {
80
+ bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
81
+ }
82
+ }
83
+ else {
84
+ if ('perpetualNxVersion' in nxKey) {
85
+ bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
86
+ }
87
+ else {
88
+ bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
89
+ }
90
+ }
91
+ }
71
92
  bodyLines.push('');
72
93
  padding =
73
94
  Math.max(...powerpackPlugins.map((powerpackPlugin) => powerpackPlugin.name.length)) + 1;
@@ -76,11 +97,11 @@ async function reportHandler() {
76
97
  }
77
98
  bodyLines.push('');
78
99
  }
79
- else if (powerpackError) {
100
+ else if (nxKeyError) {
80
101
  bodyLines.push('');
81
- bodyLines.push(chalk.red('Nx Powerpack'));
102
+ bodyLines.push(chalk.red('Nx key'));
82
103
  bodyLines.push(LINE_SEPARATOR);
83
- bodyLines.push(powerpackError.message);
104
+ bodyLines.push(nxKeyError.message);
84
105
  bodyLines.push('');
85
106
  }
86
107
  if (registeredPlugins.length) {
@@ -105,6 +126,10 @@ async function reportHandler() {
105
126
  bodyLines.push(`\t ${chalk.green(plugin)}`);
106
127
  }
107
128
  }
129
+ if (cache) {
130
+ bodyLines.push(LINE_SEPARATOR);
131
+ bodyLines.push(`Cache Usage: ${(0, cache_1.formatCacheSize)(cache.used)} / ${cache.max === 0 ? '∞' : (0, cache_1.formatCacheSize)(cache.max)}`);
132
+ }
108
133
  if (outOfSyncPackageGroup) {
109
134
  bodyLines.push(LINE_SEPARATOR);
110
135
  bodyLines.push(`The following packages should match the installed version of ${outOfSyncPackageGroup.basePackage}`);
@@ -147,20 +172,28 @@ async function getReportData() {
147
172
  }
148
173
  const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
149
174
  const native = isNativeAvailable();
150
- let powerpackLicense = null;
151
- let powerpackError = null;
175
+ let nxKey = null;
176
+ let nxKeyError = null;
152
177
  try {
153
- powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
178
+ nxKey = await (0, nx_key_1.getNxKeyInformation)();
154
179
  }
155
180
  catch (e) {
156
- if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
157
- powerpackError = e;
181
+ if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
182
+ nxKeyError = e;
158
183
  }
159
184
  }
185
+ let cache = (0, cache_1.dbCacheEnabled)(nxJson)
186
+ ? {
187
+ max: nxJson.maxCacheSize !== undefined
188
+ ? (0, cache_1.parseMaxCacheSize)(nxJson.maxCacheSize)
189
+ : (0, native_1.getDefaultMaxCacheSize)(cache_directory_1.cacheDir),
190
+ used: new cache_1.DbCache({ nxCloudRemoteCache: null }).getUsedCacheSpace(),
191
+ }
192
+ : null;
160
193
  return {
161
194
  pm,
162
- powerpackLicense,
163
- powerpackError,
195
+ nxKey,
196
+ nxKeyError,
164
197
  powerpackPlugins,
165
198
  pmVersion,
166
199
  localPlugins,
@@ -170,6 +203,7 @@ async function getReportData() {
170
203
  outOfSyncPackageGroup,
171
204
  projectGraphError,
172
205
  nativeTarget: native ? native.getBinaryTarget() : null,
206
+ cache,
173
207
  };
174
208
  }
175
209
  async function tryGetProjectGraph() {
@@ -238,7 +272,7 @@ function findMisalignedPackagesForPackage(base) {
238
272
  }
239
273
  function findInstalledPowerpackPlugins() {
240
274
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
241
- return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
275
+ return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
242
276
  }
243
277
  function findInstalledCommunityPlugins() {
244
278
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsNxInfixCommand = exports.yargsRunCommand = void 0;
4
4
  const yargs_1 = require("yargs");
5
- const shared_options_1 = require("../yargs-utils/shared-options");
6
5
  const handle_errors_1 = require("../../utils/handle-errors");
6
+ const shared_options_1 = require("../yargs-utils/shared-options");
7
7
  exports.yargsRunCommand = {
8
8
  command: 'run [project][:target][:configuration] [_..]',
9
9
  describe: `Run a target for a project
@@ -13,7 +13,7 @@ exports.yargsRunCommand = {
13
13
  (e.g., nx serve myapp --configuration=production)
14
14
 
15
15
  You can skip the use of Nx cache by using the --skip-nx-cache option.`,
16
- builder: (yargs) => (0, shared_options_1.withRunOneOptions)((0, shared_options_1.withBatch)(yargs)),
16
+ builder: (yargs) => (0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOneOptions)((0, shared_options_1.withBatch)(yargs))),
17
17
  handler: async (args) => {
18
18
  const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
19
19
  await Promise.resolve().then(() => require('./run-one')).then((m) => m.runOne(process.cwd(), (0, shared_options_1.withOverrides)(args)));