nx 23.2.0-beta.7 → 23.2.0-beta.9

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 (188) hide show
  1. package/dist/bin/init-local.js +3 -5
  2. package/dist/release/changelog-renderer/index.js +4 -5
  3. package/dist/src/adapter/ngcli-adapter.js +60 -1
  4. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +2 -2
  5. package/dist/src/command-line/completion/command-object.js +7 -12
  6. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +17 -23
  7. package/dist/src/command-line/format/format.js +84 -101
  8. package/dist/src/command-line/generate/generate.js +35 -35
  9. package/dist/src/command-line/import/import.js +30 -40
  10. package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
  11. package/dist/src/command-line/init/command-object.js +4 -2
  12. package/dist/src/command-line/init/configure-plugins.js +4 -1
  13. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
  14. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
  15. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
  16. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
  17. package/dist/src/command-line/init/implementation/angular/index.js +10 -15
  18. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -0
  19. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
  20. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
  21. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +5 -0
  22. package/dist/src/command-line/init/implementation/format.d.ts +18 -0
  23. package/dist/src/command-line/init/implementation/format.js +114 -0
  24. package/dist/src/command-line/init/implementation/utils.js +8 -0
  25. package/dist/src/command-line/init/init-v1.js +15 -18
  26. package/dist/src/command-line/init/init-v2.js +37 -56
  27. package/dist/src/command-line/migrate/agentic/definitions.js +35 -8
  28. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +22 -3
  29. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +13 -10
  30. package/dist/src/command-line/migrate/agentic/handoff.d.ts +3 -1
  31. package/dist/src/command-line/migrate/agentic/handoff.js +4 -2
  32. package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
  33. package/dist/src/command-line/migrate/agentic/runner.js +24 -24
  34. package/dist/src/command-line/migrate/agentic/select.js +20 -30
  35. package/dist/src/command-line/migrate/agentic/types.d.ts +19 -3
  36. package/dist/src/command-line/migrate/agentic/types.js +13 -4
  37. package/dist/src/command-line/migrate/command-object.d.ts +3 -0
  38. package/dist/src/command-line/migrate/command-object.js +13 -0
  39. package/dist/src/command-line/migrate/execute-migration.d.ts +14 -0
  40. package/dist/src/command-line/migrate/execute-migration.js +30 -9
  41. package/dist/src/command-line/migrate/migrate-analytics.d.ts +28 -0
  42. package/dist/src/command-line/migrate/migrate-analytics.js +51 -1
  43. package/dist/src/command-line/migrate/migrate-commits.d.ts +8 -2
  44. package/dist/src/command-line/migrate/migrate-commits.js +66 -19
  45. package/dist/src/command-line/migrate/migrate-config.d.ts +4 -2
  46. package/dist/src/command-line/migrate/migrate-config.js +12 -4
  47. package/dist/src/command-line/migrate/migrate.d.ts +13 -2
  48. package/dist/src/command-line/migrate/migrate.js +243 -80
  49. package/dist/src/command-line/migrate/multi-major.js +7 -10
  50. package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
  51. package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
  52. package/dist/src/command-line/migrate/run/agent-output.js +65 -0
  53. package/dist/src/command-line/migrate/run/index.d.ts +7 -0
  54. package/dist/src/command-line/migrate/run/index.js +19 -1
  55. package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
  56. package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
  57. package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
  58. package/dist/src/command-line/migrate/run/run-id.js +56 -0
  59. package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
  60. package/dist/src/command-line/migrate/run/run-state.js +438 -0
  61. package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
  62. package/dist/src/command-line/migrate/run/state-lock.js +76 -0
  63. package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
  64. package/dist/src/command-line/migrate/run/state-machine.js +315 -0
  65. package/dist/src/command-line/migrate/run/util.d.ts +58 -0
  66. package/dist/src/command-line/migrate/run/util.js +139 -7
  67. package/dist/src/command-line/migrate/run/worker.d.ts +1 -0
  68. package/dist/src/command-line/migrate/run/worker.js +308 -45
  69. package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
  70. package/dist/src/command-line/migrate/safe-prompt.js +32 -43
  71. package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
  72. package/dist/src/command-line/migrate/step-actions.js +12 -0
  73. package/dist/src/command-line/migrate/text.d.ts +18 -0
  74. package/dist/src/command-line/migrate/text.js +26 -0
  75. package/dist/src/command-line/migrate/version-skew-guard.d.ts +6 -4
  76. package/dist/src/command-line/migrate/version-skew-guard.js +34 -14
  77. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +16 -20
  78. package/dist/src/command-line/release/changelog.js +6 -17
  79. package/dist/src/command-line/release/plan.js +15 -28
  80. package/dist/src/command-line/release/release.js +6 -17
  81. package/dist/src/command-line/release/utils/remote-release-clients/github.js +16 -22
  82. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +13 -22
  83. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
  84. package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
  85. package/dist/src/command-line/release/version.js +2 -2
  86. package/dist/src/core/graph/main.js +1 -1
  87. package/dist/src/daemon/client/client.js +11 -2
  88. package/dist/src/devkit-internals.d.ts +7 -2
  89. package/dist/src/devkit-internals.js +22 -6
  90. package/dist/src/generators/internal-utils/{format-changed-files-with-prettier-if-available.d.ts → format-changed-files.d.ts} +6 -6
  91. package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
  92. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
  93. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
  94. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
  95. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
  96. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
  97. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
  98. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
  99. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
  100. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
  101. package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
  102. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
  103. package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
  104. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
  105. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
  106. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
  107. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
  108. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
  109. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
  110. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
  111. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
  112. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
  113. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
  114. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
  115. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
  116. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
  117. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
  118. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
  119. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
  120. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  121. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  122. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
  123. package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
  124. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +128 -2
  125. package/dist/src/tasks-runner/run-command.js +17 -32
  126. package/dist/src/tasks-runner/task-env.js +5 -2
  127. package/dist/src/tasks-runner/utils.js +2 -6
  128. package/dist/src/utils/analytics-prompt.js +4 -7
  129. package/dist/src/utils/chunkify.d.ts +7 -1
  130. package/dist/src/utils/chunkify.js +10 -3
  131. package/dist/src/utils/exit-codes.d.ts +9 -0
  132. package/dist/src/utils/exit-codes.js +19 -0
  133. package/dist/src/utils/fileutils.d.ts +5 -0
  134. package/dist/src/utils/fileutils.js +7 -2
  135. package/dist/src/utils/formatters/index.d.ts +13 -0
  136. package/dist/src/utils/formatters/index.js +74 -0
  137. package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
  138. package/dist/src/utils/formatters/oxfmt.js +764 -0
  139. package/dist/src/utils/formatters/prettier.d.ts +26 -0
  140. package/dist/src/utils/formatters/prettier.js +201 -0
  141. package/dist/src/utils/formatters/shared.d.ts +5 -0
  142. package/dist/src/utils/formatters/shared.js +8 -0
  143. package/dist/src/utils/git-utils.d.ts +33 -2
  144. package/dist/src/utils/git-utils.js +156 -8
  145. package/dist/src/utils/ignore.d.ts +47 -5
  146. package/dist/src/utils/ignore.js +93 -11
  147. package/dist/src/utils/long-running-target.d.ts +10 -0
  148. package/dist/src/utils/long-running-target.js +19 -0
  149. package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
  150. package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
  151. package/dist/src/utils/min-release-age/packument.js +1 -1
  152. package/dist/src/utils/nx-console-prompt.js +3 -6
  153. package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
  154. package/dist/src/utils/package-manager-config/bunfig.js +49 -0
  155. package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
  156. package/dist/src/utils/package-manager-config/npmrc.js +124 -0
  157. package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
  158. package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
  159. package/dist/src/utils/package-manager.d.ts +21 -2
  160. package/dist/src/utils/package-manager.js +244 -47
  161. package/dist/src/utils/params.d.ts +7 -1
  162. package/dist/src/utils/params.js +64 -6
  163. package/dist/src/utils/prompt-helpers.d.ts +53 -0
  164. package/dist/src/utils/prompt-helpers.js +111 -0
  165. package/dist/src/utils/provenance.js +6 -14
  166. package/dist/src/utils/registry-config/bun.d.ts +2 -0
  167. package/dist/src/utils/registry-config/bun.js +257 -0
  168. package/dist/src/utils/registry-config/index.d.ts +13 -0
  169. package/dist/src/utils/registry-config/index.js +102 -0
  170. package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
  171. package/dist/src/utils/registry-config/pnpm.js +1551 -0
  172. package/dist/src/utils/registry-config/utils.d.ts +195 -0
  173. package/dist/src/utils/registry-config/utils.js +496 -0
  174. package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
  175. package/dist/src/utils/registry-config/yarn-berry.js +612 -0
  176. package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
  177. package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
  178. package/dist/src/utils/safe-spawn.d.ts +24 -0
  179. package/dist/src/utils/safe-spawn.js +104 -0
  180. package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
  181. package/dist/src/utils/write-formatted-json-file.js +5 -4
  182. package/migrations.json +6 -0
  183. package/package.json +17 -13
  184. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -88
  185. package/dist/src/utils/is-using-prettier.d.ts +0 -3
  186. package/dist/src/utils/is-using-prettier.js +0 -62
  187. package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
  188. package/dist/src/utils/min-release-age/npmrc.js +0 -45
