nx 20.0.0-beta.2 → 20.0.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/.eslintrc.json +9 -1
  2. package/package.json +14 -14
  3. package/schemas/nx-schema.json +26 -21
  4. package/src/command-line/graph/graph.js +9 -9
  5. package/src/command-line/import/utils/prepare-source-repo.js +8 -3
  6. package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
  7. package/src/command-line/init/implementation/react/clean-up-files.js +7 -7
  8. package/src/command-line/init/implementation/react/index.js +19 -12
  9. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
  10. package/src/command-line/release/changelog.js +1 -2
  11. package/src/command-line/release/config/version-plans.js +6 -7
  12. package/src/command-line/release/plan.js +6 -5
  13. package/src/command-line/release/release.js +2 -2
  14. package/src/command-line/release/version.js +5 -3
  15. package/src/command-line/reset/reset.js +20 -13
  16. package/src/core/graph/main.js +1 -1
  17. package/src/core/graph/styles.css +1 -1
  18. package/src/core/graph/styles.js +1 -1
  19. package/src/daemon/cache.d.ts +1 -2
  20. package/src/daemon/cache.js +12 -21
  21. package/src/daemon/client/client.js +9 -8
  22. package/src/daemon/tmp-dir.js +6 -7
  23. package/src/generators/tree.d.ts +1 -1
  24. package/src/generators/tree.js +11 -11
  25. package/src/generators/utils/project-configuration.js +2 -1
  26. package/src/hasher/hash-task.d.ts +4 -2
  27. package/src/hasher/hash-task.js +6 -9
  28. package/src/native/nx.wasm32-wasi.wasm +0 -0
  29. package/src/plugins/js/index.js +1 -2
  30. package/src/project-graph/nx-deps-cache.js +5 -6
  31. package/src/tasks-runner/cache.js +17 -16
  32. package/src/tasks-runner/forked-process-task-runner.js +16 -5
  33. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
  34. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
  35. package/src/tasks-runner/remove-old-cache-records.js +2 -3
  36. package/src/tasks-runner/run-command.js +3 -1
  37. package/src/tasks-runner/task-orchestrator.d.ts +1 -0
  38. package/src/tasks-runner/task-orchestrator.js +6 -2
  39. package/src/tasks-runner/tasks-schedule.d.ts +1 -0
  40. package/src/tasks-runner/tasks-schedule.js +6 -2
  41. package/src/utils/fileutils.d.ts +9 -1
  42. package/src/utils/fileutils.js +29 -12
  43. package/src/utils/ignore.js +2 -2
  44. package/src/utils/package-json.d.ts +1 -0
  45. package/src/utils/package-manager.js +2 -2
  46. package/src/utils/plugins/core-plugins.js +4 -0
package/.eslintrc.json CHANGED
@@ -5,7 +5,15 @@
5
5
  "overrides": [
6
6
  {
7
7
  "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8
- "rules": {}
8
+ "rules": {
9
+ "no-restricted-imports": [
10
+ "error",
11
+ {
12
+ "name": "fs-extra",
13
+ "message": "Please use equivalent utilities from `node:fs` instead."
14
+ }
15
+ ]
16
+ }
9
17
  },
10
18
  {
11
19
  "files": ["*.ts"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.0.0-beta.2",
3
+ "version": "20.0.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -49,7 +49,6 @@
49
49
  "figures": "3.2.0",
50
50
  "flat": "^5.0.2",
51
51
  "front-matter": "^4.0.2",
52
- "fs-extra": "^11.1.0",
53
52
  "ignore": "^5.0.4",
54
53
  "jest-diff": "^29.4.1",
55
54
  "jsonc-parser": "3.2.0",
@@ -59,7 +58,6 @@
59
58
  "open": "^8.4.0",
60
59
  "semver": "^7.5.3",
61
60
  "string-width": "^4.2.3",
62
- "strong-log-transformer": "^2.1.0",
63
61
  "tar-stream": "~2.2.0",
64
62
  "tmp": "~0.2.1",
65
63
  "tsconfig-paths": "^4.1.2",
@@ -68,7 +66,7 @@
68
66
  "yargs-parser": "21.1.1",
69
67
  "node-machine-id": "1.1.12",
70
68
  "ora": "5.3.0",
71
- "@nrwl/tao": "20.0.0-beta.2"
69
+ "@nrwl/tao": "20.0.0-beta.4"
72
70
  },
73
71
  "peerDependencies": {
74
72
  "@swc-node/register": "^1.8.0",
@@ -83,16 +81,16 @@
83
81
  }
84
82
  },
85
83
  "optionalDependencies": {
86
- "@nx/nx-darwin-x64": "20.0.0-beta.2",
87
- "@nx/nx-darwin-arm64": "20.0.0-beta.2",
88
- "@nx/nx-linux-x64-gnu": "20.0.0-beta.2",
89
- "@nx/nx-linux-x64-musl": "20.0.0-beta.2",
90
- "@nx/nx-win32-x64-msvc": "20.0.0-beta.2",
91
- "@nx/nx-linux-arm64-gnu": "20.0.0-beta.2",
92
- "@nx/nx-linux-arm64-musl": "20.0.0-beta.2",
93
- "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.2",
94
- "@nx/nx-win32-arm64-msvc": "20.0.0-beta.2",
95
- "@nx/nx-freebsd-x64": "20.0.0-beta.2"
84
+ "@nx/nx-darwin-x64": "20.0.0-beta.4",
85
+ "@nx/nx-darwin-arm64": "20.0.0-beta.4",
86
+ "@nx/nx-linux-x64-gnu": "20.0.0-beta.4",
87
+ "@nx/nx-linux-x64-musl": "20.0.0-beta.4",
88
+ "@nx/nx-win32-x64-msvc": "20.0.0-beta.4",
89
+ "@nx/nx-linux-arm64-gnu": "20.0.0-beta.4",
90
+ "@nx/nx-linux-arm64-musl": "20.0.0-beta.4",
91
+ "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.4",
92
+ "@nx/nx-win32-arm64-msvc": "20.0.0-beta.4",
93
+ "@nx/nx-freebsd-x64": "20.0.0-beta.4"
96
94
  },
97
95
  "nx-migrations": {
98
96
  "migrations": "./migrations.json",
@@ -141,6 +139,8 @@
141
139
  "@nrwl/rollup",
142
140
  "@nx/remix",
143
141
  "@nrwl/remix",
142
+ "@nx/rspack",
143
+ "@nrwl/rspack",
144
144
  "@nx/storybook",
145
145
  "@nrwl/storybook",
146
146
  "@nrwl/tao",
@@ -152,25 +152,7 @@
152
152
  ]
153
153
  },
154
154
  "version": {
155
- "allOf": [
156
- {
157
- "$ref": "#/definitions/NxReleaseVersionConfiguration"
158
- },
159
- {
160
- "allOf": [
161
- {
162
- "not": {
163
- "required": ["git"]
164
- }
165
- },
166
- {
167
- "not": {
168
- "required": ["preVersionCommand"]
169
- }
170
- }
171
- ]
172
- }
173
- ]
155
+ "$ref": "#/definitions/NxReleaseGroupVersionConfiguration"
174
156
  },
175
157
  "changelog": {
176
158
  "oneOf": [
@@ -675,9 +657,32 @@
675
657
  },
676
658
  "preVersionCommand": {
677
659
  "type": "string",
678
- "description": "A command to run after validation of nx release configuration, but before versioning begins. Used for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
660
+ "description": "A command to run after validation of nx release configuration, but before versioning begins. Useful for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
679
661
  }
680
- }
662
+ },
663
+ "additionalProperties": false
664
+ },
665
+ "NxReleaseGroupVersionConfiguration": {
666
+ "type": "object",
667
+ "properties": {
668
+ "conventionalCommits": {
669
+ "type": "boolean",
670
+ "description": "Shorthand for enabling the current version of projects to be resolved from git tags, and the next version to be determined by analyzing commit messages according to the Conventional Commits specification.",
671
+ "default": false
672
+ },
673
+ "generator": {
674
+ "type": "string"
675
+ },
676
+ "generatorOptions": {
677
+ "type": "object",
678
+ "additionalProperties": true
679
+ },
680
+ "groupPreVersionCommand": {
681
+ "type": "string",
682
+ "description": "A command to run after validation of nx release configuration AND after the release.version.preVersionCommand (if any), but before versioning begins for this specific group. Useful for preparing build artifacts for the group. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
683
+ }
684
+ },
685
+ "additionalProperties": false
681
686
  },
