nx 19.8.1 → 19.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/.eslintrc.json +9 -1
  2. package/package.json +12 -13
  3. package/src/command-line/graph/graph.js +9 -9
  4. package/src/command-line/import/utils/prepare-source-repo.js +8 -3
  5. package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
  6. package/src/command-line/init/implementation/react/clean-up-files.js +7 -7
  7. package/src/command-line/init/implementation/react/index.js +19 -12
  8. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
  9. package/src/command-line/release/changelog.js +1 -2
  10. package/src/command-line/release/config/version-plans.js +6 -7
  11. package/src/command-line/release/plan.js +6 -5
  12. package/src/command-line/release/release.js +2 -2
  13. package/src/command-line/reset/reset.js +20 -13
  14. package/src/core/graph/main.js +1 -1
  15. package/src/daemon/cache.d.ts +1 -2
  16. package/src/daemon/cache.js +12 -21
  17. package/src/daemon/client/client.js +9 -8
  18. package/src/daemon/tmp-dir.js +6 -7
  19. package/src/executors/run-commands/run-commands.impl.js +15 -22
  20. package/src/generators/tree.d.ts +1 -1
  21. package/src/generators/tree.js +11 -11
  22. package/src/hasher/hash-task.d.ts +4 -2
  23. package/src/hasher/hash-task.js +6 -9
  24. package/src/native/nx.wasm32-wasi.wasm +0 -0
  25. package/src/plugins/js/index.js +1 -2
  26. package/src/project-graph/nx-deps-cache.js +5 -6
  27. package/src/tasks-runner/cache.js +17 -16
  28. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
  29. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
  30. package/src/tasks-runner/remove-old-cache-records.js +2 -3
  31. package/src/tasks-runner/run-command.js +3 -1
  32. package/src/tasks-runner/task-orchestrator.d.ts +1 -0
  33. package/src/tasks-runner/task-orchestrator.js +6 -2
  34. package/src/tasks-runner/tasks-schedule.d.ts +1 -0
  35. package/src/tasks-runner/tasks-schedule.js +6 -2
  36. package/src/utils/fileutils.d.ts +9 -1
  37. package/src/utils/fileutils.js +29 -12
  38. package/src/utils/ignore.js +2 -2
  39. package/src/utils/package-manager.js +2 -2
  40. package/src/utils/plugins/output.js +1 -1
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": "19.8.1",
3
+ "version": "19.8.3",
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",
@@ -68,7 +67,7 @@
68
67
  "yargs-parser": "21.1.1",
69
68
  "node-machine-id": "1.1.12",
70
69
  "ora": "5.3.0",
71
- "@nrwl/tao": "19.8.1"
70
+ "@nrwl/tao": "19.8.3"
72
71
  },
73
72
  "peerDependencies": {
74
73
  "@swc-node/register": "^1.8.0",
@@ -83,16 +82,16 @@
83
82
  }
84
83
  },
85
84
  "optionalDependencies": {
86
- "@nx/nx-darwin-x64": "19.8.1",
87
- "@nx/nx-darwin-arm64": "19.8.1",
88
- "@nx/nx-linux-x64-gnu": "19.8.1",
89
- "@nx/nx-linux-x64-musl": "19.8.1",
90
- "@nx/nx-win32-x64-msvc": "19.8.1",
91
- "@nx/nx-linux-arm64-gnu": "19.8.1",
92
- "@nx/nx-linux-arm64-musl": "19.8.1",
93
- "@nx/nx-linux-arm-gnueabihf": "19.8.1",
94
- "@nx/nx-win32-arm64-msvc": "19.8.1",
95
- "@nx/nx-freebsd-x64": "19.8.1"
85
+ "@nx/nx-darwin-x64": "19.8.3",
86
+ "@nx/nx-darwin-arm64": "19.8.3",
87
+ "@nx/nx-linux-x64-gnu": "19.8.3",
88
+ "@nx/nx-linux-x64-musl": "19.8.3",
89
+ "@nx/nx-win32-x64-msvc": "19.8.3",
90
+ "@nx/nx-linux-arm64-gnu": "19.8.3",
91
+ "@nx/nx-linux-arm64-musl": "19.8.3",
92
+ "@nx/nx-linux-arm-gnueabihf": "19.8.3",
93
+ "@nx/nx-win32-arm64-msvc": "19.8.3",
94
+ "@nx/nx-freebsd-x64": "19.8.3"
96
95
  },
97
96
  "nx-migrations": {
98
97
  "migrations": "./migrations.json",
@@ -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
  }
@@ -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) {