@@ -0,0 +1,24 @@
1
+ import { ChildProcess, ExecFileSyncOptions, SpawnOptions } from 'child_process';
2
+ /**
3
+ * Spawn a binary that may be a Windows `.cmd`/`.bat` shim, without letting its
4
+ * arguments become shell syntax.
5
+ *
6
+ * Off Windows, and for a `.exe`, no shell is involved at all. Where one is —
7
+ * a shim or a bare name — the binary and every argument are quoted for cmd.exe.
8
+ *
9
+ * Not a complete guarantee: cmd.exe expands `%VAR%` in the binary or any
10
+ * argument whether or not it is quoted, so a caller with untrusted arguments
11
+ * inherits that gap (NXC-4798). See the note on `LINE_BREAK` above.
12
+ *
13
+ * @throws on Windows when the binary or an argument contains a line break, or a
14
+ * literal `"` (via `quoteShellArg`). Those are the only refusals — the `%`
15
+ * expansion above is not one of them.
16
+ */
17
+ export declare function safeSpawn(binary: string, args: readonly string[], options?: Omit<SpawnOptions, 'shell'>): ChildProcess;
18
+ /**
19
+ * Synchronous {@link safeSpawn}, returning the child's stdout.
20
+ *
21
+ * Carries the same Windows caveats: `%VAR%` is expanded quoted or not
22
+ * (NXC-4798), and a line break or literal `"` throws.
23
+ */
24
+ export declare function safeExecFileSync(binary: string, args: readonly string[], options?: Omit<ExecFileSyncOptions, 'encoding' | 'shell'>): string;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safeSpawn = safeSpawn;
4
+ exports.safeExecFileSync = safeExecFileSync;
5
+ const child_process_1 = require("child_process");
6
+ const path_1 = require("path");
7
+ const shell_quoting_1 = require("./shell-quoting");
8
+ // Node refuses to launch a Windows `.cmd`/`.bat` shim without a shell
9
+ // (CVE-2024-27980). A bare name takes the shell for the same reason, one step
10
+ // removed: libuv walks PATH and PATHEXT itself, so no shell is needed to *find*
11
+ // the binary — but the walk may land on a `.cmd`/`.bat`, and this cannot know
12
+ // which in advance, so it is deliberately conservative. Everything else,
13
+ // including a `.exe`, spawns directly, so the shell and the quoting below reach
14
+ // only the invocations that cannot do without them.
15
+ //
16
+ // Deliberately a function: a module-level const is fixed at import time, which
17
+ // would make the Windows branch untestable.
18
+ function needsShell(binary) {
19
+ if (process.platform !== 'win32') {
20
+ return false;
21
+ }
22
+ // win32.extname, not the platform default: this branch only runs on Windows,
23
+ // where `path` is win32 anyway, and pinning it lets a test model the real
24
+ // parse rather than posix's (which reads `C:\ws\my.app\gradlew` as `.app\gradlew`).
25
+ const ext = path_1.win32.extname(binary).toLowerCase();
26
+ return ext === '' || ext === '.cmd' || ext === '.bat';
27
+ }
28
+ // A line break ends the command line whatever the quoting, so nothing can carry
29
+ // one.
30
+ //
31
+ // `%` is deliberately NOT refused, and this is a known gap rather than a safe
32
+ // case. cmd.exe expands `%VAR%` whether or not the value is quoted — see
33
+ // `quoteShellArg`'s own docstring in ./shell-quoting, which says so and pins it
34
+ // with a test — so quoting contains nothing here. It applies to the binary path
35
+ // as much as to the arguments, and an expansion yielding a `"` defeats the
36
+ // literal-quote refusal below, because that inspects the pre-expansion bytes.
37
+ // `bin/nx.ts` loads the workspace's own `.env` before the graph is built, so a
38
+ // repo can set the variable too.
39
+ //
40
+ // Refusing `%` is what an earlier revision did, and it made any workspace under
41
+ // a `%` path — a legal Windows directory name — fail graph construction. The gap
42
+ // is bounded by the argument that bounds this whole class: a repo that can reach
43
+ // here already has `mvnw` / `pom.xml` executing on its behalf. Closing it
44
+ // properly is tracked as NXC-4798.
45
+ const LINE_BREAK = /[\r\n]/;
46
+ /**
47
+ * Spawn a binary that may be a Windows `.cmd`/`.bat` shim, without letting its
48
+ * arguments become shell syntax.
49
+ *
50
+ * Off Windows, and for a `.exe`, no shell is involved at all. Where one is —
51
+ * a shim or a bare name — the binary and every argument are quoted for cmd.exe.
52
+ *
53
+ * Not a complete guarantee: cmd.exe expands `%VAR%` in the binary or any
54
+ * argument whether or not it is quoted, so a caller with untrusted arguments
55
+ * inherits that gap (NXC-4798). See the note on `LINE_BREAK` above.
56
+ *
57
+ * @throws on Windows when the binary or an argument contains a line break, or a
58
+ * literal `"` (via `quoteShellArg`). Those are the only refusals — the `%`
59
+ * expansion above is not one of them.
60
+ */
61
+ function safeSpawn(binary, args, options = {}) {
62
+ const shell = needsShell(binary);
63
+ return (0, child_process_1.spawn)(quoteBinary(binary, shell), quoteArgs(args, shell), {
64
+ ...options,
65
+ windowsHide: true,
66
+ shell,
67
+ });
68
+ }
69
+ /**
70
+ * Synchronous {@link safeSpawn}, returning the child's stdout.
71
+ *
72
+ * Carries the same Windows caveats: `%VAR%` is expanded quoted or not
73
+ * (NXC-4798), and a line break or literal `"` throws.
74
+ */
75
+ function safeExecFileSync(binary, args, options = {}) {
76
+ const shell = needsShell(binary);
77
+ return (0, child_process_1.execFileSync)(quoteBinary(binary, shell), quoteArgs(args, shell), {
78
+ stdio: 'pipe',
79
+ ...options,
80
+ windowsHide: true,
81
+ shell,
82
+ encoding: 'utf-8',
83
+ });
84
+ }
85
+ // The binary needs quoting too: Node joins it into the same command line, so a
86
+ // path holding a space or an `&` would split there.
87
+ function quoteBinary(binary, shell) {
88
+ if (!shell) {
89
+ return binary;
90
+ }
91
+ return quoteForCmd(binary, `the path ${JSON.stringify(binary)}`);
92
+ }
93
+ function quoteForCmd(value, described, remedy = '') {
94
+ if (LINE_BREAK.test(value)) {
95
+ throw new Error(`Cannot pass ${described} to cmd.exe: a line break inside it would end the command line before cmd.exe reached the rest of it.${remedy}`);
96
+ }
97
+ return (0, shell_quoting_1.quoteShellArg)(value);
98
+ }
99
+ function quoteArgs(args, shell) {
100
+ if (!shell) {
101
+ return [...args];
102
+ }
103
+ return args.map((arg) => quoteForCmd(arg, `the argument ${JSON.stringify(arg)}`, ' Remove it from your Nx configuration and try again.'));
104
+ }
@@ -1,6 +1,7 @@
1
1
  import { type JsonWriteOptions } from './fileutils';