682
687
  "NxReleaseChangelogConfiguration": {
683
688
  "type": "object",
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateGraph = generateGraph;
4
4
  const crypto_1 = require("crypto");
5
5
  const node_child_process_1 = require("node:child_process");
6
- const fs_1 = require("fs");
7
- const fs_extra_1 = require("fs-extra");
6
+ const node_fs_1 = require("node:fs");
8
7
  const http = require("http");
9
8
  const minimatch_1 = require("minimatch");
10
9
  const node_url_1 = require("node:url");
@@ -225,7 +224,7 @@ async function generateGraph(args, affectedProjects) {
225
224
  process.exit(1);
226
225
  }
227
226
  }
228
- let html = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
227
+ let html = (0, node_fs_1.readFileSync)((0, path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
229
228
  prunedGraph = filterGraph(prunedGraph, args.focus || null, args.exclude || []);
230
229
  if (args.file) {
231
230
  // stdout is a magical constant that doesn't actually write a file
@@ -243,7 +242,7 @@ async function generateGraph(args, affectedProjects) {
243
242
  if (ext === '.html') {
244
243
  const assetsFolder = (0, path_1.join)(fileFolderPath, 'static');
245
244
  const assets = [];
246
- (0, fs_extra_1.copySync)((0, path_1.join)(__dirname, '../../core/graph'), assetsFolder, {
245
+ (0, node_fs_1.cpSync)((0, path_1.join)(__dirname, '../../core/graph'), assetsFolder, {
247
246
  filter: (_src, dest) => {
248
247
  const isntHtml = !/index\.html/.test(dest);
249
248
  if (isntHtml && dest.includes('.')) {
@@ -251,6 +250,7 @@ async function generateGraph(args, affectedProjects) {
251
250
  }
252
251
  return isntHtml;
253
252
  },
253
+ recursive: true,
254
254
  });
255
255
  const { projectGraphClientResponse } = await createProjectGraphAndSourceMapClientResponse(affectedProjects);
256
256
  const taskGraphClientResponse = await createTaskGraphClientResponse();
@@ -260,15 +260,15 @@ async function generateGraph(args, affectedProjects) {
260
260
  html = html.replace(/href="styles/g, 'href="static/styles');
261
261
  html = html.replace(/<base href="\/".*>/g, '');
262
262
  html = html.replace(/type="module"/g, '');
263
- (0, fs_1.writeFileSync)(fullFilePath, html);
264
- (0, fs_1.writeFileSync)((0, path_1.join)(assetsFolder, 'environment.js'), environmentJs);
263
+ (0, node_fs_1.writeFileSync)(fullFilePath, html);
264
+ (0, node_fs_1.writeFileSync)((0, path_1.join)(assetsFolder, 'environment.js'), environmentJs);
265
265
  output_1.output.success({
266
266
  title: `HTML output created in ${fileFolderPath}`,
267
267
  bodyLines: [fileFolderPath, ...assets],
268
268
  });
269
269
  }
270
270
  else if (ext === '.json') {
271
- (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(fullFilePath));
271
+ (0, node_fs_1.mkdirSync)((0, path_1.dirname)(fullFilePath), { recursive: true });
272
272
  const json = await createJsonOutput(prunedGraph, rawGraph, args.projects, args.targets);
273
273
  (0, fileutils_1.writeJsonFile)(fullFilePath, json);
274
274
  output_1.output.success({
@@ -394,13 +394,13 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
394
394
  }
395
395
  let pathname = (0, path_1.join)(__dirname, '../../core/graph/', sanitizePath);
396
396
  // if the file is not found or is a directory, return index.html
397
- if (!(0, fs_1.existsSync)(pathname) || (0, fs_1.statSync)(pathname).isDirectory()) {
397
+ if (!(0, node_fs_1.existsSync)(pathname) || (0, node_fs_1.statSync)(pathname).isDirectory()) {
398
398
  res.writeHead(200, { 'Content-Type': 'text/html' });
399
399
  res.end(html);
400
400
  return;
401
401
  }
402
402
  try {
403
- const data = (0, fs_1.readFileSync)(pathname);
403
+ const data = (0, node_fs_1.readFileSync)(pathname);
404
404
  const ext = (0, path_1.parse)(pathname).ext;
405
405
  res.setHeader('Content-type', mimeType[ext] || 'text/plain');
406
406
  res.end(data);
@@ -6,15 +6,20 @@ const path_1 = require("path");
6
6
  async function prepareSourceRepo(gitClient, ref, source, relativeDestination, tempImportBranch, sourceRemoteUrl) {
7
7
  const spinner = createSpinner().start(`Fetching ${ref} from ${sourceRemoteUrl}`);
8
8
  const relativeSourceDir = (0, path_1.relative)(gitClient.root, (0, path_1.join)(gitClient.root, source));
9
+ const message = relativeSourceDir.trim()
10
+ ? `Filtering git history to only include files in ${relativeSourceDir}`
11
+ : `Filtering git history`;
9
12
  if (await gitClient.hasFilterRepoInstalled()) {
10
- spinner.start(`Filtering git history to only include files in ${relativeSourceDir}`);
13
+ spinner.start(message);
11
14
  await gitClient.filterRepo(relativeSourceDir, relativeDestination);
12
15
  }
13
16
  else {
14
- spinner.start(`Filtering git history to only include files in ${relativeSourceDir} (this might take a few minutes -- install git-filter-repo for faster performance)`);
17
+ spinner.start(`${message} (this might take a few minutes -- install git-filter-repo for faster performance)`);
15
18
  await gitClient.filterBranch(relativeSourceDir, relativeDestination, tempImportBranch);
16
19
  }
17
- spinner.succeed(`Filtered git history to only include files in ${relativeSourceDir}`);
20
+ spinner.succeed(relativeSourceDir.trim()
21
+ ? `Filtered git history to only include files in ${relativeSourceDir}`
22
+ : `Filtered git history`);
18
23
  spinner.succeed(`${sourceRemoteUrl} has been prepared to be imported into this workspace on a temporary branch: ${tempImportBranch} in ${gitClient.root}`);
19
24
  }
20
25
  function wait(ms) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addNxToNest = addNxToNest;
4
4
  const enquirer = require("enquirer");
5
- const fs_extra_1 = require("fs-extra");
5
+ const node_fs_1 = require("node:fs");
6
6
  const path_1 = require("path");
7
7
  const fileutils_1 = require("../../../utils/fileutils");
8
8
  const output_1 = require("../../../utils/output");
@@ -214,7 +214,7 @@ function getJestOptions(isE2E, repoRoot, packageName, existingOptions) {
214
214
  function tryCreateJestPreset(repoRoot) {
215
215
  const jestPresetPath = (0, path_1.join)(repoRoot, 'jest.preset.js');
216
216
  if (!(0, fileutils_1.fileExists)(jestPresetPath)) {
217
- (0, fs_extra_1.writeFileSync)(jestPresetPath, `
217
+ (0, node_fs_1.writeFileSync)(jestPresetPath, `
218
218
  const nxPreset = require('@nx/jest/preset').default;
219
219
  module.exports = {...nxPreset};
220
220
  `, 'utf8');
@@ -231,8 +231,8 @@ function addJestTargets(repoRoot, packageName, projectJson, packageJson) {
231
231
  if (isPresetCreated) {
232
232
  unitTestOptions['preset'] = e2eTestOptions['preset'] = './jest.preset.js';
233
233
  }
234
- (0, fs_extra_1.writeFileSync)(unitTestConfigPath, `export default ${JSON.stringify(unitTestOptions, null, 2)}`, 'utf8');
235
- (0, fs_extra_1.writeFileSync)(e2eTestConfigPath, `export default ${JSON.stringify(e2eTestOptions, null, 2)}`, 'utf8');
234
+ (0, node_fs_1.writeFileSync)(unitTestConfigPath, `export default ${JSON.stringify(unitTestOptions, null, 2)}`, 'utf8');
235
+ (0, node_fs_1.writeFileSync)(e2eTestConfigPath, `export default ${JSON.stringify(e2eTestOptions, null, 2)}`, 'utf8');
236
236
  projectJson.targets['test'] = {
237
237
  executor: '@nx/jest:jest',
238
238
  outputs: [`{workspaceRoot}/coverage/${packageName}`],
@@ -312,7 +312,7 @@ function updateTsConfig(repoRoot, sourceRoot) {
312
312
  }
313
313
  function removeFile(repoRoot, file) {
314
314
  const path = (0, path_1.join)(repoRoot, file);
315
- (0, fs_extra_1.unlinkSync)(path);
315
+ (0, node_fs_1.unlinkSync)(path);
316
316
  }
317
317
  function mergeWithDefaultConfig(config) {
318
318
  const defaultNestCliConfigurations = {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cleanUpFiles = cleanUpFiles;
4
- const fs_extra_1 = require("fs-extra");
4
+ const node_fs_1 = require("node:fs");
5
5
  const fileutils_1 = require("../../../../utils/fileutils");
6
6
  function cleanUpFiles(appName, isStandalone) {
7
7
  // Delete targets from project since we delegate to npm scripts.
@@ -19,12 +19,12 @@ function cleanUpFiles(appName, isStandalone) {
19
19
  }
20
20
  }
21
21
  (0, fileutils_1.writeJsonFile)(projectJsonPath, json);
22
- (0, fs_extra_1.removeSync)('temp-workspace');
22
+ (0, node_fs_1.rmSync)('temp-workspace', { recursive: true, force: true });
23
23
  if (isStandalone) {
24
- (0, fs_extra_1.removeSync)('babel.config.json');
25
- (0, fs_extra_1.removeSync)('jest.preset.js');
26
- (0, fs_extra_1.removeSync)('jest.config.ts');
27
- (0, fs_extra_1.removeSync)('libs');
28
- (0, fs_extra_1.removeSync)('tools');
24
+ (0, node_fs_1.rmSync)('babel.config.json', { recursive: true, force: true });
25
+ (0, node_fs_1.rmSync)('jest.preset.js', { recursive: true, force: true });
26
+ (0, node_fs_1.rmSync)('jest.config.ts', { recursive: true, force: true });
27
+ (0, node_fs_1.rmSync)('libs', { recursive: true, force: true });
28
+ (0, node_fs_1.rmSync)('tools', { recursive: true, force: true });
29
29
  }
30
30
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addNxToCraRepo = addNxToCraRepo;
4
4
  const child_process_1 = require("child_process");
5
- const fs_extra_1 = require("fs-extra");
5
+ const node_fs_1 = require("node:fs");
6
6
  const path_1 = require("path");
7
7
  const fileutils_1 = require("../../../../utils/fileutils");
8
8
  const output_1 = require("../../../../utils/output");
@@ -116,13 +116,16 @@ async function reorgnizeWorkspaceStructure(options) {
116
116
  }
117
117
  }
118
118
  function createTempWorkspace(options) {
119
- (0, fs_extra_1.removeSync)('temp-workspace');
119
+ (0, node_fs_1.rmSync)('temp-workspace', { recursive: true, force: true });
120
120
  (0, child_process_1.execSync)(`npx ${options.npxYesFlagNeeded ? '-y' : ''} create-nx-workspace@latest temp-workspace --appName=${options.reactAppName} --preset=react-monorepo --style=css --bundler=${options.isVite ? 'vite' : 'webpack'} --packageManager=${options.packageManager} ${options.nxCloud ? '--nxCloud=yes' : '--nxCloud=skip'} ${options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'}`, { stdio: [0, 1, 2], windowsHide: true });
121
121
  output_1.output.log({ title: '👋 Welcome to Nx!' });
122
122
  output_1.output.log({ title: '🧹 Clearing unused files' });
123
- (0, fs_extra_1.copySync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName, 'project.json'), 'project.json');
124
- (0, fs_extra_1.removeSync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName));
125
- (0, fs_extra_1.removeSync)('node_modules');
123
+ (0, node_fs_1.cpSync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName, 'project.json'), 'project.json', { recursive: true });
124
+ (0, node_fs_1.rmSync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName), {
125
+ recursive: true,
126
+ force: true,
127
+ });
128
+ (0, node_fs_1.rmSync)('node_modules', { recursive: true, force: true });
126
129
  }
127
130
  function copyPackageJsonDepsFromTempWorkspace() {
128
131
  const repoRoot = process.cwd();
@@ -151,6 +154,12 @@ function overridePackageDeps(depConfigName, base, override) {
151
154
  });
152
155
  return base;
153
156
  }
157
+ function moveSync(src, dest) {
158
+ const destParentDir = (0, path_1.dirname)(dest);
159
+ (0, node_fs_1.mkdirSync)(destParentDir, { recursive: true });
160
+ (0, node_fs_1.rmSync)(dest, { recursive: true, force: true });
161
+ return (0, node_fs_1.renameSync)(src, dest);
162
+ }
154
163
  function moveFilesToTempWorkspace(options) {
155
164
  output_1.output.log({ title: '🚚 Moving your React app in your new Nx workspace' });
156
165
  copyPackageJsonDepsFromTempWorkspace();
@@ -169,11 +178,9 @@ function moveFilesToTempWorkspace(options) {
169
178
  const filesToMove = [...requiredCraFiles, ...optionalCraFiles].filter(Boolean);
170
179
  filesToMove.forEach((f) => {
171
180
  try {
172
- (0, fs_extra_1.moveSync)(f, options.isStandalone
181
+ moveSync(f, options.isStandalone
173
182
  ? (0, path_1.join)('temp-workspace', f)
174
- : (0, path_1.join)('temp-workspace', 'apps', options.reactAppName, f), {
175
- overwrite: true,
176
- });
183
+ : (0, path_1.join)('temp-workspace', 'apps', options.reactAppName, f));
177
184
  }
178
185
  catch (error) {
179
186
  if (requiredCraFiles.includes(f)) {
@@ -208,8 +215,8 @@ async function addBundler(options) {
208
215
  }
209
216
  function copyFromTempWorkspaceToRoot() {
210
217
  output_1.output.log({ title: '🚚 Folder restructuring.' });
211
- (0, fs_extra_1.readdirSync)('temp-workspace').forEach((f) => {
212
- (0, fs_extra_1.moveSync)((0, path_1.join)('temp-workspace', f), f, { overwrite: true });
218
+ (0, node_fs_1.readdirSync)('temp-workspace').forEach((f) => {
219
+ moveSync((0, path_1.join)('temp-workspace', f), f);
213
220
  });
214
221
  }
215
222
  function cleanUpUnusedFilesAndAddConfigFiles(options) {
@@ -218,6 +225,6 @@ function cleanUpUnusedFilesAndAddConfigFiles(options) {
218
225
  output_1.output.log({ title: "📃 Extend the app's tsconfig.json from the base" });
219
226
  (0, tsconfig_setup_1.setupTsConfig)(options.reactAppName, options.isStandalone);
220
227
  if (options.isStandalone) {
221
- (0, fs_extra_1.removeSync)('apps');
228
+ (0, node_fs_1.rmSync)('apps', { recursive: true, force: true });
222
229
  }
223
230
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renameJsToJsx = renameJsToJsx;
4
- const fs_extra_1 = require("fs-extra");
4
+ const node_fs_1 = require("node:fs");
5
5
  const workspace_context_1 = require("../../../../utils/workspace-context");
6
6
  const fileutils_1 = require("../../../../utils/fileutils");
7
7
  // Vite cannot process JSX like <div> or <Header> unless the file is named .jsx or .tsx
@@ -11,11 +11,11 @@ async function renameJsToJsx(appName, isStandalone) {
11
11
  ]);
12
12
  files.forEach((file) => {
13
13
  if ((0, fileutils_1.fileExists)(file)) {
14
- const content = (0, fs_extra_1.readFileSync)(file).toString();
14
+ const content = (0, node_fs_1.readFileSync)(file).toString();
15
15
  // Try to detect JSX before renaming to .jsx
16
16
  // Files like setupTests.js from CRA should not be renamed
17
17
  if (/<[a-zA-Z0-9]+/.test(content)) {
18
- (0, fs_extra_1.renameSync)(file, `${file}x`);
18
+ (0, node_fs_1.renameSync)(file, `${file}x`);
19
19
  }
20
20
  }
21
21
  });
@@ -5,7 +5,6 @@ exports.createAPI = createAPI;
5
5
  exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
6
6
  const chalk = require("chalk");
7
7
  const enquirer_1 = require("enquirer");
8
- const fs_extra_1 = require("fs-extra");
9
8
  const node_fs_1 = require("node:fs");
10
9
  const semver_1 = require("semver");
11
10
  const tmp_1 = require("tmp");
@@ -620,7 +619,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
620
619
  if (group.resolvedVersionPlans) {
621
620
  group.resolvedVersionPlans.forEach((plan) => {
622
621
  if (!args.dryRun) {
623
- (0, fs_extra_1.removeSync)(plan.absolutePath);
622
+ (0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
624
623
  if (args.verbose) {
625
624
  console.log(`Removing ${plan.relativePath}`);
626
625
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readRawVersionPlans = readRawVersionPlans;
4
4
  exports.setResolvedVersionPlansOnGroups = setResolvedVersionPlansOnGroups;
5
5
  exports.getVersionPlansAbsolutePath = getVersionPlansAbsolutePath;
6
- const fs_1 = require("fs");
7
- const fs_extra_1 = require("fs-extra");
8
6
  const node_child_process_1 = require("node:child_process");
7
+ const node_fs_1 = require("node:fs");
8
+ const promises_1 = require("node:fs/promises");
9
9
  const path_1 = require("path");
10
10
  const semver_1 = require("semver");
11
11
  const workspace_root_1 = require("../../../utils/workspace-root");
@@ -14,16 +14,15 @@ const fm = require('front-matter');
14
14
  const versionPlansDirectory = (0, path_1.join)('.nx', 'version-plans');
15
15
  async function readRawVersionPlans() {
16
16
  const versionPlansPath = getVersionPlansAbsolutePath();
17
- const versionPlansPathExists = await (0, fs_extra_1.pathExists)(versionPlansPath);
18
- if (!versionPlansPathExists) {
17
+ if (!(0, node_fs_1.existsSync)(versionPlansPath)) {
19
18
  return [];
20
19
  }
21
20
  const versionPlans = [];
22
- const versionPlanFiles = (0, fs_1.readdirSync)(versionPlansPath);
21
+ const versionPlanFiles = (0, node_fs_1.readdirSync)(versionPlansPath);
23
22
  for (const versionPlanFile of versionPlanFiles) {
24
23
  const filePath = (0, path_1.join)(versionPlansPath, versionPlanFile);
25
- const versionPlanContent = (0, fs_1.readFileSync)(filePath).toString();
26
- const versionPlanStats = await (0, fs_extra_1.stat)(filePath);
24
+ const versionPlanContent = (0, node_fs_1.readFileSync)(filePath).toString();
25
+ const versionPlanStats = await (0, promises_1.stat)(filePath);
27
26
  const parsedContent = fm(versionPlanContent);
28
27
  versionPlans.push({
29
28
  absolutePath: filePath,
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releasePlanCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
5
  const enquirer_1 = require("enquirer");
6
- const fs_extra_1 = require("fs-extra");
6
+ const node_fs_1 = require("node:fs");
7
+ const promises_1 = require("node:fs/promises");
7
8
  const node_path_1 = require("node:path");
8
9
  const semver_1 = require("semver");
9
10
  const tmp_1 = require("tmp");
@@ -193,8 +194,8 @@ async function createVersionPlanFileForBumps(args, versionPlanBumps) {
193
194
  output_1.output.logSingleLine(`Creating version plan file "${versionPlanFileName}"`);
194
195
  (0, print_changes_1.printDiff)('', versionPlanFileContent, 1);
195
196
  const versionPlansAbsolutePath = (0, version_plans_1.getVersionPlansAbsolutePath)();
196
- await (0, fs_extra_1.ensureDir)(versionPlansAbsolutePath);
197
- await (0, fs_extra_1.writeFile)((0, node_path_1.join)(versionPlansAbsolutePath, versionPlanFileName), versionPlanFileContent);
197
+ await (0, promises_1.mkdir)(versionPlansAbsolutePath, { recursive: true });
198
+ await (0, promises_1.writeFile)((0, node_path_1.join)(versionPlansAbsolutePath, versionPlanFileName), versionPlanFileContent);
198
199
  }
199
200
  }
200
201
  async function promptForVersion(message) {
@@ -236,9 +237,9 @@ async function _promptForMessage(versionPlanName) {
236
237
  if (!message.length) {
237
238
  const tmpDir = (0, tmp_1.dirSync)().name;
238
239
  const messageFilePath = (0, node_path_1.join)(tmpDir, `DRAFT_MESSAGE__${versionPlanName}.md`);
239
- (0, fs_extra_1.writeFileSync)(messageFilePath, '');
240
+ (0, node_fs_1.writeFileSync)(messageFilePath, '');
240
241
  await (0, launch_editor_1.launchEditor)(messageFilePath);
241
- message = (0, fs_extra_1.readFileSync)(messageFilePath, 'utf-8');
242
+ message = (0, node_fs_1.readFileSync)(messageFilePath, 'utf-8');
242
243
  }
243
244
  message = message.trim();
244
245
  if (!message) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseCLIHandler = void 0;
4
4
  exports.createAPI = createAPI;
5
5
  const enquirer_1 = require("enquirer");
6
- const fs_extra_1 = require("fs-extra");
6
+ const node_fs_1 = require("node:fs");
7
7
  const nx_json_1 = require("../../config/nx-json");
8
8
  const file_map_utils_1 = require("../../project-graph/file-map-utils");
9
9
  const project_graph_1 = require("../../project-graph/project-graph");
@@ -106,7 +106,7 @@ function createAPI(overrideReleaseConfig) {
106
106
  }
107
107
  group.resolvedVersionPlans.forEach((plan) => {
108
108
  if (!args.dryRun) {
109
- (0, fs_extra_1.removeSync)(plan.absolutePath);
109
+ (0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
110
110
  if (args.verbose) {
111
111
  console.log(`Removing ${plan.relativePath}`);
112
112
  }
@@ -210,7 +210,7 @@ function createAPI(overrideReleaseConfig) {
210
210
  runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
211
211
  dryRun: args.dryRun,
212
212
  verbose: args.verbose,
213
- });
213
+ }, releaseGroup);
214
214
  const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
215
215
  // Batch based on all projects within the release group
216
216
  releaseGroup.projects);
@@ -412,11 +412,13 @@ function resolveGeneratorData({ collectionName, generatorName, configGeneratorOp
412
412
  throw err;
413
413
  }
414
414
  }
415
- function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
415
+ function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup) {
416
416
  if (!preVersionCommand) {
417
417
  return;
418
418
  }
419
- output_1.output.logSingleLine(`Executing pre-version command`);
419
+ output_1.output.logSingleLine(releaseGroup
420
+ ? `Executing release group pre-version command for "${releaseGroup.name}"`
421
+ : `Executing pre-version command`);
420
422
  if (verbose) {
421
423
  console.log(`Executing the following pre-version command:`);
422
424
  console.log(preVersionCommand);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resetHandler = resetHandler;
4
- const fs_extra_1 = require("fs-extra");
4
+ const node_fs_1 = require("node:fs");
5
5
  const client_1 = require("../../daemon/client/client");
6
6
  const cache_directory_1 = require("../../utils/cache-directory");
7
7
  const output_1 = require("../../utils/output");
@@ -37,16 +37,16 @@ async function resetHandler(args) {
37
37
  try {
38
38
  await killDaemon();
39
39
  }
40
- catch {
41
- errors.push('Failed to stop the Nx Daemon.');
40
+ catch (e) {
41
+ errors.push('Failed to stop the Nx Daemon.', e.toString());
42
42
  }
43
43
  }
44
44
  if (all || args.onlyCache) {
45
45
  try {
46
46
  await cleanupCacheEntries();
47
47
  }
48
- catch {
49
- errors.push('Failed to clean up the cache directory.');
48
+ catch (e) {
49
+ errors.push('Failed to clean up the cache directory.', e.toString());
50
50
  }
51
51
  }
52
52
  if (all || args.onlyWorkspaceData) {
@@ -59,12 +59,17 @@ async function resetHandler(args) {
59
59
  try {
60
60
  await cleanupWorkspaceData();
61
61
  }
62
- catch {
63
- errors.push('Failed to clean up the workspace data directory.');
62
+ catch (e) {
63
+ errors.push('Failed to clean up the workspace data directory.', e.toString());
64
64
  }
65
65
  }
66
66
  if (all || args.onlyCloud) {
67
- await resetCloudClient();
67
+ try {
68
+ await resetCloudClient();
69
+ }
70
+ catch (e) {
71
+ errors.push('Failed to reset the Nx Cloud client.', e.toString());
72
+ }
68
73
  }
69
74
  if (errors.length > 0) {
70
75
  output_1.output.error({
@@ -79,8 +84,10 @@ async function resetHandler(args) {
79
84
  });
80
85
  }
81
86
  }
82
- function killDaemon() {
83
- return client_1.daemonClient.stop();
87
+ async function killDaemon() {
88
+ if (client_1.daemonClient.enabled()) {
89
+ return client_1.daemonClient.stop();
90
+ }
84
91
  }
85
92
  async function resetCloudClient() {
86
93
  // Remove nx cloud marker files. This helps if the use happens to run `nx-cloud start-ci-run` or
@@ -92,17 +99,17 @@ async function resetCloudClient() {
92
99
  }
93
100
  function cleanupCacheEntries() {
94
101
  return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
95
- (0, fs_extra_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
102
+ (0, node_fs_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
96
103
  });
97
104
  }
98
105
  function cleanupNativeFileCache() {
99
106
  return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
100
- (0, fs_extra_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
107
+ (0, node_fs_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
101
108
  });
102
109
  }
103
110
  function cleanupWorkspaceData() {
104
111
  return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
105
- (0, fs_extra_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
112
+ (0, node_fs_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
106
113
  });
107
114
  }
108
115
  async function incrementalBackoff(ms, maxDuration, callback) {