nx 19.8.0 → 19.8.2

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 (86) hide show
  1. package/.eslintrc.json +11 -2
  2. package/bin/nx.js +10 -2
  3. package/package.json +12 -13
  4. package/schemas/nx-schema.json +26 -21
  5. package/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +1 -0
  7. package/src/command-line/activate-powerpack/activate-powerpack.js +3 -1
  8. package/src/command-line/add/add.js +4 -2
  9. package/src/command-line/connect/view-logs.js +1 -0
  10. package/src/command-line/exec/exec.js +6 -1
  11. package/src/command-line/format/format.js +3 -1
  12. package/src/command-line/graph/graph.js +10 -9
  13. package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
  14. package/src/command-line/init/implementation/angular/integrated-workspace.js +4 -1
  15. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -2
  16. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +3 -1
  17. package/src/command-line/init/implementation/dot-nx/nxw.js +1 -0
  18. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +3 -1
  19. package/src/command-line/init/implementation/react/clean-up-files.js +7 -7
  20. package/src/command-line/init/implementation/react/index.js +36 -17
  21. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
  22. package/src/command-line/init/implementation/utils.js +5 -1
  23. package/src/command-line/init/init-v1.js +1 -0
  24. package/src/command-line/init/init-v2.js +2 -1
  25. package/src/command-line/migrate/command-object.js +4 -0
  26. package/src/command-line/migrate/migrate.js +1 -1
  27. package/src/command-line/release/changelog.js +1 -2
  28. package/src/command-line/release/config/version-plans.js +9 -8
  29. package/src/command-line/release/plan.js +6 -5
  30. package/src/command-line/release/release.js +2 -2
  31. package/src/command-line/release/utils/exec-command.js +1 -0
  32. package/src/command-line/release/utils/github.js +1 -0
  33. package/src/command-line/release/utils/launch-editor.js +6 -1
  34. package/src/command-line/release/version.js +6 -3
  35. package/src/command-line/report/report.d.ts +3 -1
  36. package/src/command-line/report/report.js +17 -2
  37. package/src/command-line/reset/reset.js +4 -4
  38. package/src/command-line/run/run.js +1 -0
  39. package/src/command-line/sync/sync.js +5 -4
  40. package/src/command-line/watch/watch.js +1 -0
  41. package/src/config/nx-json.d.ts +4 -0
  42. package/src/daemon/cache.d.ts +1 -2
  43. package/src/daemon/cache.js +12 -21
  44. package/src/daemon/client/client.d.ts +4 -1
  45. package/src/daemon/client/client.js +9 -8
  46. package/src/daemon/client/generate-help-output.js +1 -0
  47. package/src/daemon/server/sync-generators.d.ts +4 -1
  48. package/src/daemon/server/sync-generators.js +33 -15
  49. package/src/daemon/tmp-dir.js +6 -7
  50. package/src/executors/run-commands/run-commands.impl.js +1 -0
  51. package/src/executors/run-script/run-script.impl.js +1 -0
  52. package/src/generators/tree.d.ts +1 -1
  53. package/src/generators/tree.js +11 -11
  54. package/src/native/index.d.ts +1 -1
  55. package/src/native/nx.wasm32-wasi.wasm +0 -0
  56. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  57. package/src/plugins/js/index.js +1 -2
  58. package/src/project-graph/file-utils.js +1 -0
  59. package/src/project-graph/nx-deps-cache.js +5 -6
  60. package/src/tasks-runner/cache.d.ts +3 -1
  61. package/src/tasks-runner/cache.js +29 -29
  62. package/src/tasks-runner/default-tasks-runner.js +1 -1
  63. package/src/tasks-runner/life-cycles/formatting-utils.d.ts +1 -1
  64. package/src/tasks-runner/life-cycles/formatting-utils.js +27 -15
  65. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +3 -0
  66. package/src/tasks-runner/remove-old-cache-records.js +2 -3
  67. package/src/tasks-runner/task-orchestrator.d.ts +3 -1
  68. package/src/tasks-runner/task-orchestrator.js +3 -2
  69. package/src/tasks-runner/tasks-schedule.js +1 -1
  70. package/src/utils/ab-testing.js +4 -1
  71. package/src/utils/child-process.js +5 -3
  72. package/src/utils/command-line-utils.js +7 -1
  73. package/src/utils/default-base.js +5 -2
  74. package/src/utils/fileutils.d.ts +9 -1
  75. package/src/utils/fileutils.js +29 -12
  76. package/src/utils/git-utils.index-filter.js +2 -1
  77. package/src/utils/git-utils.js +4 -0
  78. package/src/utils/git-utils.tree-filter.js +3 -1
  79. package/src/utils/ignore.js +2 -2
  80. package/src/utils/package-manager.js +2 -2
  81. package/src/utils/powerpack.d.ts +1 -1
  82. package/src/utils/powerpack.js +3 -8
  83. package/src/utils/sync-generators.d.ts +13 -3
  84. package/src/utils/sync-generators.js +99 -25
  85. package/src/utils/task-history.d.ts +2 -2
  86. package/src/utils/task-history.js +4 -1