2
2
  /**
3
- * Writes a JSON file, formatting with Prettier if available, otherwise
4
- * falling back to standard JSON serialization.
3
+ * Writes a JSON file, formatting it with whichever formatter the workspace is
4
+ * configured for, and falling back to standard JSON serialization when there
5
+ * is none or it cannot format the file.
5
6
  */
6
7
  export declare function writeFormattedJsonFile<T extends object = object>(filePath: string, content: T, options?: JsonWriteOptions): Promise<void>;
@@ -2,16 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeFormattedJsonFile = writeFormattedJsonFile;
4
4
  const node_fs_1 = require("node:fs");
5
- const format_changed_files_with_prettier_if_available_1 = require("../generators/internal-utils/format-changed-files-with-prettier-if-available");
5
+ const format_changed_files_1 = require("../generators/internal-utils/format-changed-files");
6
6
  const json_1 = require("./json");
7
7
  const fileutils_1 = require("./fileutils");
8
8
  const workspace_root_1 = require("./workspace-root");
9
9
  /**
10
- * Writes a JSON file, formatting with Prettier if available, otherwise
11
- * falling back to standard JSON serialization.
10
+ * Writes a JSON file, formatting it with whichever formatter the workspace is
11
+ * configured for, and falling back to standard JSON serialization when there
12
+ * is none or it cannot format the file.
12
13
  */
