nx 16.4.0-beta.9 → 16.5.0-beta.0

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 (52) hide show
  1. package/package.json +14 -14
  2. package/schemas/nx-schema.json +2 -1
  3. package/schemas/project-schema.json +2 -1
  4. package/src/command-line/affected/command-object.d.ts +2 -2
  5. package/src/command-line/affected/command-object.js +2 -2
  6. package/src/command-line/examples.js +2 -2
  7. package/src/command-line/graph/graph.js +7 -6
  8. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -1
  9. package/src/command-line/report/report.js +16 -5
  10. package/src/command-line/workspace-lint/command-object.js +1 -1
  11. package/src/command-line/yargs-utils/shared-options.d.ts +3 -3
  12. package/src/command-line/yargs-utils/shared-options.js +5 -2
  13. package/src/config/misc-interfaces.d.ts +7 -2
  14. package/src/config/nx-json.d.ts +0 -4
  15. package/src/config/project-graph.js +1 -1
  16. package/src/core/graph/main.js +1 -1
  17. package/src/core/graph/polyfills.js +1 -1
  18. package/src/core/graph/styles.js +1 -1
  19. package/src/daemon/client/client.js +7 -3
  20. package/src/daemon/server/handle-hash-tasks.d.ts +1 -0
  21. package/src/daemon/server/handle-hash-tasks.js +2 -0
  22. package/src/daemon/server/server.js +1 -0
  23. package/src/daemon/server/watcher.js +5 -6
  24. package/src/executors/run-commands/run-commands.impl.js +8 -1
  25. package/src/hasher/set-hash-env.d.ts +10 -0
  26. package/src/hasher/set-hash-env.js +21 -0
  27. package/src/hasher/task-hasher.js +4 -2
  28. package/src/native/index.d.ts +9 -1
  29. package/src/native/index.js +4 -1
  30. package/src/plugins/js/lock-file/npm-parser.js +5 -1
  31. package/src/plugins/js/lock-file/pnpm-parser.js +45 -34
  32. package/src/plugins/js/lock-file/yarn-parser.js +40 -28
  33. package/src/plugins/js/package-json/create-package-json.d.ts +12 -1
  34. package/src/plugins/js/package-json/create-package-json.js +26 -21
  35. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +3 -1
  36. package/src/plugins/js/versions.d.ts +1 -1
  37. package/src/plugins/js/versions.js +1 -1
  38. package/src/project-graph/utils/find-project-for-path.js +7 -1
  39. package/src/tasks-runner/batch/batch-messages.d.ts +23 -13
  40. package/src/tasks-runner/batch/batch-messages.js +4 -3
  41. package/src/tasks-runner/batch/run-batch.js +18 -3
  42. package/src/tasks-runner/cache.d.ts +0 -1
  43. package/src/tasks-runner/cache.js +23 -41
  44. package/src/tasks-runner/forked-process-task-runner.js +19 -4
  45. package/src/tasks-runner/life-cycles/store-run-information-life-cycle.js +1 -1
  46. package/src/tasks-runner/run-command.js +8 -9
  47. package/src/tasks-runner/task-orchestrator.js +3 -0
  48. package/src/tasks-runner/tasks-schedule.d.ts +1 -0
  49. package/src/tasks-runner/tasks-schedule.js +7 -0
  50. package/src/utils/json-diff.js +1 -1
  51. package/src/utils/nx-cloud-utils.d.ts +0 -1
  52. package/src/utils/plugins/plugin-capabilities.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "16.4.0-beta.9",
