nx 20.2.0-beta.4 → 20.2.0-beta.6

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 (40) hide show
  1. package/bin/post-install.js +5 -3
  2. package/package.json +11 -11
  3. package/plugins/package-json.d.ts +5 -1
  4. package/plugins/package-json.js +26 -2
  5. package/src/command-line/affected/affected.js +3 -1
  6. package/src/command-line/format/format.js +4 -2
  7. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -1
  8. package/src/command-line/show/project.js +4 -0
  9. package/src/command-line/show/projects.js +4 -0
  10. package/src/command-line/sync/sync.js +3 -3
  11. package/src/core/graph/main.js +1 -1
  12. package/src/daemon/server/project-graph-incremental-recomputation.js +4 -4
  13. package/src/daemon/server/shutdown-utils.js +2 -2
  14. package/src/executors/utils/convert-nx-executor.js +2 -3
  15. package/src/native/nx.wasm32-wasi.wasm +0 -0
  16. package/src/plugins/js/utils/register.d.ts +2 -0
  17. package/src/plugins/js/versions.d.ts +1 -1
  18. package/src/plugins/js/versions.js +1 -1
  19. package/src/plugins/package-json/create-nodes.d.ts +3 -4
  20. package/src/plugins/package-json/create-nodes.js +19 -2
  21. package/src/project-graph/affected/affected-project-graph.js +3 -0
  22. package/src/project-graph/affected/locators/project-glob-changes.js +16 -4
  23. package/src/project-graph/build-project-graph.d.ts +1 -0
  24. package/src/project-graph/build-project-graph.js +12 -3
  25. package/src/project-graph/error-types.d.ts +1 -1
  26. package/src/project-graph/plugins/get-plugins.d.ts +4 -0
  27. package/src/{daemon/server/plugins.js → project-graph/plugins/get-plugins.js} +19 -1
  28. package/src/project-graph/plugins/index.js +1 -0
  29. package/src/project-graph/plugins/internal-api.d.ts +4 -0
  30. package/src/project-graph/plugins/internal-api.js +14 -7
  31. package/src/project-graph/plugins/isolation/index.js +1 -7
  32. package/src/project-graph/plugins/isolation/plugin-worker.js +2 -2
  33. package/src/project-graph/plugins/loader.d.ts +1 -1
  34. package/src/project-graph/plugins/loader.js +0 -3
  35. package/src/project-graph/project-graph.js +19 -11
  36. package/src/project-graph/utils/retrieve-workspace-files.d.ts +2 -6
  37. package/src/project-graph/utils/retrieve-workspace-files.js +3 -5
  38. package/src/tasks-runner/run-command.js +2 -2
  39. package/src/utils/sync-generators.js +9 -14
  40. package/src/daemon/server/plugins.d.ts +0 -3