13
14
  async function writeFormattedJsonFile(filePath, content, options) {
14
- const formattedContent = await (0, format_changed_files_with_prettier_if_available_1.formatFilesWithPrettierIfAvailable)([{ path: filePath, content: (0, json_1.serializeJson)(content) }], workspace_root_1.workspaceRoot, { silent: true });
15
+ const formattedContent = await (0, format_changed_files_1.formatFileContents)([{ path: filePath, content: (0, json_1.serializeJson)(content) }], workspace_root_1.workspaceRoot, { silent: true });
15
16
  if (formattedContent.has(filePath)) {
16
17
  (0, node_fs_1.writeFileSync)(filePath, formattedContent.get(filePath), {
17
18
  encoding: 'utf-8',
package/migrations.json CHANGED
@@ -184,6 +184,12 @@
184
184
  "version": "23.0.0-beta.18",
185
185
  "description": "Adds .nx/migrate-runs to .gitignore",
186
186
  "implementation": "./dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore"
187
+ },
188
+ "23-2-0-set-cache-on-executor-target-defaults": {
189
+ "version": "23.2.0-beta.8",
190
+ "description": "Sets \"cache\" on some executor-based target defaults whose caching was previously enabled by a target name default, maintaining compatibility with how cacheability resolved before Nx 23. Keys the migration cannot decide are left alone and keep working through a deprecated runtime fallback.",
191
+ "implementation": "./dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults",
192
+ "documentation": "./dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md"
187
193
  }
188
194
  }
189
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "23.2.0-beta.7",
3
+ "version": "23.2.0-beta.9",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
@@ -47,6 +47,8 @@
47
47
  },
48
48
  "homepage": "https://nx.dev",
49
49
  "dependencies": {
50
+ "@clack/core": "1.4.3",
51
+ "@clack/prompts": "1.7.0",
50
52
  "@emnapi/core": "1.4.5",
51
53
  "@emnapi/runtime": "1.4.5",
52
54
  "@emnapi/wasi-threads": "1.0.4",
@@ -56,7 +58,6 @@
56
58
  "@yarnpkg/lockfile": "1.1.0",
57
59
  "@zkochan/js-yaml": "0.0.7",
58
60
  "agent-base": "6.0.2",
59
- "ansi-colors": "4.1.3",
60
61
  "ansi-regex": "5.0.1",
61
62
  "ansi-styles": "4.3.0",
62
63
  "argparse": "2.0.1",
@@ -89,13 +90,15 @@
89
90
  "ejs": "5.0.1",
90
91
  "emoji-regex": "8.0.0",
91
92
  "end-of-stream": "1.4.5",
92
- "enquirer": "2.3.6",
93
93
  "es-define-property": "1.0.1",
94
94
  "es-errors": "1.3.0",
95
95
  "es-object-atoms": "1.1.1",
96
96
  "es-set-tostringtag": "2.1.0",
97
97
  "escalade": "3.2.0",
98
98
  "escape-string-regexp": "1.0.5",
99
+ "fast-string-truncated-width": "3.0.3",
100
+ "fast-string-width": "3.0.2",
101
+ "fast-wrap-ansi": "0.2.0",
99
102
  "figures": "3.2.0",
100
103
  "flat": "5.0.2",
101
104
  "follow-redirects": "1.16.0",
@@ -148,6 +151,7 @@
148
151
  "safe-buffer": "5.2.1",
149
152
  "semver": "7.8.4",
150
153
  "signal-exit": "3.0.7",
154
+ "sisteransi": "1.0.5",
151
155
  "smol-toml": "1.6.1",
152
156
  "string-width": "4.2.3",
153
157
  "string_decoder": "1.3.0",
@@ -181,16 +185,16 @@
181
185
  }
182
186
  },
