nx 19.6.0-canary.20240726-b3c67de → 19.6.0-canary.20240727-efa59fa

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": "19.6.0-canary.20240726-b3c67de",
3
+ "version": "19.6.0-canary.20240727-efa59fa",
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.6.0-canary.20240726-b3c67de"
74
+ "@nrwl/tao": "19.6.0-canary.20240727-efa59fa"
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.6.0-canary.20240726-b3c67de",
90
- "@nx/nx-darwin-arm64": "19.6.0-canary.20240726-b3c67de",
91
- "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240726-b3c67de",
92
- "@nx/nx-linux-x64-musl": "19.6.0-canary.20240726-b3c67de",
93
- "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240726-b3c67de",
94
- "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240726-b3c67de",
95
- "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240726-b3c67de",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240726-b3c67de",
97
- "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240726-b3c67de",
98
- "@nx/nx-freebsd-x64": "19.6.0-canary.20240726-b3c67de"
89
+ "@nx/nx-darwin-x64": "19.6.0-canary.20240727-efa59fa",
90
+ "@nx/nx-darwin-arm64": "19.6.0-canary.20240727-efa59fa",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240727-efa59fa",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-canary.20240727-efa59fa",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240727-efa59fa",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240727-efa59fa",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240727-efa59fa",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240727-efa59fa",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240727-efa59fa",
98
+ "@nx/nx-freebsd-x64": "19.6.0-canary.20240727-efa59fa"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -17,7 +17,7 @@ const find_matching_projects_1 = require("../../utils/find-matching-projects");
17
17
  const graph_1 = require("../graph/graph");
18
18
  const all_file_data_1 = require("../../utils/all-file-data");