3
+ "version": "16.5.0-beta.0",
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": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://nx.dev",
34
34
  "dependencies": {
35
- "@nrwl/tao": "16.4.0-beta.9",
35
+ "@nrwl/tao": "16.5.0-beta.0",
36
36
  "@parcel/watcher": "2.0.4",
37
37
  "@yarnpkg/lockfile": "^1.1.0",
38
38
  "@yarnpkg/parsers": "^3.0.0-rc.18",
@@ -56,7 +56,7 @@
56
56
  "minimatch": "3.0.5",
57
57
  "npm-run-path": "^4.0.1",
58
58
  "open": "^8.4.0",
59
- "semver": "7.3.4",
59
+ "semver": "7.5.3",
60
60
  "string-width": "^4.2.3",
61
61
  "strong-log-transformer": "^2.1.0",
62
62
  "tar-stream": "~2.2.0",
@@ -80,16 +80,16 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@nx/nx-darwin-arm64": "16.4.0-beta.9",
84
- "@nx/nx-darwin-x64": "16.4.0-beta.9",
85
- "@nx/nx-freebsd-x64": "16.4.0-beta.9",
86
- "@nx/nx-linux-arm-gnueabihf": "16.4.0-beta.9",
87
- "@nx/nx-linux-arm64-gnu": "16.4.0-beta.9",
88
- "@nx/nx-linux-arm64-musl": "16.4.0-beta.9",
89
- "@nx/nx-linux-x64-gnu": "16.4.0-beta.9",
90
- "@nx/nx-linux-x64-musl": "16.4.0-beta.9",
91
- "@nx/nx-win32-arm64-msvc": "16.4.0-beta.9",
92
- "@nx/nx-win32-x64-msvc": "16.4.0-beta.9"
83
+ "@nx/nx-darwin-arm64": "16.5.0-beta.0",
84
+ "@nx/nx-darwin-x64": "16.5.0-beta.0",
85
+ "@nx/nx-freebsd-x64": "16.5.0-beta.0",
86
+ "@nx/nx-linux-arm-gnueabihf": "16.5.0-beta.0",
87
+ "@nx/nx-linux-arm64-gnu": "16.5.0-beta.0",
88
+ "@nx/nx-linux-arm64-musl": "16.5.0-beta.0",
89
+ "@nx/nx-linux-x64-gnu": "16.5.0-beta.0",
90
+ "@nx/nx-linux-x64-musl": "16.5.0-beta.0",
91
+ "@nx/nx-win32-arm64-msvc": "16.5.0-beta.0",
92
+ "@nx/nx-win32-x64-msvc": "16.5.0-beta.0"
93
93
  },
94
94
  "nx-migrations": {
95
95
  "migrations": "./migrations.json",
@@ -175,5 +175,5 @@
175
175
  },
176
176
  "main": "./bin/nx.js",
177
177
  "types": "./bin/nx.d.ts",
178
- "gitHead": "b7fbc25d5be1789d42805e2254cf4a6070889157"
178
+ "gitHead": "376d656cfc7f6390ff1cd6d9de348baf7bccbf33"
179
179
  }
@@ -163,7 +163,8 @@
163
163
  "type": "object",
164
164
  "properties": {
165
165
  "externalDependencies": {
166
- "type": "string",
166
+ "type": "array",
167
+ "items": { "type": "string" },
167
168
  "description": "The list of external dependencies that our target depends on for `nx:run-commands` and community plugins."
168
169
  }
169
170
  },
@@ -211,7 +211,8 @@
211
211
  "type": "object",
212
212
  "properties": {
213
213
  "externalDependencies": {
214
- "type": "string",
214
+ "type": "array",
215
+ "items": { "type": "string" },
215
216
  "description": "The list of external dependencies that our target depends on for `nx:run-commands` and community plugins."
216
217
  }
217
218
  },
@@ -4,12 +4,12 @@ export declare const yargsAffectedTestCommand: CommandModule;
4
4
  export declare const yargsAffectedBuildCommand: CommandModule;
5
5
  export declare const yargsAffectedLintCommand: CommandModule;
6
6
  export declare const yargsAffectedE2ECommand: CommandModule;
7
- export declare const affectedGraphDeprecationMessage = "Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.";
7
+ export declare const affectedGraphDeprecationMessage = "Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.";
8
8
  /**
9
9
  * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.'
10
10
  */
11
11
  export declare const yargsAffectedGraphCommand: CommandModule;
12
- export declare const printAffectedDeprecationMessage = "Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.";
12
+ export declare const printAffectedDeprecationMessage = "Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.";
13
13
  /**
14
14
  * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.'
15
15
  */
@@ -51,7 +51,7 @@ exports.yargsAffectedE2ECommand = {
51
51
  return (yield Promise.resolve().then(() => require('./affected'))).affected('affected', Object.assign(Object.assign({}, (0, shared_options_1.withOverrides)(args)), { target: 'e2e' }));
52
52
  }),
53
53
  };
54
- exports.affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.';
54
+ exports.affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.';
55
55
  /**
56
56
  * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.'
57
57
  */
@@ -65,7 +65,7 @@ exports.yargsAffectedGraphCommand = {
65
65
  }),
66
66
  deprecated: exports.affectedGraphDeprecationMessage,
67
67
  };
68
- exports.printAffectedDeprecationMessage = 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.';
68
+ exports.printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.';
69
69
  /**
70
70
  * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.'
71
71
  */
@@ -305,8 +305,8 @@ exports.examples = {
305
305
  description: 'Show all projects in the workspace',
306
306
  },
