nx 20.0.0-beta.0 → 20.0.0-beta.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 (64) hide show
  1. package/.eslintrc.json +2 -1
  2. package/bin/nx.js +10 -2
  3. package/package.json +12 -12
  4. package/src/adapter/compat.d.ts +1 -1
  5. package/src/adapter/compat.js +1 -0
  6. package/src/command-line/activate-powerpack/activate-powerpack.js +3 -1
  7. package/src/command-line/add/add.js +4 -2
  8. package/src/command-line/connect/view-logs.js +1 -0
  9. package/src/command-line/exec/exec.js +6 -1
  10. package/src/command-line/format/format.js +3 -1
  11. package/src/command-line/graph/graph.js +1 -0
  12. package/src/command-line/init/implementation/angular/integrated-workspace.js +4 -1
  13. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -2
  14. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +3 -1
  15. package/src/command-line/init/implementation/dot-nx/nxw.js +1 -0
  16. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +3 -1
  17. package/src/command-line/init/implementation/react/index.js +17 -5
  18. package/src/command-line/init/implementation/utils.js +5 -1
  19. package/src/command-line/init/init-v1.js +1 -0
  20. package/src/command-line/init/init-v2.js +2 -1
  21. package/src/command-line/migrate/command-object.js +4 -0
  22. package/src/command-line/migrate/migrate.js +1 -1
  23. package/src/command-line/release/config/version-plans.js +3 -1
  24. package/src/command-line/release/utils/exec-command.js +1 -0
  25. package/src/command-line/release/utils/github.js +1 -0
  26. package/src/command-line/release/utils/launch-editor.js +6 -1
  27. package/src/command-line/release/version.js +1 -0
  28. package/src/command-line/report/report.d.ts +3 -1
  29. package/src/command-line/report/report.js +17 -2
  30. package/src/command-line/run/run.js +1 -0
  31. package/src/command-line/sync/sync.js +5 -4
  32. package/src/command-line/watch/watch.js +1 -0
  33. package/src/config/nx-json.d.ts +4 -0
  34. package/src/daemon/client/client.d.ts +4 -1
  35. package/src/daemon/client/generate-help-output.js +1 -0
  36. package/src/daemon/server/sync-generators.d.ts +4 -1
  37. package/src/daemon/server/sync-generators.js +33 -15
  38. package/src/executors/run-commands/run-commands.impl.js +1 -0
  39. package/src/executors/run-script/run-script.impl.js +1 -0
  40. package/src/native/nx.wasm32-wasi.wasm +0 -0
  41. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  42. package/src/project-graph/file-utils.js +1 -0
  43. package/src/tasks-runner/cache.d.ts +3 -1
  44. package/src/tasks-runner/cache.js +12 -13
  45. package/src/tasks-runner/default-tasks-runner.js +1 -1
  46. package/src/tasks-runner/life-cycles/formatting-utils.d.ts +1 -1
  47. package/src/tasks-runner/life-cycles/formatting-utils.js +27 -15
  48. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +3 -0
  49. package/src/tasks-runner/task-orchestrator.d.ts +3 -1
  50. package/src/tasks-runner/task-orchestrator.js +3 -2
  51. package/src/tasks-runner/tasks-schedule.js +1 -1
  52. package/src/utils/ab-testing.js +4 -1
  53. package/src/utils/child-process.js +5 -3
  54. package/src/utils/command-line-utils.js +7 -1
  55. package/src/utils/default-base.js +5 -2
  56. package/src/utils/git-utils.index-filter.js +2 -1
  57. package/src/utils/git-utils.js +4 -0
  58. package/src/utils/git-utils.tree-filter.js +3 -1
  59. package/src/utils/powerpack.d.ts +1 -1
  60. package/src/utils/powerpack.js +3 -8
  61. package/src/utils/sync-generators.d.ts +13 -3
  62. package/src/utils/sync-generators.js +99 -25
  63. package/src/utils/task-history.d.ts +2 -2
  64. package/src/utils/task-history.js +4 -1
@@ -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
  */