@@ -18,10 +18,12 @@ const workspace_context_1 = require("../src/utils/workspace-context");
18
18
  if (isMainNxPackage() && (0, fileutils_1.fileExists)((0, path_1.join)(workspace_root_1.workspaceRoot, 'nx.json'))) {
19
19
  (0, assert_supported_platform_1.assertSupportedPlatform)();
20
20
  (0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
21
- try {
22
- await client_1.daemonClient.stop();
21
+ if (client_1.daemonClient.enabled()) {
22
+ try {
23
+ await client_1.daemonClient.stop();
24
+ }
25
+ catch (e) { }
23
26
  }
24
- catch (e) { }
25
27
  const tasks = [
26
28
  (0, project_graph_1.buildProjectGraphAndSourceMapsWithoutDaemon)(),
27
29
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.2.0-beta.4",
3
+ "version": "20.2.0-beta.6",
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": {
@@ -80,16 +80,16 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@nx/nx-darwin-x64": "20.2.0-beta.4",
84
- "@nx/nx-darwin-arm64": "20.2.0-beta.4",
85
- "@nx/nx-linux-x64-gnu": "20.2.0-beta.4",
86
- "@nx/nx-linux-x64-musl": "20.2.0-beta.4",
87
- "@nx/nx-win32-x64-msvc": "20.2.0-beta.4",
88
- "@nx/nx-linux-arm64-gnu": "20.2.0-beta.4",
89
- "@nx/nx-linux-arm64-musl": "20.2.0-beta.4",
90
- "@nx/nx-linux-arm-gnueabihf": "20.2.0-beta.4",
91
- "@nx/nx-win32-arm64-msvc": "20.2.0-beta.4",
92
- "@nx/nx-freebsd-x64": "20.2.0-beta.4"
83
+ "@nx/nx-darwin-x64": "20.2.0-beta.6",
84
+ "@nx/nx-darwin-arm64": "20.2.0-beta.6",
85
+ "@nx/nx-linux-x64-gnu": "20.2.0-beta.6",
86
+ "@nx/nx-linux-x64-musl": "20.2.0-beta.6",
87
+ "@nx/nx-win32-x64-msvc": "20.2.0-beta.6",
88
+ "@nx/nx-linux-arm64-gnu": "20.2.0-beta.6",
89
+ "@nx/nx-linux-arm64-musl": "20.2.0-beta.6",
90
+ "@nx/nx-linux-arm-gnueabihf": "20.2.0-beta.6",
91
+ "@nx/nx-win32-arm64-msvc": "20.2.0-beta.6",
92
+ "@nx/nx-freebsd-x64": "20.2.0-beta.6"
93
93
  },
94
94
  "nx-migrations": {
95
95
  "migrations": "./migrations.json",
@@ -1 +1,5 @@
1
- export {};
1
+ import { ProjectConfiguration } from '../src/config/workspace-json-project-json';
2
+ export type PackageJsonConfigurationCache = {
3
+ [hash: string]: ProjectConfiguration;
4
+ };
5
+ export declare function readPackageJsonConfigurationCache(): PackageJsonConfigurationCache;
@@ -1,12 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readPackageJsonConfigurationCache = readPackageJsonConfigurationCache;
4
+ const plugins_1 = require("../src/project-graph/plugins");
3
5
  const workspace_root_1 = require("../src/utils/workspace-root");
4
6
  const package_json_1 = require("../src/plugins/package-json");
7
+ const cache_directory_1 = require("../src/utils/cache-directory");
8
+ const path_1 = require("path");
9
+ const fileutils_1 = require("../src/utils/fileutils");
10
+ const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'package-json.hash');
11
+ function readPackageJsonConfigurationCache() {
12
+ try {
13
+ return (0, fileutils_1.readJsonFile)(cachePath);
14
+ }
15
+ catch (e) {
16
+ return {};
17
+ }
18
+ }
19
+ function writeCache(cache) {
20
+ (0, fileutils_1.writeJsonFile)(cachePath, cache);
21
+ }
5
22
  const plugin = {
6
23
  name: 'nx-all-package-jsons-plugin',
7
- createNodes: [
24
+ createNodesV2: [
8
25
  '*/**/package.json',
9
- (f) => (0, package_json_1.createNodeFromPackageJson)(f, workspace_root_1.workspaceRoot),
26
+ (configFiles, options, context) => {
27
+ const cache = readPackageJsonConfigurationCache();
28
+ const result = (0, plugins_1.createNodesFromFiles)((f) => (0, package_json_1.createNodeFromPackageJson)(f, workspace_root_1.workspaceRoot, cache), configFiles, options, context);
29
+ writeCache(cache);
30
+ return result;
31
+ },
10
32
  ],
11
33
  };
12
34
  module.exports = plugin;
35
+ module.exports.readPackageJsonConfigurationCache =
36
+ readPackageJsonConfigurationCache;
@@ -26,7 +26,9 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
26
26
  printWarnings: command !== 'print-affected' && !args.plain && args.graph !== 'stdout',
27
27
  }, nxJson);
28
28
  await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
29
- const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
29
+ const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({
30
+ exitOnError: true,
31
+ });
30
32
  const projects = await getAffectedGraphNodes(nxArgs, projectGraph);
31
33
  try {
32
34
  switch (command) {
@@ -34,7 +34,7 @@ async function format(command, args) {
34
34
  const patterns = (await getPatterns({ ...args, ...nxArgs })).map(
35
35
  // prettier removes one of the \
36
36
  // prettier-ignore
37
- (p) => `"${p.replace(/\$/g, "\\\$")}"`);
37
+ (p) => `"${p.replace(/\$/g, '\\\$')}"`);
38
38
  // Chunkify the patterns array to prevent crashing the windows terminal
39
39
  const chunkList = (0, chunkify_1.chunkify)(patterns);
40
40
  switch (command) {
@@ -110,7 +110,9 @@ async function getPatterns(args) {
110
110
  }
111
111
  }
112
112
  async function getPatternsFromApps(affectedFiles, allWorkspaceFiles, projectGraph) {
113
- const graph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
113
+ const graph = await (0, project_graph_1.createProjectGraphAsync)({
114
+ exitOnError: true,
115
+ });
114
116
  const affectedGraph = await (0, affected_project_graph_1.filterAffected)(graph, (0, file_utils_1.calculateFileChanges)(affectedFiles, allWorkspaceFiles));
115
117
  return getPatternsFromProjects(Object.keys(affectedGraph.nodes), projectGraph);
116
118
  }
@@ -16,9 +16,10 @@ const connect_to_nx_cloud_1 = require("../../../connect/connect-to-nx-cloud");
16
16
  const nxAngularLegacyVersionMap = {
17
17
  14: '~17.0.0',
18
18
  15: '~19.0.0',
19
+ 16: '~20.1.0',
19
20
  };
20
21
  // min major angular version supported in latest Nx
21
- const minMajorAngularVersionSupported = 16;
22
+ const minMajorAngularVersionSupported = 17;
22
23
  // version when the Nx CLI changed from @nrwl/tao & @nrwl/cli to nx
23
24
  const versionWithConsolidatedPackages = '13.9.0';
24
25
  // version when packages were rescoped from @nrwl/* to @nx/*
@@ -5,6 +5,8 @@ const output_1 = require("../../utils/output");
5
5
  const project_graph_1 = require("../../project-graph/project-graph");
6
6
  const graph_1 = require("../graph/graph");
7
7
  async function showProjectHandler(args) {
8
+ performance.mark('code-loading:end');
9
+ performance.measure('code-loading', 'init-local', 'code-loading:end');
8
10
  const graph = await (0, project_graph_1.createProjectGraphAsync)();
9
11
  const node = graph.nodes[args.projectName];
10
12
  if (!node) {
@@ -56,5 +58,7 @@ async function showProjectHandler(args) {
56
58
  }
57
59
  }
58
60
  }
61
+ // TODO: Find a better fix for this
62
+ await new Promise((res) => setImmediate(res));
59
63
  await output_1.output.drain();
60
64
  }
@@ -11,6 +11,8 @@ const all_file_data_1 = require("../../utils/all-file-data");
11
11
  const command_line_utils_1 = require("../../utils/command-line-utils");
12
12
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
13
13
  async function showProjectsHandler(args) {
14
+ performance.mark('code-loading:end');
15
+ performance.measure('code-loading', 'init-local', 'code-loading:end');
14
16
  let graph = await (0, project_graph_1.createProjectGraphAsync)();
15
17
  const nxJson = (0, nx_json_1.readNxJson)();
16
18
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', {
@@ -59,6 +61,8 @@ async function showProjectsHandler(args) {
59
61
  console.log(project);
60
62
  }
61
63
  }
64
+ // TODO: Find a better fix for this
65
+ await new Promise((res) => setImmediate(res));
62
66
  await output_1.output.drain();
63
67
  }
64
68
  function getGraphNodesMatchingPatterns(graph, patterns) {
@@ -29,7 +29,7 @@ function syncHandler(options) {
29
29
  title: options.check
30
30
  ? 'The workspace is up to date'
31
31
  : 'The workspace is already up to date',
32
- bodyLines: syncGenerators.map((generator) => `The ${chalk.bold(generator)} sync generator didn't identify any files in the workspace that are out of sync.`),
32
+ bodyLines: syncGenerators.map((generator) => `[${chalk.bold(generator)}]: All files are up to date.`),
33
33
  });
34
34
  return 0;
35
35
  }
@@ -85,9 +85,9 @@ function syncHandler(options) {
85
85
  'Syncing the workspace failed with the following error:',
86
86
  '',
87
87
  e.message,
88
- ...(options.verbose && !!e.stack ? [`\n${e.stack}`] : []),
88
+ ...(!!e.stack ? [`\n${e.stack}`] : []),
89
89
  '',
90
- 'Please rerun with `--verbose` and report the error at: https://github.com/nrwl/nx/issues/new/choose',
90
+ 'Please report the error at: https://github.com/nrwl/nx/issues/new/choose',
91
91
  ],
92
92
  });
93
93
  return 1;