307
307
  {
308
- command: 'show projects --pattern=api-*',
309
- description: 'Show all projects with names starting with "api-". The pattern option is useful to see which projects would be selected by run-many.',
308
+ command: 'show projects --projects api-*',
309
+ description: 'Show all projects with names starting with "api-". The "projects" option is useful to see which projects would be selected by run-many.',
310
310
  },
311
311
  {
312
312
  command: 'show projects --with-target serve',
@@ -131,8 +131,9 @@ function generateGraph(args, affectedProjects) {
131
131
  const target = Array.isArray(args.targets && args.targets.length >= 1)
132
132
  ? args.targets[0]
133
133
  : args.targets;
134
- let graph = (0, operators_1.pruneExternalNodes)(yield (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true }));
135
- const projects = Object.values(graph.nodes);
134
+ const rawGraph = yield (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
135
+ let prunedGraph = (0, operators_1.pruneExternalNodes)(rawGraph);
136
+ const projects = Object.values(prunedGraph.nodes);
136
137
  projects.sort((a, b) => {
137
138
  return a.name.localeCompare(b.name);
138
139
  });
@@ -146,7 +147,7 @@ function generateGraph(args, affectedProjects) {
146
147
  }
147
148
  }
148
149
  if (args.affected) {
149
- affectedProjects = (yield (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: true }, (0, configuration_1.readNxJson)()).nxArgs, graph)).map((n) => n.name);
150
+ affectedProjects = (yield (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: true }, (0, configuration_1.readNxJson)()).nxArgs, rawGraph)).map((n) => n.name);
150
151
  }
151
152
  if (args.exclude) {
152
153
  const invalidExcludes = [];
@@ -164,11 +165,11 @@ function generateGraph(args, affectedProjects) {
164
165
  }
165
166
  }
166
167
  let html = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
