nx 19.5.7 → 19.5.9

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.5.7",
3
+ "version": "19.5.9",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.5.7"
74
+ "@nrwl/tao": "19.5.9"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.5.7",
90
- "@nx/nx-darwin-arm64": "19.5.7",
91
- "@nx/nx-linux-x64-gnu": "19.5.7",
92
- "@nx/nx-linux-x64-musl": "19.5.7",
93
- "@nx/nx-win32-x64-msvc": "19.5.7",
94
- "@nx/nx-linux-arm64-gnu": "19.5.7",
95
- "@nx/nx-linux-arm64-musl": "19.5.7",
96
- "@nx/nx-linux-arm-gnueabihf": "19.5.7",
97
- "@nx/nx-win32-arm64-msvc": "19.5.7",
98
- "@nx/nx-freebsd-x64": "19.5.7"
89
+ "@nx/nx-darwin-x64": "19.5.9",
90
+ "@nx/nx-darwin-arm64": "19.5.9",
91
+ "@nx/nx-linux-x64-gnu": "19.5.9",
92
+ "@nx/nx-linux-x64-musl": "19.5.9",
93
+ "@nx/nx-win32-x64-msvc": "19.5.9",
94
+ "@nx/nx-linux-arm64-gnu": "19.5.9",
95
+ "@nx/nx-linux-arm64-musl": "19.5.9",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.5.9",
97
+ "@nx/nx-win32-arm64-msvc": "19.5.9",
98
+ "@nx/nx-freebsd-x64": "19.5.9"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
Binary file
@@ -18,9 +18,11 @@ export declare class ProcessTasks {
18
18
  private processTasksForMultipleProjects;
19
19
  private processTasksForSingleProject;
20
20
  private processTasksForDependencies;
21
+ private createDummyTask;
21
22
  createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
22
23
  resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
23
24
  getId(project: string, target: string, configuration: string | undefined): string;
25
+ private filterDummyTasks;
24
26
  }
25
27
  export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Object, excludeTaskDependencies?: boolean): TaskGraph;
26
28
  export declare function mapTargetDefaultsToDependencies(defaults: TargetDefaults | undefined): TargetDependencies;
@@ -6,6 +6,7 @@ exports.mapTargetDefaultsToDependencies = mapTargetDefaultsToDependencies;
6
6
  const utils_1 = require("./utils");
7
7
  const project_graph_utils_1 = require("../utils/project-graph-utils");
8
8
  const output_1 = require("../utils/output");
9
+ const DUMMY_TASK_TARGET = '__nx_dummy_task__';
9
10
  class ProcessTasks {
10
11
  constructor(extraTargetDependencies, projectGraph) {
11
12
  this.extraTargetDependencies = extraTargetDependencies;
@@ -52,10 +53,11 @@ class ProcessTasks {
52
53
  this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
53
54
  }
54
55
  }
55
- for (const projectName of Object.keys(this.dependencies)) {
56
- if (this.dependencies[projectName].length > 1) {
57
- this.dependencies[projectName] = [
58
- ...new Set(this.dependencies[projectName]).values(),
56
+ this.filterDummyTasks();
57
+ for (const taskId of Object.keys(this.dependencies)) {
58
+ if (this.dependencies[taskId].length > 0) {
59
+ this.dependencies[taskId] = [
60
+ ...new Set(this.dependencies[taskId].filter((d) => d !== taskId)).values(),
59
61
  ];
60
62
  }
61
63
  }
@@ -113,6 +115,9 @@ class ProcessTasks {
113
115
  }
114
116
  }
115
117
  processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides) {
118
+ if (!this.projectGraph.dependencies.hasOwnProperty(projectUsedToDeriveDependencies)) {
119
+ return;
120
+ }
116
121
  for (const dep of this.projectGraph.dependencies[projectUsedToDeriveDependencies]) {
117
122
  const depProject = this.projectGraph.nodes[dep.target];
118
123
  // this is to handle external dependencies
@@ -132,10 +137,20 @@ class ProcessTasks {
132
137
  }
133
138
  }
134
139
  else {
135
- this.processTask(task, depProject.name, configuration, overrides);
140
+ const dummyId = this.getId(depProject.name, DUMMY_TASK_TARGET, undefined);
141
+ this.dependencies[task.id].push(dummyId);
142
+ this.dependencies[dummyId] = [];
143
+ const noopTask = this.createDummyTask(dummyId, task);
144
+ this.processTask(noopTask, depProject.name, configuration, overrides);
136
145
  }
137
146
  }
138
147
  }
148
+ createDummyTask(id, task) {
149
+ return {
150
+ ...task,
151
+ id,
152
+ };
153
+ }
139
154
  createTask(id, project, target, resolvedConfiguration, overrides) {
140
155
  if (!project.data.targets[target]) {
141
156
  throw new Error(`Cannot find configuration for task ${project.name}:${target}`);
@@ -173,6 +188,25 @@ class ProcessTasks {
173
188
  }
174
189
  return id;
175
190
  }
191
+ filterDummyTasks() {
192
+ for (const [key, deps] of Object.entries(this.dependencies)) {
193
+ const normalizedDeps = [];
194
+ for (const dep of deps) {
195
+ if (dep.endsWith(DUMMY_TASK_TARGET)) {
196
+ normalizedDeps.push(...this.dependencies[dep].filter((d) => !d.endsWith(DUMMY_TASK_TARGET)));
197
+ }
198
+ else {
199
+ normalizedDeps.push(dep);
200
+ }
201
+ }
202
+ this.dependencies[key] = normalizedDeps;
203
+ }
204
+ for (const key of Object.keys(this.dependencies)) {
205
+ if (key.endsWith(DUMMY_TASK_TARGET)) {
206
+ delete this.dependencies[key];
207
+ }
208
+ }
209
+ }
176
210
  }
177
211
  exports.ProcessTasks = ProcessTasks;
178
212
  function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {