nx 20.4.0-canary.20250109-0edd110 → 20.4.0-canary.20250110-cbfc6fe

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.4.0-canary.20250109-0edd110",
3
+ "version": "20.4.0-canary.20250110-cbfc6fe",
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.4.0-canary.20250109-0edd110",
86
- "@nx/nx-darwin-x64": "20.4.0-canary.20250109-0edd110",
87
- "@nx/nx-freebsd-x64": "20.4.0-canary.20250109-0edd110",
88
- "@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.20250109-0edd110",
89
- "@nx/nx-linux-arm64-gnu": "20.4.0-canary.20250109-0edd110",
90
- "@nx/nx-linux-arm64-musl": "20.4.0-canary.20250109-0edd110",
91
- "@nx/nx-linux-x64-gnu": "20.4.0-canary.20250109-0edd110",
92
- "@nx/nx-linux-x64-musl": "20.4.0-canary.20250109-0edd110",
93
- "@nx/nx-win32-arm64-msvc": "20.4.0-canary.20250109-0edd110",
94
- "@nx/nx-win32-x64-msvc": "20.4.0-canary.20250109-0edd110"
85
+ "@nx/nx-darwin-arm64": "20.4.0-canary.20250110-cbfc6fe",
86
+ "@nx/nx-darwin-x64": "20.4.0-canary.20250110-cbfc6fe",
87
+ "@nx/nx-freebsd-x64": "20.4.0-canary.20250110-cbfc6fe",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.20250110-cbfc6fe",
89
+ "@nx/nx-linux-arm64-gnu": "20.4.0-canary.20250110-cbfc6fe",
90
+ "@nx/nx-linux-arm64-musl": "20.4.0-canary.20250110-cbfc6fe",
91
+ "@nx/nx-linux-x64-gnu": "20.4.0-canary.20250110-cbfc6fe",
92
+ "@nx/nx-linux-x64-musl": "20.4.0-canary.20250110-cbfc6fe",
93
+ "@nx/nx-win32-arm64-msvc": "20.4.0-canary.20250110-cbfc6fe",
94
+ "@nx/nx-win32-x64-msvc": "20.4.0-canary.20250110-cbfc6fe"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -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));
Binary file
@@ -112,6 +112,17 @@ function addMatchingProjectsByName(projectNames, projects, pattern, matchedProje
112
112
  return;
113
113
  }
114
114
  if (!(0, globs_1.isGlobPattern)(pattern.value)) {
115
+ // Custom regex that is basically \b without underscores, so "foo" pattern matches "foo_bar".
116
+ const regex = new RegExp(`(?<![a-zA-Z0-9])${pattern.value}(?![a-zA-Z0-9])`, 'i');
117
+ const matchingProjects = Object.keys(projects).filter((name) => regex.test(name));
118
+ for (const projectName of matchingProjects) {
119
+ if (pattern.exclude) {
120
+ matchedProjects.delete(projectName);
121
+ }
122
+ else {
123
+ matchedProjects.add(projectName);
124
+ }
125
+ }
115
126
  return;
116
127
  }
117
128
  const matchedProjectNames = (0, exports.getMatchingStringsWithCache)(pattern.value, projectNames);