167
- graph = filterGraph(graph, args.focus || null, args.exclude || []);
168
+ prunedGraph = filterGraph(prunedGraph, args.focus || null, args.exclude || []);
168
169
  if (args.file) {
169
170
  // stdout is a magical constant that doesn't actually write a file
170
171
  if (args.file === 'stdout') {
171
- console.log(JSON.stringify(createJsonOutput(graph, args.projects, args.targets), null, 2));
172
+ console.log(JSON.stringify(createJsonOutput(prunedGraph, args.projects, args.targets), null, 2));
172
173
  process.exit(0);
173
174
  }
174
175
  const workspaceFolder = workspace_root_1.workspaceRoot;
@@ -205,7 +206,7 @@ function generateGraph(args, affectedProjects) {
205
206
  }
206
207
  else if (ext === '.json') {
207
208
  (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(fullFilePath));
208
- const json = createJsonOutput(graph, args.projects, args.targets);
209
+ const json = createJsonOutput(prunedGraph, args.projects, args.targets);
209
210
  json.affectedProjects = affectedProjects;
210
211
  json.criticalPath = affectedProjects;
211
212
  (0, fileutils_1.writeJsonFile)(fullFilePath, json);
@@ -6,7 +6,7 @@ function checkForUncommittedChanges() {
6
6
  const gitResult = (0, child_process_1.execSync)(`git status --porcelain`);
7
7
  if (gitResult.length > 0) {
8
8
  console.log('❗️ Careful!');
9
- console.log('You have uncommited changes in your repository.');
9
+ console.log('You have uncommitted changes in your repository.');
10
10
  console.log('');
11
11
  console.log(gitResult.toString());
12
12
  console.log('Please commit your changes before running the migrator!');
@@ -92,11 +92,13 @@ function getReportData() {
92
92
  const localPlugins = yield findLocalPlugins();
93
93
  const communityPlugins = findInstalledCommunityPlugins();
94
94
  let projectGraphError = null;
95
- try {
96
- yield (0, project_graph_1.createProjectGraphAsync)();
97
- }
98
- catch (e) {
99
- projectGraphError = e;
95
+ if (isNativeAvailable()) {
96
+ try {
97
+ yield (0, project_graph_1.createProjectGraphAsync)();
98
+ }
99
+ catch (e) {
100
+ projectGraphError = e;
101
+ }
100
102
  }
101
103
  const packageVersionsWeCareAbout = findInstalledPackagesWeCareAbout();
102
104
  packageVersionsWeCareAbout.unshift({
@@ -227,3 +229,12 @@ function findInstalledPackagesWeCareAbout() {
227
229
  }));
228
230
  }
229
231
  exports.findInstalledPackagesWeCareAbout = findInstalledPackagesWeCareAbout;
232
+ function isNativeAvailable() {
233
+ try {
234
+ require('../../native');
235
+ return true;
236
+ }
237
+ catch (_a) {
238
+ return false;
239
+ }
240
+ }
@@ -8,7 +8,7 @@ const tslib_1 = require("tslib");
8
8
  exports.yargsWorkspaceLintCommand = {
9
9
  command: 'workspace-lint [files..]',
10
10
  describe: 'Lint nx specific workspace files (nx.json, workspace.json)',
11
- deprecated: 'workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant.',
11
+ deprecated: 'workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant. See: https://nx.dev/deprecated/workspace-lint',
12
12
  handler: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
13
13
  yield (yield Promise.resolve().then(() => require('./workspace-lint'))).workspaceLint();
14
14
  process.exit(0);
@@ -13,7 +13,7 @@ export declare function withRunOptions(yargs: Argv): Argv<{
13
13
  } & {
14
14
  prod: boolean;
15
15
  } & {
16
- graph: any;
16
+ graph: string;
17
17
  } & {
18
18
  verbose: boolean;
19
19
  } & {
@@ -59,7 +59,7 @@ export declare function withRunManyOptions(yargs: Argv): Argv<{
59
59
  } & {
60
60
  prod: boolean;
61
61
  } & {
62
- graph: any;
62
+ graph: string;
63
63
  } & {
64
64
  verbose: boolean;
65
65
  } & {
@@ -113,7 +113,7 @@ export declare function withRunOneOptions(yargs: Argv): Argv<{
113
113
  } & {
114
114
  prod: boolean;
115
115
  } & {
116
- graph: any;
116
+ graph: string;
117
117
  } & {
118
118
  verbose: boolean;
119
119
  } & {
@@ -32,8 +32,11 @@ function withRunOptions(yargs) {
32
32
  .option('graph', {
33
33
  type: 'string',
34
34
  describe: 'Show the task graph of the command. Pass a file path to save the graph data instead of viewing it in the browser.',
35
- default: false,
36
- coerce: (value) => value === 'true' || value === true
35
+ coerce: (value) =>
36
+ // when the type of an opt is "string", passing `--opt` comes through as having an empty string value.
37
+ // this coercion allows `--graph` to be passed through as a boolean directly, and also normalizes the
38
+ // `--graph=true` to produce the same behaviour as `--graph`.
39
+ value === '' || value === 'true' || value === true
37
40
  ? true
38
41
  : value === 'false' || value === false
39
42
  ? false
@@ -107,12 +107,17 @@ export interface HasherContext {
107
107
  nxJsonConfiguration: NxJsonConfiguration;
108
108
  }
109
109
  export type CustomHasher = (task: Task, context: HasherContext) => Promise<Hash>;
110
- export type ExecutorTaskResult = {
110
+ export type TaskResult = {
111
111
  success: boolean;
112
112
  terminalOutput: string;
113
113
  startTime?: number;
114
114
  endTime?: number;
115
115
  };
116
+ export type BatchExecutorResult = Record<string, TaskResult>;
117
+ export type BatchExecutorTaskResult = {
118
+ task: string;
119
+ result: TaskResult;
120
+ };
116
121
  /**
117
122
  * Implementation of a target of a project that handles multiple projects to be batched
118
123
  */
@@ -128,7 +133,7 @@ options: Record<string, T>,
128
133
  /**
129
134
  * Set of overrides for the overall execution
130
135
  */
131
- overrides: T, context: ExecutorContext) => Promise<Record<string, ExecutorTaskResult> | AsyncIterableIterator<Record<string, ExecutorTaskResult>>>;
136
+ overrides: T, context: ExecutorContext) => Promise<BatchExecutorResult | AsyncIterableIterator<BatchExecutorTaskResult>>;
132
137
  /**
133
138
  * Context that is passed into an executor
134
139
  */
@@ -83,10 +83,6 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
83
83
  * Default options for the runner
84
84
  */
85
85
  options?: any;
86
- /**
87
- * Enables the Rust watcher within the daemon
88
- */
89
- nativeWatcher?: boolean;
90
86
  };
91
87
  };
92
88
  /**
@@ -26,4 +26,4 @@ var DependencyType;
26
26
  * Implicit dependencies are inferred
27
27
  */
28
28
  DependencyType["implicit"] = "implicit";
29
- })(DependencyType = exports.DependencyType || (exports.DependencyType = {}));
29
+ })(DependencyType || (exports.DependencyType = DependencyType = {}));