@@ -72,11 +72,16 @@ function collectAndScheduleSyncGenerators(projectGraph) {
72
72
  // a change imply we need to re-run all the generators
73
73
  // make sure to schedule all the collected generators
74
74
  scheduledGenerators.clear();
75
- if (!registeredSyncGenerators.size) {
75
+ if (!registeredSyncGenerators.globalGenerators.size &&
76
+ !registeredSyncGenerators.taskGenerators.size) {
76
77
  // there are no generators to run
77
78
  return;
78
79
  }
79
- for (const generator of registeredSyncGenerators) {
80
+ const uniqueSyncGenerators = new Set([
81
+ ...registeredSyncGenerators.globalGenerators,
82
+ ...registeredSyncGenerators.taskGenerators,
83
+ ]);
84
+ for (const generator of uniqueSyncGenerators) {
80
85
  scheduledGenerators.add(generator);
81
86
  }
82
87
  log('scheduling:', [...scheduledGenerators]);
@@ -102,7 +107,7 @@ function collectAndScheduleSyncGenerators(projectGraph) {
102
107
  }
103
108
  async function getCachedRegisteredSyncGenerators() {
104
109
  log('get registered sync generators');
105
- if (!registeredSyncGenerators) {
110
+ if (!registeredGlobalSyncGenerators && !registeredTaskSyncGenerators) {
106
111
  log('no registered sync generators, collecting them');
107
112
  const { projectGraph } = await (0, project_graph_incremental_recomputation_1.getCachedSerializedProjectGraphPromise)();
108
113
  collectAllRegisteredSyncGenerators(projectGraph);
@@ -110,7 +115,10 @@ async function getCachedRegisteredSyncGenerators() {
110
115
  else {
111
116
  log('registered sync generators already collected, returning them');
112
117
  }
113
- return [...registeredSyncGenerators];
118
+ return {
119
+ globalGenerators: [...registeredGlobalSyncGenerators],
120
+ taskGenerators: [...registeredTaskSyncGenerators],
121
+ };
114
122
  }
115
123
  async function getFromCacheOrRunGenerators(generators) {
116
124
  let projects;
@@ -296,23 +304,33 @@ function collectAllRegisteredSyncGenerators(projectGraph) {
296
304
  else {
297
305
  log('nx.json hash is the same, not collecting global sync generators');
298
306
  }
299
- const generators = new Set([
300
- ...registeredTaskSyncGenerators,
301
- ...registeredGlobalSyncGenerators,
302
- ]);
303
307
  if (!registeredSyncGenerators) {
304
- registeredSyncGenerators = generators;
308
+ registeredSyncGenerators = {
309
+ globalGenerators: registeredGlobalSyncGenerators,
310
+ taskGenerators: registeredTaskSyncGenerators,
311
+ };
305
312
  return;
306
313
  }
307
- for (const generator of registeredSyncGenerators) {
308
- if (!generators.has(generator)) {
309
- registeredSyncGenerators.delete(generator);
314
+ for (const generator of registeredSyncGenerators.globalGenerators) {
315
+ if (!registeredGlobalSyncGenerators.has(generator)) {
316
+ registeredSyncGenerators.globalGenerators.delete(generator);
310
317
  syncGeneratorsCacheResultPromises.delete(generator);
311
318
  }
312
319
  }
313
- for (const generator of generators) {
314
- if (!registeredSyncGenerators.has(generator)) {
315
- registeredSyncGenerators.add(generator);
320
+ for (const generator of registeredSyncGenerators.taskGenerators) {
321
+ if (!registeredTaskSyncGenerators.has(generator)) {
322
+ registeredSyncGenerators.taskGenerators.delete(generator);
323
+ syncGeneratorsCacheResultPromises.delete(generator);
324
+ }
325
+ }
326
+ for (const generator of registeredGlobalSyncGenerators) {
327
+ if (!registeredSyncGenerators.globalGenerators.has(generator)) {
328
+ registeredSyncGenerators.globalGenerators.add(generator);
329
+ }
330
+ }
331
+ for (const generator of registeredTaskSyncGenerators) {
332
+ if (!registeredSyncGenerators.taskGenerators.has(generator)) {
333
+ registeredSyncGenerators.taskGenerators.add(generator);
316
334
  }
317
335
  }
318
336
  }
@@ -231,6 +231,7 @@ function nodeProcess(commandConfig, cwd, env, readyWhenStatus, streamOutput = tr
231
231
  maxBuffer: exports.LARGE_BUFFER,
232
232
  env,
233
233
  cwd,
234
+ windowsHide: true,
234
235
  });
235
236
  childProcesses.add(childProcess);
236
237
  childProcess.stdout.on('data', (data) => {
@@ -35,6 +35,7 @@ function nodeProcess(command, cwd, env) {
35
35
  stdio: ['inherit', 'inherit', 'inherit'],
36
36
  cwd,
37
37
  env,
38
+ windowsHide: true,
38
39
  });
39
40
  }
40
41
  async function ptyProcess(command, cwd, env) {
Binary file
@@ -32,7 +32,7 @@ function getRootPackageName(tree) {
32
32
  }
33
33
  function getNxInitDate() {
34
34
  try {
35
- const nxInitIso = (0, child_process_1.execSync)('git log --diff-filter=A --follow --format=%aI -- nx.json | tail -1', { stdio: 'pipe' })
35
+ const nxInitIso = (0, child_process_1.execSync)('git log --diff-filter=A --follow --format=%aI -- nx.json | tail -1', { stdio: 'pipe', windowsHide: true })
36
36
  .toString()
37
37
  .trim();
38
38
  const nxInitDate = new Date(nxInitIso);
@@ -91,6 +91,7 @@ function defaultReadFileAtRevision(file, revision) {
91
91
  : (0, child_process_1.execSync)(`git show ${revision}:${filePathInGitRepository}`, {
92
92
  maxBuffer: exports.TEN_MEGABYTES,
93
93
  stdio: ['pipe', 'pipe', 'ignore'],
94
+ windowsHide: true,
94
95
  })
95
96
  .toString()
96
97
  .trim();
@@ -1,5 +1,6 @@
1
1
  import { DefaultTasksRunnerOptions, RemoteCache } from './default-tasks-runner';
2
2
  import { Task } from '../config/task-graph';
3
+ import { NxJsonConfiguration } from '../config/nx-json';
3
4
  export type CachedResult = {
4
5
  terminalOutput: string;
5
6
  outputsPath: string;
@@ -10,7 +11,7 @@ export type TaskWithCachedResult = {
10
11
  task: Task;
11
12
  cachedResult: CachedResult;
12
13
  };
13
- export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
14
+ export declare function getCache(nxJson: NxJsonConfiguration, options: DefaultTasksRunnerOptions): DbCache | Cache;
14
15
  export declare class DbCache {
15
16
  private readonly options;
16
17
  private cache;
@@ -30,6 +31,7 @@ export declare class DbCache {
30
31
  private _getRemoteCache;
31
32
  private getPowerpackS3Cache;
32
33
  private getPowerpackSharedCache;
34
+ private getPowerpackCache;
33
35
  private resolvePackage;
34
36
  private assertCacheIsValid;
35
37
  }
@@ -18,9 +18,9 @@ const update_manager_1 = require("../nx-cloud/update-manager");
18
18
  const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
19
19
  const is_ci_1 = require("../utils/is-ci");
20
20
  const output_1 = require("../utils/output");
21
- function getCache(options) {
21
+ function getCache(nxJson, options) {
22
22
  return process.env.NX_DISABLE_DB !== 'true' &&
23
- process.env.NX_DB_CACHE === 'true'
23
+ (nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true')
24
24
  ? new DbCache({
25
25
  // Remove this in Nx 21
26
26
  nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())
@@ -114,23 +114,21 @@ class DbCache {
114
114
  null);
115
115
  }
116
116
  }
117
- async getPowerpackS3Cache() {
118
- try {
119
- const { getRemoteCache } = await Promise.resolve(`${this.resolvePackage('@nx/powerpack-s3-cache')}`).then(s => require(s));
120
- return getRemoteCache();
121
- }
122
- catch {
123
- return null;
124
- }
117
+ getPowerpackS3Cache() {
118
+ return this.getPowerpackCache('@nx/powerpack-s3-cache');
119
+ }
120
+ getPowerpackSharedCache() {
121
+ return this.getPowerpackCache('@nx/powerpack-shared-fs-cache');
125
122
  }
126
- async getPowerpackSharedCache() {
123
+ async getPowerpackCache(pkg) {
124
+ let getRemoteCache = null;
127
125
  try {
128
- const { getRemoteCache } = await Promise.resolve(`${this.resolvePackage('@nx/powerpack-shared-fs-cache')}`).then(s => require(s));
129
- return getRemoteCache();
126
+ getRemoteCache = (await Promise.resolve(`${this.resolvePackage(pkg)}`).then(s => require(s))).getRemoteCache;
130
127
  }
131
128
  catch {
132
129
  return null;
133
130
  }
131
+ return getRemoteCache();
134
132
  }
135
133
  resolvePackage(pkg) {
136
134
  return require.resolve(pkg, {
@@ -183,6 +181,7 @@ class Cache {
183
181
  stdio: 'ignore',
184
182
  detached: true,
185
183
  shell: false,
184
+ windowsHide: true,
186
185
  });
187
186
  p.unref();
188
187
  }
@@ -56,7 +56,7 @@ const defaultTasksRunner = async (tasks, options, context) => {
56
56
  };
57
57
  exports.defaultTasksRunner = defaultTasksRunner;
58
58
  async function runAllTasks(tasks, options, context) {
59
- const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.projectGraph, context.taskGraph, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.outputStyle);
59
+ const orchestrator = new task_orchestrator_1.TaskOrchestrator(context.hasher, context.initiatingProject, context.projectGraph, context.taskGraph, context.nxJson, options, context.nxArgs?.nxBail, context.daemon, context.nxArgs?.outputStyle);
60
60
  return orchestrator.run();
61
61
  }
62
62
  exports.default = exports.defaultTasksRunner;
@@ -1,3 +1,3 @@
1
1
  import { Task } from '../../config/task-graph';
2
2
  export declare function formatFlags(leftPadding: string, flag: string, value: any): string;
3
- export declare function formatTargetsAndProjects(projectNames: string[], targets: string[], tasks: Task[]): any;
3
+ export declare function formatTargetsAndProjects(projectNames: string[], targets: string[], tasks: Task[]): string;
@@ -20,24 +20,36 @@ function formatValue(value) {
20
20
  }
21
21
  }
22
22
  function formatTargetsAndProjects(projectNames, targets, tasks) {
23
- if (tasks.length === 1)
24
- return `target ${targets[0]} for project ${projectNames[0]}`;
25
- let text;
26
- const project = projectNames.length === 1
27
- ? `project ${projectNames[0]}`
28
- : `${projectNames.length} projects`;
23
+ let targetsText = '';
24
+ let projectsText = '';
25
+ let dependentTasksText = '';
26
+ const tasksTargets = new Set();
27
+ const tasksProjects = new Set();
28
+ const dependentTasks = new Set();
29
+ tasks.forEach((task) => {
30
+ tasksTargets.add(task.target.target);
31
+ tasksProjects.add(task.target.project);
32
+ if (!projectNames.includes(task.target.project) ||
33
+ !targets.includes(task.target.target)) {
34
+ dependentTasks.add(task);
35
+ }
36
+ });
37
+ targets = targets.filter((t) => tasksTargets.has(t)); // filter out targets that don't exist
38
+ projectNames = projectNames.filter((p) => tasksProjects.has(p)); // filter out projects that don't exist
29
39
  if (targets.length === 1) {
30
- text = `target ${output_1.output.bold(targets[0])} for ${project}`;
40
+ targetsText = `target ${output_1.output.bold(targets[0])}`;
31
41
  }
32
42
  else {
33
- text = `targets ${targets
34
- .map((t) => output_1.output.bold(t))
35
- .join(', ')} for ${project}`;
43
+ targetsText = `targets ${targets.map((t) => output_1.output.bold(t)).join(', ')}`;
36
44
  }
37
- const dependentTasks = tasks.filter((t) => projectNames.indexOf(t.target.project) === -1 ||
38
- targets.indexOf(t.target.target) === -1).length;
39
- if (dependentTasks > 0) {
40
- text += ` and ${output_1.output.bold(dependentTasks)} ${dependentTasks === 1 ? 'task' : 'tasks'} ${projectNames.length === 1 ? 'it depends on' : 'they depend on'}`;
45
+ if (projectNames.length === 1) {
46
+ projectsText = `project ${projectNames[0]}`;
41
47
  }
42
- return text;
48
+ else {
49
+ projectsText = `${projectNames.length} projects`;
50
+ }
51
+ if (dependentTasks.size > 0) {
52
+ dependentTasksText = ` and ${output_1.output.bold(dependentTasks.size)} ${dependentTasks.size === 1 ? 'task' : 'tasks'} ${projectNames.length === 1 ? 'it depends on' : 'they depend on'}`;
53
+ }
54
+ return `${targetsText} for ${projectsText}${dependentTasksText}`;
43
55
  }
@@ -31,6 +31,9 @@ class TaskHistoryLifeCycle {
31
31
  }
32
32
  async endCommand() {
33
33
  const entries = Array.from(this.taskRuns);
34
+ if (!this.taskHistory) {
35
+ return;
36
+ }
34
37
  await this.taskHistory.recordTaskRuns(entries.map(([_, v]) => v));
35
38
  const flakyTasks = await this.taskHistory.getFlakyTasks(entries.map(([hash]) => hash));
36
39
  if (flakyTasks.length > 0) {
@@ -4,11 +4,13 @@ import { TaskStatus } from './tasks-runner';
4
4
  import { ProjectGraph } from '../config/project-graph';
5
5
  import { TaskGraph } from '../config/task-graph';
6
6
  import { DaemonClient } from '../daemon/client/client';
7
+ import { NxJsonConfiguration } from '../config/nx-json';
7
8
  export declare class TaskOrchestrator {
8
9
  private readonly hasher;
9
10
  private readonly initiatingProject;
10
11
  private readonly projectGraph;
11
12
  private readonly taskGraph;
13
+ private readonly nxJson;
12
14
  private readonly options;
13
15
  private readonly bail;
14
16
  private readonly daemon;
@@ -24,7 +26,7 @@ export declare class TaskOrchestrator {
24
26
  private waitingForTasks;
25
27
  private groups;
26
28
  private bailed;
27
- constructor(hasher: TaskHasher, initiatingProject: string | undefined, projectGraph: ProjectGraph, taskGraph: TaskGraph, options: DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient, outputStyle: string);
29
+ constructor(hasher: TaskHasher, initiatingProject: string | undefined, projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient, outputStyle: string);
28
30
  run(): Promise<{
29
31
  [id: string]: TaskStatus;
30
32
  }>;
@@ -17,16 +17,17 @@ const output_1 = require("../utils/output");
17
17
  const params_1 = require("../utils/params");
18
18
  class TaskOrchestrator {
19
19
  // endregion internal state
20
- constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon, outputStyle) {
20
+ constructor(hasher, initiatingProject, projectGraph, taskGraph, nxJson, options, bail, daemon, outputStyle) {
21
21
  this.hasher = hasher;
22
22
  this.initiatingProject = initiatingProject;
23
23
  this.projectGraph = projectGraph;
24
24
  this.taskGraph = taskGraph;
25
+ this.nxJson = nxJson;
25
26
  this.options = options;
26
27
  this.bail = bail;
27
28
  this.daemon = daemon;
28
29
  this.outputStyle = outputStyle;
29
- this.cache = (0, cache_1.getCache)(this.options);
30
+ this.cache = (0, cache_1.getCache)(this.nxJson, this.options);
30
31
  this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options);
31
32
  this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
32
33
  // region internal state
@@ -13,7 +13,7 @@ class TasksSchedule {
13
13
  this.notScheduledTaskGraph = this.taskGraph;
14
14
  this.reverseTaskDeps = (0, utils_1.calculateReverseDeps)(this.taskGraph);
15
15
  this.reverseProjectGraph = (0, operators_1.reverse)(this.projectGraph);
16
- this.taskHistory = process.env.NX_DISABLE_DB !== 'true' ? (0, task_history_1.getTaskHistory)() : null;
16
+ this.taskHistory = (0, task_history_1.getTaskHistory)();
17
17
  this.scheduledBatches = [];
18
18
  this.scheduledTasks = [];
19
19
  this.runningTasks = new Set();
@@ -97,7 +97,10 @@ function shouldRecordStats() {
97
97
  return true;
98
98
  }
99
99
  try {
100
- const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, { encoding: 'utf-8' });
100
+ const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, {
101
+ encoding: 'utf-8',
102
+ windowsHide: true,
103
+ });
101
104
  const url = new URL(stdout.trim());
102
105
  // don't record stats when testing locally
103
106
  return url.hostname !== 'localhost';
@@ -16,6 +16,7 @@ function runNxSync(cmd, options) {
16
16
  else {
17
17
  options ??= {};
18
18
  options.cwd ??= process.cwd();
19
+ options.windowsHide ??= true;
19
20
  const offsetFromRoot = (0, path_1.relative)(options.cwd, (0, workspace_root_1.workspaceRootInner)(options.cwd, null));
20
21
  if (process.platform === 'win32') {
21
22
  baseCmd = '.\\' + (0, path_1.join)(`${offsetFromRoot}`, 'nx.bat');
@@ -34,6 +35,7 @@ async function runNxAsync(cmd, options) {
34
35
  else {
35
36
  options ??= {};
36
37
  options.cwd ??= process.cwd();
38
+ options.windowsHide ??= true;
37
39
  const offsetFromRoot = (0, path_1.relative)(options.cwd, (0, workspace_root_1.workspaceRootInner)(options.cwd, null));
38
40
  if (process.platform === 'win32') {
39
41
  baseCmd = '.\\' + (0, path_1.join)(`${offsetFromRoot}`, 'nx.bat');
@@ -46,13 +48,13 @@ async function runNxAsync(cmd, options) {
46
48
  if (options?.silent) {
47
49
  delete options.silent;
48
50
  }
49
- await new Promise((resolve, reject) => {
51
+ return new Promise((resolve, reject) => {
50
52
  const child = (0, child_process_1.exec)(`${baseCmd} ${cmd}`, options, (error, stdout, stderr) => {
51
53
  if (error) {
52
- reject(error);
54
+ reject(stderr || stdout || error.message);
53
55
  }
54
56
  else {
55
- resolve(stdout);
57
+ resolve();
56
58
  }
57
59
  });
58
60
  if (!silent) {
@@ -222,6 +222,7 @@ function getMergeBase(base, head = 'HEAD') {
222
222
  maxBuffer: file_utils_1.TEN_MEGABYTES,
223
223
  cwd: workspace_root_1.workspaceRoot,
224
224
  stdio: 'pipe',
225
+ windowsHide: true,
225
226
  })
226
227
  .toString()
227
228
  .trim();
@@ -232,6 +233,7 @@ function getMergeBase(base, head = 'HEAD') {
232
233
  maxBuffer: file_utils_1.TEN_MEGABYTES,
233
234
  cwd: workspace_root_1.workspaceRoot,
234
235
  stdio: 'pipe',
236
+ windowsHide: true,
235
237
  })
236
238
  .toString()
237
239
  .trim();
@@ -245,7 +247,11 @@ function getFilesUsingBaseAndHead(base, head) {
245
247
  return parseGitOutput(`git diff --name-only --no-renames --relative "${base}" "${head}"`);
246
248
  }
247
249
  function parseGitOutput(command) {
248
- return (0, child_process_1.execSync)(command, { maxBuffer: file_utils_1.TEN_MEGABYTES, cwd: workspace_root_1.workspaceRoot })
250
+ return (0, child_process_1.execSync)(command, {
251
+ maxBuffer: file_utils_1.TEN_MEGABYTES,
252
+ cwd: workspace_root_1.workspaceRoot,
253
+ windowsHide: true,
254
+ })
249
255
  .toString('utf-8')
250
256
  .split('\n')
251
257
  .map((a) => a.trim())
@@ -5,8 +5,11 @@ const child_process_1 = require("child_process");
5
5
  function deduceDefaultBase() {
6
6
  const nxDefaultBase = 'main';
7
7
  try {
8
- return ((0, child_process_1.execSync)('git config --get init.defaultBranch').toString().trim() ||
9
- nxDefaultBase);
8
+ return ((0, child_process_1.execSync)('git config --get init.defaultBranch', {
9
+ windowsHide: true,
10
+ })
11
+ .toString()
12
+ .trim() || nxDefaultBase);
10
13
  }
11
14
  catch {
12
15
  return nxDefaultBase;
@@ -9,9 +9,10 @@ try {
9
9
  const { execSync } = require('child_process');
10
10
  // NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
11
11
  const src = process.env.NX_IMPORT_SOURCE;
12
- execSync('git read-tree --empty', { stdio: 'inherit' });
12
+ execSync('git read-tree --empty', { stdio: 'inherit', windowsHide: true });
13
13
  execSync(`git reset ${process.env.GIT_COMMIT} -- "${src}"`, {
14
14
  stdio: 'inherit',
15
+ windowsHide: true,
15
16
  });
16
17
  }
17
18
  catch (error) {
@@ -36,6 +36,7 @@ class GitRepository {
36
36
  getGitRootPath(cwd) {
37
37
  return (0, child_process_1.execSync)('git rev-parse --show-toplevel', {
38
38
  cwd,
39
+ windowsHide: true,
39
40
  })
40
41
  .toString()
41
42
  .trim();
@@ -176,6 +177,7 @@ function getGithubSlugOrNull() {
176
177
  try {
177
178
  const gitRemote = (0, child_process_1.execSync)('git remote -v', {
178
179
  stdio: 'pipe',
180
+ windowsHide: true,
179
181
  }).toString();
180
182
  // If there are no remotes, we default to github
181
183
  if (!gitRemote || gitRemote.length === 0) {
@@ -226,6 +228,7 @@ function commitChanges(commitMessage, directory) {
226
228
  stdio: 'pipe',
227
229
  input: commitMessage,
228
230
  cwd: directory,
231
+ windowsHide: true,
229
232
  });
230
233
  }
231
234
  catch (err) {
@@ -247,6 +250,7 @@ function getLatestCommitSha() {
247
250
  return (0, child_process_1.execSync)('git rev-parse HEAD', {
248
251
  encoding: 'utf8',
249
252
  stdio: 'pipe',
253
+ windowsHide: true,
250
254
  }).trim();
251
255
  }
252
256
  catch {
@@ -14,7 +14,9 @@ try {
14
14
  // NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
15
15
  const src = process.env.NX_IMPORT_SOURCE;
16
16
  const dest = process.env.NX_IMPORT_DESTINATION;
17
- const files = execSync(`git ls-files -z ${src}`)
17
+ const files = execSync(`git ls-files -z ${src}`, {
18
+ windowsHide: true,
19
+ })
18
20
  .toString()
19
21
  .trim()
20
22
  .split('\x00')
@@ -1,5 +1,5 @@
1
1
  export declare function printPowerpackLicense(): Promise<void>;
2
- export declare function getPowerpackLicenseInformation(): Promise<any>;
2
+ export declare function getPowerpackLicenseInformation(): Promise<import("@nx/powerpack-license").PowerpackLicense>;
3
3
  export declare class NxPowerpackNotInstalledError extends Error {
4
4
  constructor(e: Error);
5
5
  }
@@ -9,22 +9,17 @@ const workspace_root_1 = require("./workspace-root");
9
9
  async function printPowerpackLicense() {
10
10
  try {
11
11
  const { organizationName, seatCount, workspaceCount } = await getPowerpackLicenseInformation();
12
- logger_1.logger.log(`Nx Powerpack Licensed to ${organizationName} for ${seatCount} user${seatCount > 1 ? '' : 's'} in ${workspaceCount} workspace${workspaceCount > 1 ? '' : 's'}`);
12
+ logger_1.logger.log(`Nx Powerpack Licensed to ${organizationName} for ${seatCount} user${seatCount > 1 ? '' : 's'} in ${workspaceCount === 9999 ? 'an unlimited number of' : workspaceCount} workspace${workspaceCount > 1 ? '' : 's'}`);
13
13
  }
14
14
  catch { }
15
15
  }
16
16
  async function getPowerpackLicenseInformation() {
17
17
  try {
18
- const { getPowerpackLicenseInformation } = (await Promise.resolve().then(() => require(
19
- // @ts-ignore
20
- '@nx/powerpack-license'
21
- // TODO(@FrozenPandaz): Provide the right type here.
22
- )));
23
- // )) as typeof import('@nx/powerpack-license');
18
+ const { getPowerpackLicenseInformation } = (await Promise.resolve().then(() => require('@nx/powerpack-license')));
24
19
  return getPowerpackLicenseInformation(workspace_root_1.workspaceRoot);
25
20
  }
26
21
  catch (e) {
27
- if ('code' in e && e.code === 'ERR_MODULE_NOT_FOUND') {
22
+ if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
28
23
  throw new NxPowerpackNotInstalledError(e);
29
24
  }
30
25
  throw e;
@@ -18,6 +18,8 @@ export type SyncGeneratorRunSuccessResult = {
18
18
  type SerializableSimpleError = {
19
19
  message: string;
20
20
  stack: string | undefined;
21
+ title?: string;
22
+ bodyLines?: string[];
21
23
  };
22
24
  export type SyncGeneratorRunErrorResult = {
23
25
  generatorName: string;
@@ -36,16 +38,24 @@ type FlushSyncGeneratorChangesFailure = {
36
38
  generalFailure?: SerializableSimpleError;
37
39
  };
38
40
  export type FlushSyncGeneratorChangesResult = FlushSyncGeneratorChangesSuccess | FlushSyncGeneratorChangesFailure;
41
+ export declare class SyncError extends Error {
42
+ title: string;
43
+ bodyLines?: string[];
44
+ constructor(title: string, bodyLines?: string[]);
45
+ }
39
46
  export declare function getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorRunResult[]>;
40
47
  export declare function flushSyncGeneratorChanges(results: SyncGeneratorRunResult[]): Promise<FlushSyncGeneratorChangesResult>;
41
- export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Promise<string[]>;
48
+ export declare function collectAllRegisteredSyncGenerators(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Promise<{
49
+ globalGenerators: string[];
50
+ taskGenerators: string[];
51
+ }>;
42
52
  export declare function runSyncGenerator(tree: Tree, generatorSpecifier: string, projects: Record<string, ProjectConfiguration>): Promise<SyncGeneratorRunResult>;
43
53
  export declare function collectEnabledTaskSyncGeneratorsFromProjectGraph(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
44
54
  export declare function collectEnabledTaskSyncGeneratorsFromTaskGraph(taskGraph: TaskGraph, projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): Set<string>;
45
55
  export declare function collectRegisteredGlobalSyncGenerators(nxJson?: NxJsonConfiguration<string[] | "*">): Set<string>;
46
56
  export declare function getSyncGeneratorSuccessResultsMessageLines(results: SyncGeneratorRunResult[]): string[];
47
- export declare function getFailedSyncGeneratorsFixMessageLines(results: SyncGeneratorRunResult[], verbose: boolean): string[];
48
- export declare function getFlushFailureMessageLines(result: FlushSyncGeneratorChangesFailure, verbose: boolean): string[];
57
+ export declare function getFailedSyncGeneratorsFixMessageLines(results: SyncGeneratorRunResult[], verbose: boolean, globalGeneratorSet?: Set<string>): string[];
58
+ export declare function getFlushFailureMessageLines(result: FlushSyncGeneratorChangesFailure, verbose: boolean, globalGeneratorSet?: Set<string>): string[];
49
59
  export declare function processSyncGeneratorResultErrors(results: SyncGeneratorRunResult[]): {
50
60
  failedGeneratorsCount: number;
51
61
  areAllResultsFailures: boolean;