183
187
  "optionalDependencies": {
184
- "@nx/nx-darwin-arm64": "23.2.0-beta.7",
185
- "@nx/nx-darwin-x64": "23.2.0-beta.7",
186
- "@nx/nx-freebsd-x64": "23.2.0-beta.7",
187
- "@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.7",
188
- "@nx/nx-linux-arm64-gnu": "23.2.0-beta.7",
189
- "@nx/nx-linux-arm64-musl": "23.2.0-beta.7",
190
- "@nx/nx-linux-x64-gnu": "23.2.0-beta.7",
191
- "@nx/nx-linux-x64-musl": "23.2.0-beta.7",
192
- "@nx/nx-win32-arm64-msvc": "23.2.0-beta.7",
193
- "@nx/nx-win32-x64-msvc": "23.2.0-beta.7"
188
+ "@nx/nx-darwin-arm64": "23.2.0-beta.9",
189
+ "@nx/nx-darwin-x64": "23.2.0-beta.9",
190
+ "@nx/nx-freebsd-x64": "23.2.0-beta.9",
191
+ "@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.9",
192
+ "@nx/nx-linux-arm64-gnu": "23.2.0-beta.9",
193
+ "@nx/nx-linux-arm64-musl": "23.2.0-beta.9",
194
+ "@nx/nx-linux-x64-gnu": "23.2.0-beta.9",
195
+ "@nx/nx-linux-x64-musl": "23.2.0-beta.9",
196
+ "@nx/nx-win32-arm64-msvc": "23.2.0-beta.9",
197
+ "@nx/nx-win32-x64-msvc": "23.2.0-beta.9"
194
198
  },