19
19
  async function affected(command, args, extraTargetDependencies = {}, extraOptions = {
20
- excludeTaskDependencies: false,
20
+ excludeTaskDependencies: args.excludeTaskDependencies,
21
21
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
22
22
  }) {
23
23
  perf_hooks_1.performance.mark('code-loading:end');
@@ -311,6 +311,10 @@ exports.examples = {
311
311
  command: 'show projects --projects api-*',
312
312
  description: 'Show all projects with names starting with "api-". The "projects" option is useful to see which projects would be selected by run-many',
313
313
  },
314
+ {
315
+ command: 'show projects --projects tag:ui-*',
316
+ description: 'Show all projects with a tag starting with "ui-". The "projects" option is useful to see which projects would be selected by run-many',
317
+ },
314
318
  {
315
319
  command: 'show projects --with-target serve',
316
320
  description: 'Show all projects with a serve target',
@@ -48,7 +48,9 @@ async function releasePublish(args, isCLI = false) {
48
48
  * If the user is filtering to a subset of projects or groups, we should not run the publish task
49
49
  * for dependencies, because that could cause projects outset of the filtered set to be published.
50
50
  */
51
- const shouldExcludeTaskDependencies = _args.projects?.length > 0 || _args.groups?.length > 0;
51
+ const shouldExcludeTaskDependencies = _args.projects?.length > 0 ||
52
+ _args.groups?.length > 0 ||
53
+ args.excludeTaskDependencies;
52
54
  let overallExitStatus = 0;
53
55
  if (args.projects?.length) {
54
56
  /**
@@ -14,7 +14,7 @@ const calculate_default_project_name_1 = require("../../config/calculate-default
14
14
  const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
15
15
  const graph_1 = require("../graph/graph");
16
16
  async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
17
- excludeTaskDependencies: false,
17
+ excludeTaskDependencies: args.excludeTaskDependencies,
18
18
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
19
19
  }) {
20
20
  perf_hooks_1.performance.mark('code-loading:end');
@@ -15,7 +15,7 @@ const find_matching_projects_1 = require("../../utils/find-matching-projects");
15
15
  const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
16
16
  const graph_1 = require("../graph/graph");
17
17
  async function runMany(args, extraTargetDependencies = {}, extraOptions = {
18
- excludeTaskDependencies: false,
18
+ excludeTaskDependencies: args.excludeTaskDependencies,
19
19
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
20
20
  }) {
21
21
  perf_hooks_1.performance.mark('code-loading:end');
@@ -18,6 +18,7 @@ export interface RunOptions {
18
18
  dte: boolean;
19
19
  batch: boolean;
20
20
  useAgents: boolean;
21
+ excludeTaskDependencies: boolean;
21
22
  }
22
23
  export declare function withRunOptions<T>(yargs: Argv<T>): Argv<T & RunOptions>;
23
24
  export declare function withTargetAndConfigurationOption(yargs: Argv, demandOption?: boolean): Argv<{
@@ -66,6 +66,11 @@ function withRunOptions(yargs) {
66
66
  describe: 'Rerun the tasks even when the results are available in the cache',
67
67
  type: 'boolean',
68
68
  default: false,
69
+ })
70
+ .options('excludeTaskDependencies', {
71
+ describe: 'Skips running dependent tasks first',
72
+ type: 'boolean',
73
+ default: false,
69
74
  })
70
75
  .options('cloud', {
71
76
  type: 'boolean',
@@ -36,8 +36,10 @@ const recursiveResolveDeps = (projectGraph, projectName, resolved) => {
36
36
  };
37
37
  function createCommandGraph(projectGraph, projectNames, nxArgs) {
38
38
  const dependencies = {};
39
- for (const projectName of projectNames) {
40
- recursiveResolveDeps(projectGraph, projectName, dependencies);
39
+ if (!nxArgs.excludeTaskDependencies) {
40
+ for (const projectName of projectNames) {
41
+ recursiveResolveDeps(projectGraph, projectName, dependencies);
42
+ }
41
43
  }
42
44
  const roots = Object.keys(dependencies).filter((d) => dependencies[d].length === 0);
43
45
  const commandGraph = {
@@ -17,10 +17,10 @@ const workspace_context_1 = require("../../utils/workspace-context");
17
17
  const output_1 = require("../../utils/output");
18
18
  const path_2 = require("../../utils/path");
19
19
  const json_1 = require("./json");
20
- const nx_json_1 = require("./nx-json");
21
- var nx_json_2 = require("./nx-json");
22
- Object.defineProperty(exports, "readNxJson", { enumerable: true, get: function () { return nx_json_2.readNxJson; } });
23
- Object.defineProperty(exports, "updateNxJson", { enumerable: true, get: function () { return nx_json_2.updateNxJson; } });
20
+ const to_project_name_1 = require("../../config/to-project-name");
21
+ var nx_json_1 = require("./nx-json");
22
+ Object.defineProperty(exports, "readNxJson", { enumerable: true, get: function () { return nx_json_1.readNxJson; } });
23
+ Object.defineProperty(exports, "updateNxJson", { enumerable: true, get: function () { return nx_json_1.updateNxJson; } });
24
24
  /**
25
25
  * Adds project configuration to the Nx workspace.
26
26
  *
@@ -56,10 +56,35 @@ function addProjectConfiguration(tree, projectName, projectConfiguration, standa
56
56
  * @param projectConfiguration - project configuration
57
57
  */
58
58
  function updateProjectConfiguration(tree, projectName, projectConfiguration) {
59
- const projectConfigFile = (0, path_2.joinPathFragments)(projectConfiguration.root, 'project.json');
60
- if (!tree.exists(projectConfigFile)) {
59
+ if (tree.exists((0, path_2.joinPathFragments)(projectConfiguration.root, 'project.json'))) {
60
+ updateProjectConfigurationInProjectJson(tree, projectName, projectConfiguration);
61
+ }
62
+ else if (tree.exists((0, path_2.joinPathFragments)(projectConfiguration.root, 'package.json'))) {
63
+ updateProjectConfigurationInPackageJson(tree, projectName, projectConfiguration);
64
+ }
65
+ else {
61
66
  throw new Error(`Cannot update Project ${projectName} at ${projectConfiguration.root}. It either doesn't exist yet, or may not use project.json for configuration. Use \`addProjectConfiguration()\` instead if you want to create a new project.`);
62
67
  }
68
+ }
69
+ function updateProjectConfigurationInPackageJson(tree, projectName, projectConfiguration) {
70
+ const packageJsonFile = (0, path_2.joinPathFragments)(projectConfiguration.root, 'package.json');
71
+ const packageJson = (0, json_1.readJson)(tree, packageJsonFile);
72
+ if (packageJson.name === projectConfiguration.name ?? projectName) {
73
+ delete projectConfiguration.name;
74
+ }
75
+ if (projectConfiguration.targets &&
76
+ !Object.keys(projectConfiguration.targets).length) {
77
+ delete projectConfiguration.targets;
78
+ }
79
+ packageJson.nx = {
80
+ ...packageJson.nx,
81
+ ...projectConfiguration,
82
+ root: undefined,
83
+ };
84
+ (0, json_1.writeJson)(tree, packageJsonFile, packageJson);
85
+ }
86
+ function updateProjectConfigurationInProjectJson(tree, projectName, projectConfiguration) {
87
+ const projectConfigFile = (0, path_2.joinPathFragments)(projectConfiguration.root, 'project.json');
63
88
  handleEmptyTargets(projectName, projectConfiguration);
64
89
  (0, json_1.writeJson)(tree, projectConfigFile, {
65
90
  name: projectConfiguration.name ?? projectName,
@@ -147,15 +172,20 @@ function readAndCombineAllProjectConfigurations(tree) {
147
172
  }
148
173
  else if ((0, path_1.basename)(projectFile) === 'package.json') {
149
174
  const packageJson = (0, json_1.readJson)(tree, projectFile);
150
- const config = (0, package_json_1.buildProjectConfigurationFromPackageJson)(packageJson, tree.root, projectFile, (0, nx_json_1.readNxJson)(tree));
175
+ // We don't want to have all of the extra inferred stuff in here, as
176
+ // when generators update the project they shouldn't inline that stuff.
177
+ // so rather than using `buildProjectFromPackageJson` and stripping it out
178
+ // we are going to build the config manually.
179
+ const config = {
180
+ root: (0, path_1.dirname)(projectFile),
181
+ name: packageJson.name ?? (0, to_project_name_1.toProjectName)(projectFile),
182
+ ...packageJson.nx,
183
+ };
151
184
  if (!rootMap[config.root]) {
152
185
  (0, project_configuration_utils_1.mergeProjectConfigurationIntoRootMap)(rootMap,
153
186
  // Inferred targets, tags, etc don't show up when running generators
154
187
  // This is to help avoid running into issues when trying to update the workspace
155
- {
156
- name: config.name,
157
- root: config.root,
158
- }, undefined, undefined, true);
188
+ config, undefined, undefined, true);
159
189
  }
160
190
  }
161
191
  }
Binary file
@@ -29,6 +29,7 @@ export interface NxArgs {
29
29
  nxIgnoreCycles?: boolean;
30
30
  type?: string;
31
31
  batch?: boolean;
32
+ excludeTaskDependencies?: boolean;
32
33
  }
33
34
  export declare function createOverrides(__overrides_unparsed__?: string[]): Record<string, any>;
34
35
  export declare function splitArgsIntoNxArgsAndOverrides(args: {
@@ -1,13 +1,6 @@
1
- import { InputDefinition, ProjectMetadata, TargetConfiguration } from '../config/workspace-json-project-json';
1
+ import { ProjectConfiguration, ProjectMetadata, TargetConfiguration } from '../config/workspace-json-project-json';
2
2
  import { PackageManagerCommands } from './package-manager';
3
- export interface NxProjectPackageJsonConfiguration {
4
- name?: string;
5
- implicitDependencies?: string[];
6
- tags?: string[];
7
- namedInputs?: {
8
- [inputName: string]: (string | InputDefinition)[];
9
- };
10
- targets?: Record<string, TargetConfiguration>;
3
+ export interface NxProjectPackageJsonConfiguration extends Partial<ProjectConfiguration> {
11
4
  includedScripts?: string[];
12
5
  }
13
6
  export type ArrayPackageGroup = {