nx 20.0.0-beta.0 → 20.0.0-canary.20240924-3e1a879

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.0.0-beta.0",
3
+ "version": "20.0.0-canary.20240924-3e1a879",
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": {
@@ -68,7 +68,7 @@
68
68
  "yargs-parser": "21.1.1",
69
69
  "node-machine-id": "1.1.12",
70
70
  "ora": "5.3.0",
71
- "@nrwl/tao": "20.0.0-beta.0"
71
+ "@nrwl/tao": "20.0.0-canary.20240924-3e1a879"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "@swc-node/register": "^1.8.0",
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-x64": "20.0.0-beta.0",
87
- "@nx/nx-darwin-arm64": "20.0.0-beta.0",
88
- "@nx/nx-linux-x64-gnu": "20.0.0-beta.0",
89
- "@nx/nx-linux-x64-musl": "20.0.0-beta.0",
90
- "@nx/nx-win32-x64-msvc": "20.0.0-beta.0",
91
- "@nx/nx-linux-arm64-gnu": "20.0.0-beta.0",
92
- "@nx/nx-linux-arm64-musl": "20.0.0-beta.0",
93
- "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.0",
94
- "@nx/nx-win32-arm64-msvc": "20.0.0-beta.0",
95
- "@nx/nx-freebsd-x64": "20.0.0-beta.0"
86
+ "@nx/nx-darwin-x64": "20.0.0-canary.20240924-3e1a879",
87
+ "@nx/nx-darwin-arm64": "20.0.0-canary.20240924-3e1a879",
88
+ "@nx/nx-linux-x64-gnu": "20.0.0-canary.20240924-3e1a879",
89
+ "@nx/nx-linux-x64-musl": "20.0.0-canary.20240924-3e1a879",
90
+ "@nx/nx-win32-x64-msvc": "20.0.0-canary.20240924-3e1a879",
91
+ "@nx/nx-linux-arm64-gnu": "20.0.0-canary.20240924-3e1a879",
92
+ "@nx/nx-linux-arm64-musl": "20.0.0-canary.20240924-3e1a879",
93
+ "@nx/nx-linux-arm-gnueabihf": "20.0.0-canary.20240924-3e1a879",
94
+ "@nx/nx-win32-arm64-msvc": "20.0.0-canary.20240924-3e1a879",
95
+ "@nx/nx-freebsd-x64": "20.0.0-canary.20240924-3e1a879"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -29,7 +29,7 @@ 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
35
  });
Binary file
@@ -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) {
@@ -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();
@@ -12,6 +12,6 @@ export declare class TaskHistory {
12
12
  }
13
13
  /**
14
14
  * This function returns the singleton instance of TaskHistory
15
- * @returns singleton instance of TaskHistory
15
+ * @returns singleton instance of TaskHistory, null if database is disabled or WASM is not enabled
16
16
  */
17
- export declare function getTaskHistory(): TaskHistory;
17
+ export declare function getTaskHistory(): TaskHistory | null;
@@ -38,9 +38,12 @@ exports.TaskHistory = TaskHistory;
38
38
  let taskHistory;
39
39
  /**
40
40
  * This function returns the singleton instance of TaskHistory
41
- * @returns singleton instance of TaskHistory
41
+ * @returns singleton instance of TaskHistory, null if database is disabled or WASM is not enabled
42
42
  */
43
43
  function getTaskHistory() {
44
+ if (process.env.NX_DISABLE_DB === 'true' || !native_1.IS_WASM) {
45
+ return null;
46
+ }
44
47
  if (!taskHistory) {
45
48
  taskHistory = new TaskHistory();
46
49
  }