@@ -59,6 +59,7 @@ function deduceDefaultBase() {
59
59
  try {
60
60
  (0, child_process_1.execSync)(`git rev-parse --verify main`, {
61
61
  stdio: ['ignore', 'ignore', 'ignore'],
62
+ windowsHide: true,
62
63
  });
63
64
  return 'main';
64
65
  }
@@ -66,6 +67,7 @@ function deduceDefaultBase() {
66
67
  try {
67
68
  (0, child_process_1.execSync)(`git rev-parse --verify dev`, {
68
69
  stdio: ['ignore', 'ignore', 'ignore'],
70
+ windowsHide: true,
69
71
  });
70
72
  return 'dev';
71
73
  }
@@ -73,6 +75,7 @@ function deduceDefaultBase() {
73
75
  try {
74
76
  (0, child_process_1.execSync)(`git rev-parse --verify develop`, {
75
77
  stdio: ['ignore', 'ignore', 'ignore'],
78
+ windowsHide: true,
76
79
  });
77
80
  return 'develop';
78
81
  }
@@ -80,6 +83,7 @@ function deduceDefaultBase() {
80
83
  try {
81
84
  (0, child_process_1.execSync)(`git rev-parse --verify next`, {
82
85
  stdio: ['ignore', 'ignore', 'ignore'],
86
+ windowsHide: true,
83
87
  });
84
88
  return 'next';
85
89
  }
@@ -128,7 +132,7 @@ function updateGitIgnore(root) {
128
132
  catch { }
129
133
  }
130
134
  function runInstall(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
131
- (0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot });
135
+ (0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot, windowsHide: true });
132
136
  }
133
137
  async function initCloud(installationSource) {
134
138
  const token = await (0, connect_to_nx_cloud_2.connectWorkspaceToCloud)({
@@ -87,6 +87,7 @@ async function initHandler(options) {
87
87
  else {
88
88
  (0, child_process_1.execSync)(`npx --yes create-nx-workspace@${version} ${args}`, {
89
89
  stdio: [0, 1, 2],
90
+ windowsHide: true,
90
91
  });
91
92
  }
92
93
  }
@@ -29,9 +29,10 @@ function installPlugins(repoRoot, plugins, pmc, updatePackageScripts) {
29
29
  (0, utils_1.runInstall)(repoRoot, pmc);
30
30
  output_1.output.log({ title: '🔨 Configuring plugins' });
31
31
  for (const plugin of plugins) {
32
- (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''} --no-interactive`, {
32
+ (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''}`, {
33
33
  stdio: [0, 1, 2],
34
34
  cwd: repoRoot,
35
+ windowsHide: true,
35
36
  });
36
37
  }
37
38
  }
@@ -101,6 +101,7 @@ function runMigration() {
101
101
  }
102
102
  (0, child_process_2.execSync)(`${p} _migrate ${process.argv.slice(3).join(' ')}`, {
103
103
  stdio: ['inherit', 'inherit', 'inherit'],
104
+ windowsHide: true,
104
105
  });
105
106
  }
106
107
  }
@@ -127,18 +128,21 @@ function nxCliPath() {
127
128
  (0, child_process_2.execSync)(pmc.preInstall, {
128
129
  cwd: tmpDir,
129
130
  stdio: ['ignore', 'ignore', 'ignore'],
131
+ windowsHide: true,
130
132
  });
131
133
  // if it's berry ensure we set the node_linker to node-modules
132
134
  if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
133
135
  (0, child_process_2.execSync)('yarn config set nodeLinker node-modules', {
134
136
  cwd: tmpDir,
135
137
  stdio: ['ignore', 'ignore', 'ignore'],
138
+ windowsHide: true,
136
139
  });
137
140
  }
138
141
  }
139
142
  (0, child_process_2.execSync)(pmc.install, {
140
143
  cwd: tmpDir,
141
144
  stdio: ['ignore', 'ignore', 'ignore'],
145
+ windowsHide: true,
142
146
  });
143
147
  // Set NODE_PATH so that these modules can be used for module resolution
144
148
  addToNodePath(path.join(tmpDir, 'node_modules'));
@@ -886,7 +886,7 @@ function runInstall() {
886
886
  output_1.output.log({
887
887
  title: `Running '${pmCommands.install}' to make sure necessary packages are installed`,
888
888
  });
889
- (0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2] });
889
+ (0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2], windowsHide: true });
890
890
  }
