nx 20.3.2 → 20.4.0-beta.1

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.3.2",
3
+ "version": "20.4.0-beta.1",
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": {
@@ -82,16 +82,16 @@
82
82
  }
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/nx-darwin-arm64": "20.3.2",
86
- "@nx/nx-darwin-x64": "20.3.2",
87
- "@nx/nx-freebsd-x64": "20.3.2",
88
- "@nx/nx-linux-arm-gnueabihf": "20.3.2",
89
- "@nx/nx-linux-arm64-gnu": "20.3.2",
90
- "@nx/nx-linux-arm64-musl": "20.3.2",
91
- "@nx/nx-linux-x64-gnu": "20.3.2",
92
- "@nx/nx-linux-x64-musl": "20.3.2",
93
- "@nx/nx-win32-arm64-msvc": "20.3.2",
94
- "@nx/nx-win32-x64-msvc": "20.3.2"
85
+ "@nx/nx-darwin-arm64": "20.4.0-beta.1",
86
+ "@nx/nx-darwin-x64": "20.4.0-beta.1",
87
+ "@nx/nx-freebsd-x64": "20.4.0-beta.1",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.4.0-beta.1",
89
+ "@nx/nx-linux-arm64-gnu": "20.4.0-beta.1",
90
+ "@nx/nx-linux-arm64-musl": "20.4.0-beta.1",
91
+ "@nx/nx-linux-x64-gnu": "20.4.0-beta.1",
92
+ "@nx/nx-linux-x64-musl": "20.4.0-beta.1",
93
+ "@nx/nx-win32-arm64-msvc": "20.4.0-beta.1",
94
+ "@nx/nx-win32-x64-msvc": "20.4.0-beta.1"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -114,7 +114,8 @@ function updateProjectOutputs(repoRoot, project) {
114
114
  else if (target.executor === '@angular-eslint/builder:lint') {
115
115
  target.outputs = ['{options.outputFile}'];
116
116
  }
117
- else if (target.executor === '@angular-devkit/build-angular:ng-packagr') {
117
+ else if (target.executor === '@angular-devkit/build-angular:ng-packagr' ||
118
+ target.executor === '@angular/build:ng-packagr') {
118
119
  try {
119
120
  const ngPackageJsonPath = (0, path_1.join)(repoRoot, target.options.project);
120
121
  const ngPackageJson = (0, fileutils_1.readJsonFile)(ngPackageJsonPath);
@@ -12,6 +12,7 @@ const output_1 = require("../../utils/output");
12
12
  const configuration_1 = require("../../config/configuration");
13
13
  const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
14
14
  const graph_1 = require("../graph/graph");
15
+ const find_matching_projects_1 = require("../../utils/find-matching-projects");
15
16
  async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
16
17
  excludeTaskDependencies: args.excludeTaskDependencies,
17
18
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
@@ -31,7 +32,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
31
32
  process.exit(0);
32
33
  }
33
34
  await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
34
- const { projects } = getProjects(projectGraph, opts.project);
35
+ const { projects, projectName } = getProjects(projectGraph, opts.project);
35
36
  if (nxArgs.graph) {
36
37
  const projectNames = projects.map((t) => t.name);
37
38
  const file = (0, command_line_utils_1.readGraphFileFromGraphArg)(nxArgs);
@@ -45,22 +46,45 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
45
46
  }, projectNames);
46
47
  }
47
48
  else {
48
- const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, opts.project, extraTargetDependencies, extraOptions);
49
+ const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
49
50
  process.exit(status);
50
51
  }
51
52
  }
52
- function getProjects(projectGraph, project) {
53
- if (!projectGraph.nodes[project]) {
54
- output_1.output.error({
55
- title: `Cannot find project '${project}'`,
56
- });
57
- process.exit(1);
53
+ function getProjects(projectGraph, projectName) {
54
+ if (projectGraph.nodes[projectName]) {
55
+ return {
56
+ projectName: projectName,
57
+ projects: [projectGraph.nodes[projectName]],
58
+ projectsMap: {
59
+ [projectName]: projectGraph.nodes[projectName],
60
+ },
61
+ };
58
62
  }
59
- let projects = [projectGraph.nodes[project]];
60
- let projectsMap = {
61
- [project]: projectGraph.nodes[project],
62
- };
63
- return { projects, projectsMap };
63
+ else {
64
+ const projects = (0, find_matching_projects_1.findMatchingProjects)([projectName], projectGraph.nodes);
65
+ if (projects.length === 1) {
66
+ const projectName = projects[0];
67
+ const project = projectGraph.nodes[projectName];
68
+ return {
69
+ projectName,
70
+ projects: [project],
71
+ projectsMap: {
72
+ [project.data.name]: project,
73
+ },
74
+ };
75
+ }
76
+ else if (projects.length > 1) {
77
+ output_1.output.error({
78
+ title: `Multiple projects matched:`,
79
+ bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
80
+ });
81
+ process.exit(1);
82
+ }
83
+ }
84
+ output_1.output.error({
85
+ title: `Cannot find project '${projectName}'`,
86
+ });
87
+ process.exit(1);
64
88
  }
65
89
  const targetAliases = {
66
90
  b: 'build',
@@ -4,14 +4,32 @@ exports.showProjectHandler = showProjectHandler;
4
4
  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
+ const find_matching_projects_1 = require("../../utils/find-matching-projects");
7
8
  async function showProjectHandler(args) {
8
9
  performance.mark('code-loading:end');
9
10
  performance.measure('code-loading', 'init-local', 'code-loading:end');
10
11
  const graph = await (0, project_graph_1.createProjectGraphAsync)();
11
- const node = graph.nodes[args.projectName];
12
+ let node = graph.nodes[args.projectName];
12
13
  if (!node) {
13
- console.log(`Could not find project ${args.projectName}`);
14
- process.exit(1);
14
+ const projects = (0, find_matching_projects_1.findMatchingProjects)([args.projectName], graph.nodes);
15
+ if (projects.length === 1) {
16
+ const projectName = projects[0];
17
+ node = graph.nodes[projectName];
18
+ }
19
+ else if (projects.length > 1) {
20
+ output_1.output.error({
21
+ title: `Multiple projects matched:`,
22
+ bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
23
+ });
24
+ console.log(`Multiple projects matched:\n ${(projects.length > 100
25
+ ? [...projects.slice(0, 100), '...']
26
+ : projects).join(' \n')}`);
27
+ process.exit(1);
28
+ }
29
+ else {
30
+ console.log(`Could not find project ${args.projectName}`);
31
+ process.exit(1);
32
+ }
15
33
  }
16
34
  if (args.json) {
17
35
  console.log(JSON.stringify(node.data));
@@ -15,6 +15,7 @@ export interface RunOptions {
15
15
  nxBail: boolean;
16
16
  nxIgnoreCycles: boolean;
17
17
  skipNxCache: boolean;
18
+ skipRemoteCache: boolean;
18
19
  cloud: boolean;
19
20
  dte: boolean;
20
21
  batch: boolean;
@@ -75,6 +75,13 @@ function withRunOptions(yargs) {
75
75
  describe: 'Rerun the tasks even when the results are available in the cache.',
76
76
  type: 'boolean',
77
77
  default: false,
78
+ alias: 'disableNxCache',
79
+ })
80
+ .options('skipRemoteCache', {
81
+ type: 'boolean',
82
+ describe: 'Disables the remote cache.',
83
+ default: false,
84
+ alias: 'disableRemoteCache',
78
85
  })
79
86
  .options('excludeTaskDependencies', {
80
87
  describe: 'Skips running dependent tasks first.',