nx 19.6.0-canary.20240726-b3c67de → 19.6.0-canary.20240730-acd9bb7

Sign up to get free protection for your applications and to get access to all the features.
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.20240730-acd9bb7",
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.20240730-acd9bb7"
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.20240730-acd9bb7",
90
+ "@nx/nx-darwin-arm64": "19.6.0-canary.20240730-acd9bb7",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240730-acd9bb7",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-canary.20240730-acd9bb7",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240730-acd9bb7",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240730-acd9bb7",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240730-acd9bb7",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240730-acd9bb7",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240730-acd9bb7",
98
+ "@nx/nx-freebsd-x64": "19.6.0-canary.20240730-acd9bb7"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -25,10 +25,11 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
25
25
  }
26
26
  }
27
27
  }
28
+ let relevantChanges = changes;
28
29
  // workspace root level changelog
29
30
  if (project === null) {
30
31
  // No changes for the workspace
31
- if (changes.length === 0) {
32
+ if (relevantChanges.length === 0) {
32
33
  if (dependencyBumps?.length) {
33
34
  applyAdditionalDependencyBumps({
34
35
  markdownLines,
@@ -42,7 +43,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
42
43
  }
43
44
  return markdownLines.join('\n').trim();
44
45
  }
45
- const typeGroups = groupBy(changes, 'type');
46
+ const typeGroups = groupBy(relevantChanges, 'type');
46
47
  markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
47
48
  for (const type of Object.keys(changeTypes)) {
48
49
  const group = typeGroups[type];
@@ -75,7 +76,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
75
76
  }
76
77
  else {
77
78
  // project level changelog
78
- const relevantChanges = changes.filter((c) => c.affectedProjects &&
79
+ relevantChanges = relevantChanges.filter((c) => c.affectedProjects &&
79
80
  (c.affectedProjects === '*' || c.affectedProjects.includes(project)));
80
81
  // Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
81
82
  if (relevantChanges.length === 0) {
@@ -128,7 +129,7 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
128
129
  }
129
130
  if (changelogRenderOptions.authors) {
130
131
  const _authors = new Map();
131
- for (const change of changes) {
132
+ for (const change of relevantChanges) {
132
133
  if (!change.author) {
133
134
  continue;
134
135
  }
@@ -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',
@@ -296,6 +296,7 @@ async function releaseChangelog(args) {
296
296
  let fromRef = args.from ||
297
297
  (await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {
298
298
  projectName: project.name,
299
+ releaseGroupName: releaseGroup.name,
299
300
  }))?.tag;
300
301
  if (!fromRef && useAutomaticFromRef) {
301
302
  const firstCommit = await (0, git_1.getFirstGitCommit)();
@@ -73,6 +73,10 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
73
73
  tag: true,
74
74
  };
75
75
  const defaultFixedReleaseTagPattern = 'v{version}';
76
+ /**
77
+ * TODO: in v20, make it so that this pattern is used by default when any custom groups are used
78
+ */
79
+ const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}';
76
80
  const defaultIndependentReleaseTagPattern = '{projectName}@{version}';
77
81
  const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed';
78
82
  const defaultGeneratorOptions = {};
@@ -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
  /**
@@ -169,6 +169,7 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
169
169
  if (projectVersionData.newVersion !== null) {
170
170
  tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
171
171
  version: projectVersionData.newVersion,
172
+ releaseGroupName: releaseGroup.name,
172
173
  }));
173
174
  }
174
175
  }
@@ -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 = {