891
891
  async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix) {
892
892
  let initialDeps = getStringifiedPackageJsonDeps(root);
@@ -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,
@@ -191,7 +190,9 @@ function isReleaseType(value) {
191
190
  }
192
191
  async function getCommitForVersionPlanFile(rawVersionPlan, isVerbose) {
193
192
  return new Promise((resolve) => {
194
- (0, node_child_process_1.exec)(`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`, (error, stdout, stderr) => {
193
+ (0, node_child_process_1.exec)(`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`, {
194
+ windowsHide: true,
195
+ }, (error, stdout, stderr) => {
195
196
  if (error) {
196
197
  if (isVerbose) {
197
198
  console.error(`Error executing git command for ${rawVersionPlan.relativePath}: ${error.message}`);
@@ -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
  }
@@ -8,6 +8,7 @@ async function execCommand(cmd, args, options) {
8
8
  ...options,
9
9
  stdio: ['pipe', 'pipe', 'pipe'], // stdin, stdout, stderr
10
10
  encoding: 'utf-8',
11
+ windowsHide: true,
11
12
  });
12
13
  let stdout = '';
13
14
  let stderr = '';
@@ -255,6 +255,7 @@ async function resolveGithubToken(hostname) {
255
255
  return (0, node_child_process_1.execSync)(`gh auth token`, {
256
256
  encoding: 'utf8',
257
257
  stdio: 'pipe',
258
+ windowsHide: true,
258
259
  }).trim();
259
260
  }
260
261
  }
@@ -13,6 +13,7 @@ async function launchEditor(filePath) {
13
13
  return new Promise((resolve, reject) => {
14
14
  const editorProcess = (0, node_child_process_1.spawn)(cmd, [...args, filePath], {
15
15
  stdio: 'inherit', // This will ensure the editor uses the current terminal
16
+ windowsHide: true,
16
17
  });
17
18
  editorProcess.on('exit', (code) => {
18
19
  if (code === 0) {
@@ -26,7 +27,11 @@ async function launchEditor(filePath) {
26
27
  }
27
28
  function getGitConfig(key) {
28
29
  try {
29
- return (0, node_child_process_1.execSync)(`git config --get ${key}`).toString().trim();
30
+ return (0, node_child_process_1.execSync)(`git config --get ${key}`, {
31
+ windowsHide: true,
32
+ })
33
+ .toString()
34
+ .trim();
30
35
  }
31
36
  catch {
32
37
  return null;
@@ -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);
@@ -434,6 +436,7 @@ function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
434
436
  maxBuffer: LARGE_BUFFER,
435
437
  stdio,
436
438
  env,
439
+ windowsHide: true,
437
440
  });
438
441
  }
439
442
  catch (e) {
@@ -1,6 +1,7 @@
1
1
  import { PackageManager } from '../../utils/package-manager';
2
2
  import { PackageJson } from '../../utils/package-json';
3
3
  import { NxJsonConfiguration } from '../../config/nx-json';
4
+ import type { PowerpackLicense } from '@nx/powerpack-license';
4
5
  export declare const packagesWeCareAbout: string[];
5
6
  export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
6
7
  /**
@@ -15,7 +16,8 @@ export declare function reportHandler(): Promise<void>;
15
16
  export interface ReportData {
16
17
  pm: PackageManager;
17
18
  pmVersion: string;
18
- powerpackLicense: any | null;
19
+ powerpackLicense: PowerpackLicense | null;
20
+ powerpackError: Error | null;
19
21
  powerpackPlugins: PackageJson[];
20
22
  localPlugins: string[];
21
23
  communityPlugins: PackageJson[];
@@ -46,7 +46,7 @@ const LINE_SEPARATOR = '---------------------------------------';
46
46
  *
47
47
  */
48
48
  async function reportHandler() {
49
- const { pm, pmVersion, powerpackLicense, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
49
+ const { pm, pmVersion, powerpackLicense, powerpackError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
50
50
  const fields = [
51
51
  ['Node', process.versions.node],
52
52
  ['OS', `${process.platform}-${process.arch}`],
@@ -62,6 +62,7 @@ async function reportHandler() {
62
62
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
63
63
  });
64
64
  if (powerpackLicense) {
65
+ bodyLines.push('');
65
66
  bodyLines.push(LINE_SEPARATOR);
66
67
  bodyLines.push(chalk.green('Nx Powerpack'));
67
68
  bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''} until ${new Date(powerpackLicense.expiresAt * 1000).toLocaleDateString()}`);
@@ -71,6 +72,14 @@ async function reportHandler() {
71
72
  for (const powerpackPlugin of powerpackPlugins) {
72
73
  bodyLines.push(`${chalk.green(powerpackPlugin.name.padEnd(padding))} : ${chalk.bold(powerpackPlugin.version)}`);
73
74
  }
75
+ bodyLines.push('');
76
+ }
77
+ else if (powerpackError) {
78
+ bodyLines.push('');
79
+ bodyLines.push(chalk.red('Nx Powerpack'));
80
+ bodyLines.push(LINE_SEPARATOR);
81
+ bodyLines.push(powerpackError.message);
82
+ bodyLines.push('');
74
83
  }
75
84
  if (registeredPlugins.length) {
76
85
  bodyLines.push(LINE_SEPARATOR);
@@ -137,13 +146,19 @@ async function getReportData() {
137
146
  const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
138
147
  const native = isNativeAvailable();
139
148
  let powerpackLicense = null;
149
+ let powerpackError = null;
140
150
  try {
141
151
  powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
142
152
  }
143
- catch { }
153
+ catch (e) {
154
+ if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
155
+ powerpackError = e;
156
+ }
157
+ }
144
158
  return {
145
159
  pm,
146
160
  powerpackLicense,
161
+ powerpackError,
147
162
  powerpackPlugins,
148
163
  pmVersion,
149
164
  localPlugins,
@@ -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");
@@ -92,17 +92,17 @@ async function resetCloudClient() {
92
92
  }
93
93
  function cleanupCacheEntries() {
94
94
  return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
95
- (0, fs_extra_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
95
+ (0, node_fs_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
96
96
  });
97
97
  }
98
98
  function cleanupNativeFileCache() {
99
99
  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 });
100
+ (0, node_fs_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
101
101
  });
102
102
  }
103
103
  function cleanupWorkspaceData() {
104
104
  return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
105
- (0, fs_extra_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
105
+ (0, node_fs_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
106
106
  });
107
107
  }
108
108
  async function incrementalBackoff(ms, maxDuration, callback) {
@@ -77,6 +77,7 @@ async function printTargetRunHelpInternal({ project, target }, root, projectsCon
77
77
  else {
78
78
  const cp = (0, child_process_1.exec)(helpCommand, {
79
79
  env,
80
+ windowsHide: true,
80
81
  });
81
82
  cp.on('exit', (code) => {
82
83
  process.exit(code);
@@ -12,8 +12,8 @@ function syncHandler(options) {
12
12
  return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
13
13
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
14
14
  const nxJson = (0, nx_json_1.readNxJson)();
15
- const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph, nxJson);
16
- if (!syncGenerators.length) {
15
+ const { globalGenerators, taskGenerators } = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph, nxJson);
16
+ if (!globalGenerators.length && !taskGenerators.length) {
17
17
  output_1.output.success({
18
18
  title: options.check
19
19
  ? 'The workspace is up to date'
@@ -22,6 +22,7 @@ function syncHandler(options) {
22
22
  });
23
23
  return 0;
24
24
  }
25
+ const syncGenerators = Array.from(new Set([...globalGenerators, ...taskGenerators]));
25
26
  const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);
26
27
  if (!results.length) {
27
28
  output_1.output.success({
@@ -33,7 +34,7 @@ function syncHandler(options) {
33
34
  return 0;
34
35
  }
35
36
  const { failedGeneratorsCount, areAllResultsFailures, anySyncGeneratorsFailed, } = (0, sync_generators_1.processSyncGeneratorResultErrors)(results);
36
- const failedSyncGeneratorsFixMessageLines = (0, sync_generators_1.getFailedSyncGeneratorsFixMessageLines)(results, options.verbose);
37
+ const failedSyncGeneratorsFixMessageLines = (0, sync_generators_1.getFailedSyncGeneratorsFixMessageLines)(results, options.verbose, new Set(globalGenerators));
37
38
  if (areAllResultsFailures) {
38
39
  output_1.output.error({
39
40
  title: `The workspace is probably out of sync because ${failedGeneratorsCount === 1
@@ -71,7 +72,7 @@ function syncHandler(options) {
71
72
  spinner.fail();
72
73
  output_1.output.error({
73
74
  title: 'Failed to sync the workspace',
74
- bodyLines: (0, sync_generators_1.getFlushFailureMessageLines)(flushResult, options.verbose),
75
+ bodyLines: (0, sync_generators_1.getFlushFailureMessageLines)(flushResult, options.verbose, new Set(globalGenerators)),
75
76
  });
76
77
  return 1;
77
78
  }
@@ -97,6 +97,7 @@ class BatchCommandRunner extends BatchFunctionRunner {
97
97
  [this.projectNameEnv]: env[this.projectNameEnv],
98
98
  [this.fileChangesEnv]: env[this.fileChangesEnv],
99
99
  },
100
+ windowsHide: true,
100
101
  });
101
102
  commandExec.on('close', () => {
102
103
  resolve();
@@ -462,6 +462,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
462
462
  * Configuration for the `nx sync` command.
463
463
  */
464
464
  sync?: NxSyncConfiguration;
465
+ /**
466
+ * Enable the new experimental db based cache
467
+ */
468
+ enableDbCache?: boolean;
465
469
  }
466
470
  export type PluginConfiguration = string | ExpandedPluginConfiguration;
467
471
  export type ExpandedPluginConfiguration<T = unknown> = {
@@ -2,9 +2,8 @@ export interface DaemonProcessJson {
2
2
  processId: number;
3
3
  }
4
4
  export declare const serverProcessJsonPath: string;
5
- export declare function readDaemonProcessJsonCache(): Promise<DaemonProcessJson | null>;
5
+ export declare function readDaemonProcessJsonCache(): DaemonProcessJson | null;
6
6
  export declare function deleteDaemonJsonProcessCache(): void;
7
7
  export declare function writeDaemonJsonProcessCache(daemonJson: DaemonProcessJson): Promise<void>;
8
8
  export declare function waitForDaemonToExitAndCleanupProcessJson(): Promise<void>;
9
- export declare function safelyCleanUpExistingProcess(): Promise<void>;
10
9
  export declare function getDaemonProcessIdSync(): number | null;
@@ -5,31 +5,33 @@ exports.readDaemonProcessJsonCache = readDaemonProcessJsonCache;
5
5
  exports.deleteDaemonJsonProcessCache = deleteDaemonJsonProcessCache;
6
6
  exports.writeDaemonJsonProcessCache = writeDaemonJsonProcessCache;
7
7
  exports.waitForDaemonToExitAndCleanupProcessJson = waitForDaemonToExitAndCleanupProcessJson;
8
- exports.safelyCleanUpExistingProcess = safelyCleanUpExistingProcess;
9
8
  exports.getDaemonProcessIdSync = getDaemonProcessIdSync;
10
- const fs_extra_1 = require("fs-extra");
9
+ const node_fs_1 = require("node:fs");
11
10
  const path_1 = require("path");
12
11
  const tmp_dir_1 = require("./tmp-dir");
12
+ const fileutils_1 = require("../utils/fileutils");
13
13
  exports.serverProcessJsonPath = (0, path_1.join)(tmp_dir_1.DAEMON_DIR_FOR_CURRENT_WORKSPACE, 'server-process.json');
14
- async function readDaemonProcessJsonCache() {
15
- if (!(0, fs_extra_1.existsSync)(exports.serverProcessJsonPath)) {
14
+ function readDaemonProcessJsonCache() {
15
+ if (!(0, node_fs_1.existsSync)(exports.serverProcessJsonPath)) {
16
16
  return null;
17
17
  }
18
- return await (0, fs_extra_1.readJson)(exports.serverProcessJsonPath);
18
+ return (0, fileutils_1.readJsonFile)(exports.serverProcessJsonPath);
19
19
  }
20
20
  function deleteDaemonJsonProcessCache() {
21
21
  try {
22
22
  if (getDaemonProcessIdSync() === process.pid) {
23
- (0, fs_extra_1.unlinkSync)(exports.serverProcessJsonPath);
23
+ (0, node_fs_1.unlinkSync)(exports.serverProcessJsonPath);
24
24
  }
25
25
  }
26
26
  catch { }
27
27
  }
28
28
  async function writeDaemonJsonProcessCache(daemonJson) {
29
- await (0, fs_extra_1.writeJson)(exports.serverProcessJsonPath, daemonJson);
29
+ await (0, fileutils_1.writeJsonFileAsync)(exports.serverProcessJsonPath, daemonJson, {
30
+ appendNewLine: true,
31
+ });
30
32
  }
31
33
  async function waitForDaemonToExitAndCleanupProcessJson() {
32
- const daemonProcessJson = await readDaemonProcessJsonCache();
34
+ const daemonProcessJson = readDaemonProcessJsonCache();
33
35
  if (daemonProcessJson && daemonProcessJson.processId) {
34
36
  await new Promise((resolve, reject) => {
35
37
  let count = 0;
@@ -51,24 +53,13 @@ async function waitForDaemonToExitAndCleanupProcessJson() {
51
53
  deleteDaemonJsonProcessCache();
52
54
  }
53
55
  }
54
- async function safelyCleanUpExistingProcess() {
55
- const daemonProcessJson = await readDaemonProcessJsonCache();
56
- if (daemonProcessJson && daemonProcessJson.processId) {
57
- try {
58
- process.kill(daemonProcessJson.processId);
59
- // we wait for the process to actually shut down before returning
60
- await waitForDaemonToExitAndCleanupProcessJson();
61
- }
62
- catch { }
63
- }
64
- }
65
56
  // Must be sync for the help output use case
66
57
  function getDaemonProcessIdSync() {
67
- if (!(0, fs_extra_1.existsSync)(exports.serverProcessJsonPath)) {
58
+ if (!(0, node_fs_1.existsSync)(exports.serverProcessJsonPath)) {
68
59
  return null;
69
60
  }
70
61
  try {
71
- const daemonProcessJson = (0, fs_extra_1.readJsonSync)(exports.serverProcessJsonPath);
62
+ const daemonProcessJson = (0, fileutils_1.readJsonFile)(exports.serverProcessJsonPath);
72
63
  return daemonProcessJson.processId;
73
64
  }
74
65
  catch {
@@ -55,7 +55,10 @@ export declare class DaemonClient {
55
55
  recordTaskRuns(taskRuns: TaskRun[]): Promise<void>;
56
56
  getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorRunResult[]>;
57
57
  flushSyncGeneratorChangesToDisk(generators: string[]): Promise<FlushSyncGeneratorChangesResult>;
58
- getRegisteredSyncGenerators(): Promise<string[]>;
58
+ getRegisteredSyncGenerators(): Promise<{
59
+ globalGenerators: string[];
60
+ taskGenerators: string[];
61
+ }>;
59
62
  updateWorkspaceContext(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
60
63
  isServerAvailable(): Promise<boolean>;
61
64
  private sendToDaemonViaQueue;
@@ -4,9 +4,8 @@ exports.daemonClient = exports.DaemonClient = void 0;
4
4
  exports.isDaemonEnabled = isDaemonEnabled;
5
5
  const workspace_root_1 = require("../../utils/workspace-root");
6
6
  const child_process_1 = require("child_process");
7
- const fs_1 = require("fs");
7
+ const node_fs_1 = require("node:fs");
8
8
  const promises_1 = require("fs/promises");
9
- const fs_extra_1 = require("fs-extra");
10
9
  const net_1 = require("net");
11
10
  const path_1 = require("path");
12
11
  const perf_hooks_1 = require("perf_hooks");
@@ -409,8 +408,10 @@ class DaemonClient {
409
408
  }
410
409
  }
411
410
  async startInBackground() {
412
- (0, fs_extra_1.ensureDirSync)(tmp_dir_1.DAEMON_DIR_FOR_CURRENT_WORKSPACE);
413
- (0, fs_extra_1.ensureFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE);
411
+ (0, node_fs_1.mkdirSync)(tmp_dir_1.DAEMON_DIR_FOR_CURRENT_WORKSPACE, { recursive: true });
412
+ if (!(0, node_fs_1.existsSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE)) {
413
+ (0, node_fs_1.writeFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, '');
414
+ }
414
415
  this._out = await (0, promises_1.open)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
415
416
  this._err = await (0, promises_1.open)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE, 'a');
416
417
  const backgroundProcess = (0, child_process_1.spawn)(process.execPath, [(0, path_1.join)(__dirname, `../server/start.js`)], {
@@ -454,7 +455,7 @@ class DaemonClient {
454
455
  catch (err) {
455
456
  output_1.output.error({
456
457
  title: err?.message ||
457
- 'Something unexpected went wrong when stopping the server',
458
+ 'Something unexpected went wrong when stopping the daemon server',
458
459
  });
459
460
  }
460
461
  (0, tmp_dir_1.removeSocketDir)();
@@ -467,12 +468,12 @@ function isDaemonEnabled() {
467
468
  }
468
469
  function isDocker() {
469
470
  try {
470
- (0, fs_1.statSync)('/.dockerenv');
471
+ (0, node_fs_1.statSync)('/.dockerenv');
471
472
  return true;
472
473
  }
473
474
  catch {
474
475
  try {
475
- return (0, fs_1.readFileSync)('/proc/self/cgroup', 'utf8')?.includes('docker');
476
+ return (0, node_fs_1.readFileSync)('/proc/self/cgroup', 'utf8')?.includes('docker');
476
477
  }
477
478
  catch { }
478
479
  return false;
@@ -483,7 +484,7 @@ function nxJsonIsNotPresent() {
483
484
  }
484
485
  function daemonProcessException(message) {
485
486
  try {
486
- let log = (0, fs_1.readFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE).toString().split('\n');
487
+ let log = (0, node_fs_1.readFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE).toString().split('\n');
487
488
  if (log.length > 20) {
488
489
  log = log.slice(log.length - 20);
489
490
  }
@@ -11,6 +11,7 @@ function generateDaemonHelpOutput() {
11
11
  */
12
12
  const res = (0, child_process_1.spawnSync)(process.execPath, ['./exec-is-server-available.js'], {
13
13
  cwd: __dirname,
14
+ windowsHide: true,
14
15
  });
15
16
  const isServerAvailable = res?.stdout?.toString().trim().indexOf('true') > -1;
16
17
  if (!isServerAvailable) {
@@ -3,7 +3,10 @@ import { type FlushSyncGeneratorChangesResult, type SyncGeneratorRunResult } fro
3
3
  export declare function getCachedSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorRunResult[]>;
4
4
  export declare function flushSyncGeneratorChangesToDisk(generators: string[]): Promise<FlushSyncGeneratorChangesResult>;
5
5
  export declare function collectAndScheduleSyncGenerators(projectGraph: ProjectGraph): void;
6
- export declare function getCachedRegisteredSyncGenerators(): Promise<string[]>;
6
+ export declare function getCachedRegisteredSyncGenerators(): Promise<{
7
+ globalGenerators: string[];
8
+ taskGenerators: string[];
9
+ }>;
7
10
  /**
8
11
  * @internal
9
12
  */