195
199
  "nx-migrations": {
196
200
  "migrations": "./migrations.json",
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatChangedFilesWithPrettierIfAvailable = formatChangedFilesWithPrettierIfAvailable;
4
- exports.formatFilesWithPrettierIfAvailable = formatFilesWithPrettierIfAvailable;
5
- const tslib_1 = require("tslib");
6
- const path = tslib_1.__importStar(require("path"));
7
- const is_using_prettier_1 = require("../../utils/is-using-prettier");
8
- const path_1 = require("../../utils/path");
9
- const installation_directory_1 = require("../../utils/installation-directory");
10
- /**
11
- * Formats all the created or updated files using Prettier
12
- * @param tree - the file system tree
13
- *
14
- * @remarks
15
- * Set the environment variable `NX_SKIP_FORMAT` to `true` to skip Prettier
16
- * formatting. This is useful for repositories that use alternative formatters
17
- * like Biome, dprint, or have custom formatting requirements.
18
- */
19
- async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
20
- if (process.env.NX_SKIP_FORMAT === 'true') {
21
- return;
22
- }
23
- const excludedPaths = options?.excludePaths
24
- ? new Set(Array.from(options.excludePaths, path_1.normalizePath))
25
- : undefined;
26
- const files = new Set(tree
27
- .listChanges()
28
- .filter((file) => file.type !== 'DELETE' &&
29
- !excludedPaths?.has((0, path_1.normalizePath)(file.path))));
30
- const results = await formatFilesWithPrettierIfAvailable(Array.from(files), tree.root, options);
31
- for (const [path, content] of results) {
32
- tree.write(path, content);
33
- }
34
- }
35
- async function formatFilesWithPrettierIfAvailable(files, root, options) {
36
- const results = new Map();
37
- // Check here as well for direct callers of this function
38
- if (process.env.NX_SKIP_FORMAT === 'true' || files.length === 0) {
39
- return results;
40
- }
41
- let prettier;
42
- try {
43
- const prettierPath = require.resolve('prettier', {
44
- paths: [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname],
45
- });
46
- prettier = require(prettierPath);
47
- /**
48
- * Even after we discovered prettier in node_modules, we need to be sure that the user is intentionally using prettier
49
- * before proceeding to format with it.
50
- */
51
- if (!(0, is_using_prettier_1.isUsingPrettier)(root)) {
52
- return results;
53
- }
54
- }
55
- catch { }
56
- if (!prettier) {
57
- return results;
58
- }
59
- await Promise.all(Array.from(files).map(async (file) => {
60
- try {
61
- const systemPath = path.join(root, file.path);
62
- let options = {
63
- filepath: systemPath,
64
- };
65
- const resolvedOptions = await prettier.resolveConfig(systemPath, {
66
- editorconfig: true,
67
- });
68
- if (!resolvedOptions) {
69
- return;
70
- }
71
- options = {
72
- ...options,
73
- ...resolvedOptions,
74
- };
75
- const support = await prettier.getFileInfo(systemPath, options);
76
- if (support.ignored || !support.inferredParser) {
77
- return;
78
- }
79
- results.set(file.path, await prettier.format(file.content.toString('utf-8'), options));
80
- }
81
- catch (e) {
82
- if (!options?.silent) {
83
- console.warn(`Could not format ${file.path}. Error: "${e.message}"`);
84
- }
85
- }
86
- }));
87
- return results;
88
- }
@@ -1,3 +0,0 @@
1
- import type { Tree } from '../generators/tree';
2
- export declare function isUsingPrettier(root: string): boolean;
3
- export declare function isUsingPrettierInTree(tree: Tree): boolean;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUsingPrettier = isUsingPrettier;
4
- exports.isUsingPrettierInTree = isUsingPrettierInTree;
5
- const node_fs_1 = require("node:fs");
6
- const node_path_1 = require("node:path");
7
- const json_1 = require("../generators/utils/json");
8
- const fileutils_1 = require("./fileutils");
9
- /**
10
- * Possible configuration files are taken from https://prettier.io/docs/configuration
11
- */
12
- const configFiles = [
13
- '.prettierrc',
14
- '.prettierrc.json',
15
- '.prettierrc.yml',
16
- '.prettierrc.yaml',
17
- '.prettierrc.json5',
18
- '.prettierrc.js',
19
- 'prettier.config.js',
20
- '.prettierrc.ts',
21
- 'prettier.config.ts',
22
- '.prettierrc.mjs',
23
- 'prettier.config.mjs',
24
- '.prettierrc.mts',
25
- 'prettier.config.mts',
26
- '.prettierrc.cjs',
27
- 'prettier.config.cjs',
28
- '.prettierrc.cts',
29
- 'prettier.config.cts',
30
- '.prettierrc.toml',
31
- ];
32
- function isUsingPrettier(root) {
33
- for (const file of configFiles) {
34
- if ((0, node_fs_1.existsSync)(file)) {
35
- return true;
36
- }
37
- }
38
- // Even if no file is present, it is possible the user is configuring prettier via their package.json
39
- const packageJsonPath = (0, node_path_1.join)(root, 'package.json');
40
- if ((0, node_fs_1.existsSync)(packageJsonPath)) {
41
- const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
42
- if (packageJson.prettier) {
43
- return true;
44
- }
45
- }
46
- return false;
47
- }
48
- function isUsingPrettierInTree(tree) {
49
- for (const file of configFiles) {
50
- if (tree.exists(file)) {
51
- return true;
52
- }
53
- }
54
- // Even if no file is present, it is possible the user is configuring prettier via their package.json
55
- if (tree.exists('package.json')) {
56
- const packageJson = (0, json_1.readJson)(tree, 'package.json');
57
- if (packageJson.prettier) {
58
- return true;
59
- }
60
- }
61
- return false;
62
- }
@@ -1,15 +0,0 @@
1
- export interface NpmrcEntry {
2
- key: string;
3
- value: string;
4
- }
5
- /**
6
- * Parses an .npmrc file into its `key = value` entries the way npm/npm-conf do:
7
- * skip blank lines and `#`/`;` comments, split on the first `=`, and trim both
8
- * sides. The value is returned raw (quote stripping is the caller's concern).
9
- * Returns null when the file is missing or unreadable so callers can distinguish
10
- * "no file" from "file with no relevant keys". Shared by the npm and pnpm
11
- * cooldown readers.
12
- */
13
- export declare function readNpmrcEntries(path: string): NpmrcEntry[] | null;
14
- /** The parsing half of {@link readNpmrcEntries}, usable without a filesystem. */
15
- export declare function parseNpmrcContent(raw: string): NpmrcEntry[];
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readNpmrcEntries = readNpmrcEntries;
4
- exports.parseNpmrcContent = parseNpmrcContent;
5
- const fs_1 = require("fs");
6
- /**
7
- * Parses an .npmrc file into its `key = value` entries the way npm/npm-conf do:
8
- * skip blank lines and `#`/`;` comments, split on the first `=`, and trim both
9
- * sides. The value is returned raw (quote stripping is the caller's concern).
10
- * Returns null when the file is missing or unreadable so callers can distinguish
11
- * "no file" from "file with no relevant keys". Shared by the npm and pnpm
12
- * cooldown readers.
13
- */
14
- function readNpmrcEntries(path) {
15
- if (!(0, fs_1.existsSync)(path)) {
16
- return null;
17
- }
18
- let raw;
19
- try {
20
- raw = (0, fs_1.readFileSync)(path, 'utf-8');
21
- }
22
- catch {
23
- return null;
24
- }
25
- return parseNpmrcContent(raw);
26
- }
27
- /** The parsing half of {@link readNpmrcEntries}, usable without a filesystem. */
28
- function parseNpmrcContent(raw) {
29
- const entries = [];
30
- for (const line of raw.split(/\r?\n/)) {
31
- const trimmed = line.trim();
32
- if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith(';')) {
33
- continue;
34
- }
35
- const eq = trimmed.indexOf('=');
36
- if (eq === -1) {
37
- continue;
38
- }
39
- entries.push({
40
- key: trimmed.slice(0, eq).trim(),
41
- value: trimmed.slice(eq + 1).trim(),
42
- });
43
- }
44
- return entries;
45
- }