nx 23.0.0-beta.12 → 23.0.0-beta.14

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 (63) hide show
  1. package/dist/src/command-line/examples.js +1 -1
  2. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +14 -18
  3. package/dist/src/command-line/init/implementation/utils.d.ts +7 -1
  4. package/dist/src/command-line/init/implementation/utils.js +44 -14
  5. package/dist/src/command-line/release/config/config.d.ts +3 -6
  6. package/dist/src/command-line/release/config/config.js +77 -45
  7. package/dist/src/command-line/release/utils/release-graph.js +2 -3
  8. package/dist/src/command-line/release/utils/repository-git-tags.js +1 -1
  9. package/dist/src/command-line/release/version/resolve-current-version.js +1 -1
  10. package/dist/src/command-line/show/show-target/info.js +4 -5
  11. package/dist/src/command-line/watch/command-object.js +24 -4
  12. package/dist/src/command-line/watch/watch.d.ts +7 -0
  13. package/dist/src/command-line/watch/watch.js +1 -1
  14. package/dist/src/config/nx-json.d.ts +43 -56
  15. package/dist/src/core/graph/main.js +1 -1
  16. package/dist/src/daemon/client/client.d.ts +1 -1
  17. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +1 -1
  18. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
  19. package/dist/src/devkit-exports.d.ts +1 -1
  20. package/dist/src/devkit-internals.d.ts +1 -0
  21. package/dist/src/devkit-internals.js +4 -1
  22. package/dist/src/executors/run-commands/running-tasks.d.ts +7 -0
  23. package/dist/src/executors/run-commands/running-tasks.js +178 -105
  24. package/dist/src/executors/run-script/run-script.impl.js +3 -10
  25. package/dist/src/hasher/task-hasher.js +6 -4
  26. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +6 -2
  27. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +20 -4
  28. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
  29. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
  30. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.d.ts +35 -0
  31. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.js +139 -0
  32. package/dist/src/native/index.d.ts +18 -1
  33. package/dist/src/native/native-bindings.js +2 -0
  34. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  35. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  36. package/dist/src/project-graph/plugins/utils.js +13 -7
  37. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +95 -4
  38. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +515 -68
  39. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +13 -5
  40. package/dist/src/project-graph/utils/project-configuration-utils.js +14 -6
  41. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  42. package/dist/src/tasks-runner/forked-process-task-runner.js +11 -6
  43. package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -15
  44. package/dist/src/tasks-runner/init-tasks-runner.js +0 -63
  45. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
  46. package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
  47. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  48. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  49. package/dist/src/tasks-runner/run-command.js +0 -10
  50. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
  51. package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -5
  52. package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
  53. package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -7
  54. package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
  55. package/dist/src/tasks-runner/task-orchestrator.js +33 -24
  56. package/dist/src/tasks-runner/utils.d.ts +6 -4
  57. package/dist/src/tasks-runner/utils.js +26 -7
  58. package/dist/src/utils/package-json.js +10 -1
  59. package/migrations.json +11 -0
  60. package/package.json +11 -20
  61. package/schemas/nx-schema.json +114 -80
  62. package/dist/src/index.d.ts +0 -1
  63. package/dist/src/index.js +0 -5
@@ -378,7 +378,7 @@ exports.examples = {
378
378
  description: 'Watch the "app" project and echo the project name and the files that changed',
379
379
  },
380
380
  {
381
- command: 'watch --projects=app1,app2 --includeDependentProjects -- echo \\$NX_PROJECT_NAME',
381
+ command: 'watch --projects=app1,app2 --includeDependencies -- echo \\$NX_PROJECT_NAME',
382
382
  description: 'Watch "app1" and "app2" and echo the project name whenever a specified project or its dependencies change',
383
383
  },
384
384
  {
@@ -54,29 +54,26 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
54
54
  : []),
55
55
  ].filter(Boolean),
56
56
  };
57
- nxJson.targetDefaults ??= {};
57
+ const defaults = Array.isArray(nxJson.targetDefaults)
58
+ ? [...nxJson.targetDefaults]
59
+ : [];
58
60
  if (workspaceTargets.includes('build')) {
59
- nxJson.targetDefaults.build = {
60
- ...nxJson.targetDefaults.build,
61
+ (0, utils_1.upsertTargetDefaultEntry)(defaults, 'build', {
61
62
  dependsOn: ['^build'],
62
63
  inputs: ['production', '^production'],
63
- };
64
+ });
64
65
  }
65
66
  if (workspaceTargets.includes('server')) {
66
- nxJson.targetDefaults.server = {
67
- ...nxJson.targetDefaults.server,
67
+ (0, utils_1.upsertTargetDefaultEntry)(defaults, 'server', {
68
68
  inputs: ['production', '^production'],
69
- };
69
+ });
70
70
  }
71
71
  if (workspaceTargets.includes('test')) {
72
72
  const inputs = ['default', '^production'];
73
73
  if ((0, fileutils_1.fileExists)((0, node_path_1.join)(repoRoot, 'karma.conf.js'))) {
74
74
  inputs.push('{workspaceRoot}/karma.conf.js');
75
75
  }
76
- nxJson.targetDefaults.test = {
77
- ...nxJson.targetDefaults.test,
78
- inputs,
79
- };
76
+ (0, utils_1.upsertTargetDefaultEntry)(defaults, 'test', { inputs });
80
77
  }
81
78
  if (workspaceTargets.includes('lint')) {
82
79
  const inputs = ['default'];
@@ -86,16 +83,15 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
86
83
  if ((0, fileutils_1.fileExists)((0, node_path_1.join)(repoRoot, 'eslint.config.cjs'))) {
87
84
  inputs.push('{workspaceRoot}/eslint.config.cjs');
88
85
  }
89
- nxJson.targetDefaults.lint = {
90
- ...nxJson.targetDefaults.lint,
91
- inputs,
92
- };
86
+ (0, utils_1.upsertTargetDefaultEntry)(defaults, 'lint', { inputs });
93
87
  }
94
88
  if (workspaceTargets.includes('e2e')) {
95
- nxJson.targetDefaults.e2e = {
96
- ...nxJson.targetDefaults.e2e,
89
+ (0, utils_1.upsertTargetDefaultEntry)(defaults, 'e2e', {
97
90
  inputs: ['default', '^production'],
98
- };
91
+ });
92
+ }
93
+ if (defaults.length > 0) {
94
+ nxJson.targetDefaults = defaults;
99
95
  }
100
96
  (0, fileutils_1.writeJsonFile)((0, node_path_1.join)(repoRoot, 'nx.json'), nxJson);
101
97
  }
@@ -1,9 +1,15 @@
1
- import { NxJsonConfiguration } from '../../../config/nx-json';
1
+ import { NxJsonConfiguration, TargetDefaultEntry } from '../../../config/nx-json';
2
2
  import { PackageJson } from '../../../utils/package-json';
3
3
  import { PackageManagerCommands } from '../../../utils/package-manager';
4
4
  export declare function createNxJsonFile(repoRoot: string, topologicalTargets: string[], cacheableOperations: string[], scriptOutputs: {
5
5
  [name: string]: string;
6
6
  }): void;
7
+ /**
8
+ * Locate-by-target upsert against an in-memory `targetDefaults` array.
9
+ * Used by `nx init` code paths that operate on raw JSON before a Tree
10
+ * exists — generators should use `upsertTargetDefault` from devkit instead.
11
+ */
12
+ export declare function upsertTargetDefaultEntry(entries: TargetDefaultEntry[], target: string, patch: Partial<TargetDefaultEntry>): void;
7
13
  export declare function createNxJsonFromTurboJson(turboJson: Record<string, any>): NxJsonConfiguration;
8
14
  export declare function addDepsToPackageJson(repoRoot: string, additionalPackages?: string[]): void;
9
15
  export declare function updateGitIgnore(root: string): void;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNxJsonFile = createNxJsonFile;
4
+ exports.upsertTargetDefaultEntry = upsertTargetDefaultEntry;
4
5
  exports.createNxJsonFromTurboJson = createNxJsonFromTurboJson;
5
6
  exports.addDepsToPackageJson = addDepsToPackageJson;
6
7
  exports.updateGitIgnore = updateGitIgnore;
@@ -34,27 +35,37 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
34
35
  }
35
36
  catch { }
36
37
  nxJson.$schema = './node_modules/nx/schemas/nx-schema.json';
37
- nxJson.targetDefaults ??= {};
38
+ const entries = Array.isArray(nxJson.targetDefaults)
39
+ ? [...nxJson.targetDefaults]
40
+ : [];
38
41
  if (topologicalTargets.length > 0) {
39
42
  for (const scriptName of topologicalTargets) {
40
- nxJson.targetDefaults[scriptName] ??= {};
41
- nxJson.targetDefaults[scriptName] = { dependsOn: [`^${scriptName}`] };
43
+ upsertTargetDefaultEntry(entries, scriptName, {
44
+ dependsOn: [`^${scriptName}`],
45
+ });
42
46
  }
43
47
  }
44
48
  for (const [scriptName, output] of Object.entries(scriptOutputs)) {
45
49
  if (!output) {
46
50
  continue;
47
51
  }
48
- nxJson.targetDefaults[scriptName] ??= {};
49
- nxJson.targetDefaults[scriptName].outputs = [`{projectRoot}/${output}`];
52
+ upsertTargetDefaultEntry(entries, scriptName, {
53
+ outputs: [`{projectRoot}/${output}`],
54
+ });
50
55
  }
51
56
  for (const target of cacheableOperations) {
52
- nxJson.targetDefaults[target] ??= {};
53
- nxJson.targetDefaults[target].cache ??= true;
57
+ const existing = findUnfilteredTargetEntry(entries, target);
58
+ if (existing)
59
+ existing.cache ??= true;
60
+ else
61
+ entries.push({ target, cache: true });
54
62
  }
55
- if (Object.keys(nxJson.targetDefaults).length === 0) {
63
+ if (entries.length === 0) {
56
64
  delete nxJson.targetDefaults;
57
65
  }
66
+ else {
67
+ nxJson.targetDefaults = entries;
68
+ }
58
69
  const defaultBase = (0, deduce_default_base_1.deduceDefaultBase)();
59
70
  // Do not add defaultBase if it is inferred to be the Nx default value of main
60
71
  if (defaultBase !== 'main') {
@@ -62,6 +73,21 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
62
73
  }
63
74
  (0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
64
75
  }
76
+ /**
77
+ * Locate-by-target upsert against an in-memory `targetDefaults` array.
78
+ * Used by `nx init` code paths that operate on raw JSON before a Tree
79
+ * exists — generators should use `upsertTargetDefault` from devkit instead.
80
+ */
81
+ function upsertTargetDefaultEntry(entries, target, patch) {
82
+ const existing = findUnfilteredTargetEntry(entries, target);
83
+ if (existing)
84
+ Object.assign(existing, patch, { target });
85
+ else
86
+ entries.push({ ...patch, target });
87
+ }
88
+ function findUnfilteredTargetEntry(entries, target) {
89
+ return entries.find((e) => e.target === target && e.projects === undefined && e.plugin === undefined);
90
+ }
65
91
  function createNxJsonFromTurboJson(turboJson) {
66
92
  const nxJson = {
67
93
  $schema: './node_modules/nx/schemas/nx-schema.json',
@@ -88,20 +114,20 @@ function createNxJsonFromTurboJson(turboJson) {
88
114
  }
89
115
  // Handle task configurations
90
116
  if (turboJson.tasks) {
91
- nxJson.targetDefaults = {};
117
+ const entries = [];
92
118
  for (const [taskName, taskConfig] of Object.entries(turboJson.tasks)) {
93
119
  // Skip project-specific tasks (containing #)
94
120
  if (taskName.includes('#'))
95
121
  continue;
96
122
  const config = taskConfig;
97
- nxJson.targetDefaults[taskName] = {};
123
+ const entry = { target: taskName };
98
124
  // Handle dependsOn
99
125
  if (config.dependsOn?.length > 0) {
100
- nxJson.targetDefaults[taskName].dependsOn = config.dependsOn;
126
+ entry.dependsOn = config.dependsOn;
101
127
  }
102
128
  // Handle inputs
103
129
  if (config.inputs?.length > 0) {
104
- nxJson.targetDefaults[taskName].inputs = config.inputs
130
+ entry.inputs = config.inputs
105
131
  .map((input) => {
106
132
  if (input === '$TURBO_DEFAULT$') {
107
133
  return '{projectRoot}/**/*';
@@ -124,7 +150,7 @@ function createNxJsonFromTurboJson(turboJson) {
124
150
  }
125
151
  // Handle outputs
126
152
  if (config.outputs?.length > 0) {
127
- nxJson.targetDefaults[taskName].outputs = config.outputs.map((output) => {
153
+ entry.outputs = config.outputs.map((output) => {
128
154
  // Don't add projectRoot if it's already there
129
155
  if (output.startsWith('{projectRoot}/'))
130
156
  return output;
@@ -136,7 +162,11 @@ function createNxJsonFromTurboJson(turboJson) {
136
162
  });
137
163
  }
138
164
  // Handle cache setting - true by default in Turbo
139
- nxJson.targetDefaults[taskName].cache = config.cache !== false;
165
+ entry.cache = config.cache !== false;
166
+ entries.push(entry);
167
+ }
168
+ if (entries.length > 0) {
169
+ nxJson.targetDefaults = entries;
140
170
  }
141
171
  }
142
172
  /**
@@ -29,9 +29,6 @@ type RemoveBooleanFromProperties<T, K extends keyof T> = {
29
29
  type RemoveBooleanFromPropertiesOnEach<T, K extends keyof T[keyof T]> = {
30
30
  [U in keyof T]: RemoveBooleanFromProperties<T[U], K>;
31
31
  };
32
- type RemoveDeprecatedPropertiesFromEach<T> = {
33
- [K in keyof T]: Omit<T[K], 'releaseTagPattern' | 'releaseTagPatternCheckAllBranchesWhen' | 'releaseTagPatternRequireSemver' | 'releaseTagPatternPreferDockerVersion' | 'releaseTagPatternStrictPreid'>;
34
- };
35
32
  export declare const IMPLICIT_DEFAULT_RELEASE_GROUP = "__default__";
36
33
  export declare const DEFAULT_VERSION_ACTIONS_PATH = "@nx/js/src/release/version-actions";
37
34
  /**
@@ -44,17 +41,17 @@ export declare const DEFAULT_VERSION_ACTIONS_PATH = "@nx/js/src/release/version-
44
41
  * pattern such as directories and globs).
45
42
  */
46
43
  export type NxReleaseConfig = Omit<DeepRequired<NxReleaseConfiguration & {
47
- groups: RemoveDeprecatedPropertiesFromEach<EnsureDockerOptional<DeepRequired<RemoveTrueFromPropertiesOnEach<EnsureProjectsArray<NxReleaseConfiguration['groups']>, 'changelog' | 'docker'>>>>;
44
+ groups: EnsureDockerOptional<DeepRequired<RemoveTrueFromPropertiesOnEach<EnsureProjectsArray<NxReleaseConfiguration['groups']>, 'changelog' | 'docker'>>>;
48
45
  changelog: RemoveTrueFromProperties<DeepRequired<NxReleaseConfiguration['changelog']>, 'workspaceChangelog' | 'projectChangelogs'>;
49
46
  conventionalCommits: {
50
47
  types: RemoveBooleanFromPropertiesOnEach<DeepRequired<RemoveBooleanFromProperties<DeepRequired<NxReleaseConfiguration['conventionalCommits']['types']>, string>>, 'changelog'>;
51
48
  };
52
- }>, 'projects' | 'docker' | 'releaseTagPattern' | 'releaseTagPatternCheckAllBranchesWhen' | 'releaseTagPatternRequireSemver' | 'releaseTagPatternPreferDockerVersion' | 'releaseTagPatternStrictPreid'> & {
49
+ }>, 'projects' | 'docker'> & {
53
50
  docker: DeepRequired<NxReleaseDockerConfiguration> | undefined;
54
51
  releaseTag: DeepRequired<NonNullable<NxReleaseConfiguration['releaseTag']>>;
55
52
  };
56
53
  export interface CreateNxReleaseConfigError {
57
- code: 'PROJECTS_AND_GROUPS_DEFINED' | 'RELEASE_GROUP_MATCHES_NO_PROJECTS' | 'RELEASE_GROUP_RELEASE_TAG_PATTERN_VERSION_PLACEHOLDER_MISSING_OR_EXCESSIVE' | 'PROJECT_MATCHES_MULTIPLE_GROUPS' | 'CONVENTIONAL_COMMITS_SHORTHAND_MIXED_WITH_OVERLAPPING_OPTIONS' | 'GLOBAL_GIT_CONFIG_MIXED_WITH_GRANULAR_GIT_CONFIG' | 'CANNOT_RESOLVE_CHANGELOG_RENDERER' | 'INVALID_CHANGELOG_CREATE_RELEASE_PROVIDER' | 'INVALID_CHANGELOG_CREATE_RELEASE_HOSTNAME' | 'INVALID_CHANGELOG_CREATE_RELEASE_API_BASE_URL' | 'DOCKER_VERSION_SCHEME_USES_VERSION_ACTIONS_VERSION_WHEN_SKIP_VERSION_ACTIONS' | 'GIT_PUSH_FALSE_WITH_CREATE_RELEASE';
54
+ code: 'PROJECTS_AND_GROUPS_DEFINED' | 'RELEASE_GROUP_MATCHES_NO_PROJECTS' | 'RELEASE_GROUP_RELEASE_TAG_PATTERN_VERSION_PLACEHOLDER_MISSING_OR_EXCESSIVE' | 'PROJECT_MATCHES_MULTIPLE_GROUPS' | 'CONVENTIONAL_COMMITS_SHORTHAND_MIXED_WITH_OVERLAPPING_OPTIONS' | 'GLOBAL_GIT_CONFIG_MIXED_WITH_GRANULAR_GIT_CONFIG' | 'CANNOT_RESOLVE_CHANGELOG_RENDERER' | 'INVALID_CHANGELOG_CREATE_RELEASE_PROVIDER' | 'INVALID_CHANGELOG_CREATE_RELEASE_HOSTNAME' | 'INVALID_CHANGELOG_CREATE_RELEASE_API_BASE_URL' | 'DOCKER_VERSION_SCHEME_USES_VERSION_ACTIONS_VERSION_WHEN_SKIP_VERSION_ACTIONS' | 'GIT_PUSH_FALSE_WITH_CREATE_RELEASE' | 'LEGACY_RELEASE_TAG_PATTERN_PROPERTIES_DETECTED';
58
55
  data: Record<string, string | string[]>;
59
56
  }
60
57
  export declare function createNxReleaseConfig(projectGraph: ProjectGraph, projectFileMap: ProjectFileMap, userConfig?: NxJsonConfiguration['release']): Promise<{
@@ -30,8 +30,56 @@ const resolve_nx_json_error_message_1 = require("../utils/resolve-nx-json-error-
30
30
  const conventional_commits_1 = require("./conventional-commits");
31
31
  exports.IMPLICIT_DEFAULT_RELEASE_GROUP = '__default__';
32
32
  exports.DEFAULT_VERSION_ACTIONS_PATH = '@nx/js/src/release/version-actions';
33
+ // TODO(v24): remove this helper, the call site in createNxReleaseConfig, and
34
+ // the corresponding handleNxReleaseConfigError case. The deprecated flat
35
+ // `releaseTagPattern*` properties were moved to the nested `releaseTag`
36
+ // object in Nx 22 and the consolidation migration runs again in Nx 23 to
37
+ // catch any configs added after the v22 migration. Once Nx 24 lands, configs
38
+ // that still carry the legacy keys are expected to have been repaired via
39
+ // `nx repair`, and we can drop this back-compat error path entirely.
40
+ const LEGACY_RELEASE_TAG_PROPERTY_NAMES = [
41
+ 'releaseTagPattern',
42
+ 'releaseTagPatternCheckAllBranchesWhen',
43
+ 'releaseTagPatternRequireSemver',
44
+ 'releaseTagPatternPreferDockerVersion',
45
+ 'releaseTagPatternStrictPreid',
46
+ ];
47
+ function detectLegacyReleaseTagProperties(userConfig) {
48
+ if (!userConfig) {
49
+ return [];
50
+ }
51
+ const detected = [];
52
+ const collect = (config, pathPrefix) => {
53
+ if (!config) {
54
+ return;
55
+ }
56
+ for (const key of LEGACY_RELEASE_TAG_PROPERTY_NAMES) {
57
+ if (key in config) {
58
+ detected.push(`${pathPrefix}.${key}`);
59
+ }
60
+ }
61
+ };
62
+ collect(userConfig, 'release');
63
+ if (userConfig.groups) {
64
+ for (const [groupName, groupConfig] of Object.entries(userConfig.groups)) {
65
+ collect(groupConfig, `release.groups.${groupName}`);
66
+ }
67
+ }
68
+ return detected;
69
+ }
33
70
  // Apply default configuration to any optional user configuration and handle known errors
34
71
  async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig = {}) {
72
+ // TODO(v24): remove this back-compat error along with detectLegacyReleaseTagProperties
73
+ const legacyReleaseTagProperties = detectLegacyReleaseTagProperties(userConfig);
74
+ if (legacyReleaseTagProperties.length > 0) {
75
+ return {
76
+ error: {
77
+ code: 'LEGACY_RELEASE_TAG_PATTERN_PROPERTIES_DETECTED',
78
+ data: { properties: legacyReleaseTagProperties },
79
+ },
80
+ nxReleaseConfig: null,
81
+ };
82
+ }
35
83
  if (userConfig.projects && userConfig.groups) {
36
84
  return {
37
85
  error: {
@@ -194,8 +242,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
194
242
  preserveMatchingDependencyRanges: userConfig.version?.preserveMatchingDependencyRanges ?? true,
195
243
  logUnchangedProjects: userConfig.version?.logUnchangedProjects ?? true,
196
244
  updateDependents: userConfig.version?.updateDependents ?? 'always',
197
- // TODO(v23): change the default value of this to true
198
- adjustSemverBumpsForZeroMajorVersion: userConfig.version?.adjustSemverBumpsForZeroMajorVersion ?? false,
245
+ adjustSemverBumpsForZeroMajorVersion: userConfig.version?.adjustSemverBumpsForZeroMajorVersion ?? true,
199
246
  },
200
247
  changelog: {
201
248
  git: changelogGitDefaults,
@@ -232,22 +279,15 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
232
279
  },
233
280
  releaseTag: {
234
281
  pattern: userConfig.releaseTag?.pattern ||
235
- userConfig.releaseTagPattern ||
236
282
  // The appropriate default pattern is dependent upon the projectRelationships
237
283
  (workspaceProjectsRelationship === 'independent'
238
284
  ? defaultIndependentReleaseTagPattern
239
285
  : defaultFixedReleaseTagPattern),
240
- checkAllBranchesWhen: userConfig.releaseTag?.checkAllBranchesWhen ??
241
- userConfig.releaseTagPatternCheckAllBranchesWhen ??
242
- undefined,
286
+ checkAllBranchesWhen: userConfig.releaseTag?.checkAllBranchesWhen ?? undefined,
243
287
  requireSemver: userConfig.releaseTag?.requireSemver ??
244
- userConfig.releaseTagPatternRequireSemver ??
245
288
  defaultReleaseTagPatternRequireSemver,
246
- preferDockerVersion: userConfig.releaseTag?.preferDockerVersion ??
247
- userConfig.releaseTagPatternPreferDockerVersion ??
248
- false,
289
+ preferDockerVersion: userConfig.releaseTag?.preferDockerVersion ?? false,
249
290
  strictPreid: userConfig.releaseTag?.strictPreid ??
250
- userConfig.releaseTagPatternStrictPreid ??
251
291
  defaultReleaseTagPatternStrictPreid,
252
292
  },
253
293
  conventionalCommits: conventional_commits_1.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
@@ -256,11 +296,8 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
256
296
  };
257
297
  const groupProjectsRelationship = userConfig.projectsRelationship || WORKSPACE_DEFAULTS.projectsRelationship;
258
298
  const groupReleaseTagRequireSemver = userConfig.releaseTag?.requireSemver ??
259
- userConfig.releaseTagPatternRequireSemver ??
260
299
  WORKSPACE_DEFAULTS.releaseTag.requireSemver;
261
- const groupReleaseTagStrictPreid = userConfig.releaseTag?.strictPreid ??
262
- userConfig.releaseTagPatternStrictPreid ??
263
- defaultReleaseTagPatternStrictPreid;
300
+ const groupReleaseTagStrictPreid = userConfig.releaseTag?.strictPreid ?? defaultReleaseTagPatternStrictPreid;
264
301
  const groupDocker = normalizeDockerConfig(userConfig.docker ?? WORKSPACE_DEFAULTS.docker);
265
302
  const GROUP_DEFAULTS = {
266
303
  projectsRelationship: groupProjectsRelationship,
@@ -299,9 +336,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
299
336
  ? WORKSPACE_DEFAULTS.releaseTag.pattern
300
337
  : defaultIndependentReleaseTagPattern
301
338
  : WORKSPACE_DEFAULTS.releaseTag.pattern,
302
- checkAllBranchesWhen: userConfig.releaseTag?.checkAllBranchesWhen ??
303
- userConfig.releaseTagPatternCheckAllBranchesWhen ??
304
- undefined,
339
+ checkAllBranchesWhen: userConfig.releaseTag?.checkAllBranchesWhen ?? undefined,
305
340
  requireSemver: groupReleaseTagRequireSemver,
306
341
  preferDockerVersion: false,
307
342
  strictPreid: groupReleaseTagStrictPreid,
@@ -394,19 +429,14 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
394
429
  // If the user has set something custom for releaseTag at the top level, respect it for the implicit default group
395
430
  releaseTag: {
396
431
  pattern: userConfig.releaseTag?.pattern ||
397
- userConfig.releaseTagPattern ||
398
432
  GROUP_DEFAULTS.releaseTag.pattern,
399
433
  checkAllBranchesWhen: userConfig.releaseTag?.checkAllBranchesWhen ??
400
- userConfig.releaseTagPatternCheckAllBranchesWhen ??
401
434
  GROUP_DEFAULTS.releaseTag.checkAllBranchesWhen,
402
435
  requireSemver: userConfig.releaseTag?.requireSemver ??
403
- userConfig.releaseTagPatternRequireSemver ??
404
436
  GROUP_DEFAULTS.releaseTag.requireSemver,
405
437
  preferDockerVersion: userConfig.releaseTag?.preferDockerVersion ??
406
- userConfig.releaseTagPatternPreferDockerVersion ??
407
438
  GROUP_DEFAULTS.releaseTag.preferDockerVersion,
408
439
  strictPreid: userConfig.releaseTag?.strictPreid ??
409
- userConfig.releaseTagPatternStrictPreid ??
410
440
  GROUP_DEFAULTS.releaseTag.strictPreid,
411
441
  },
412
442
  // Directly inherit the root level config for projectChangelogs, if set
@@ -435,7 +465,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
435
465
  };
436
466
  }
437
467
  // If provided, ensure release tag pattern is valid
438
- const releaseTagPattern = releaseGroup.releaseTag?.pattern || releaseGroup.releaseTagPattern;
468
+ const releaseTagPattern = releaseGroup.releaseTag?.pattern;
439
469
  if (releaseTagPattern) {
440
470
  const error = ensureReleaseGroupReleaseTagPatternIsValid(releaseTagPattern, releaseGroupName);
441
471
  if (error) {
@@ -452,7 +482,6 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
452
482
  ? WORKSPACE_DEFAULTS.releaseTag.pattern
453
483
  : defaultIndependentReleaseTagPattern
454
484
  : (userConfig?.releaseTag?.pattern ??
455
- userConfig?.releaseTagPattern ??
456
485
  defaultFixedGroupReleaseTagPattern);
457
486
  // Initialize releaseTag object if it doesn't exist
458
487
  if (!releaseGroup.releaseTag) {
@@ -511,36 +540,25 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
511
540
  : false,
512
541
  releaseTag: {
513
542
  pattern: releaseGroup.releaseTag?.pattern ||
514
- releaseGroup.releaseTagPattern ||
515
543
  // The appropriate group default pattern is dependent upon the projectRelationships
516
544
  (projectsRelationship === 'independent'
517
545
  ? // If the default pattern contains {projectName} then it will create unique release tags for each project.
518
546
  // Otherwise, use the default value to guarantee unique tags
519
- (userConfig.releaseTag?.pattern || userConfig.releaseTagPattern)?.includes('{projectName}')
520
- ? userConfig.releaseTag?.pattern || userConfig.releaseTagPattern
547
+ userConfig.releaseTag?.pattern?.includes('{projectName}')
548
+ ? userConfig.releaseTag?.pattern
521
549
  : defaultIndependentReleaseTagPattern
522
- : userConfig.releaseTag?.pattern ||
523
- userConfig.releaseTagPattern ||
524
- defaultFixedReleaseTagPattern),
550
+ : userConfig.releaseTag?.pattern || defaultFixedReleaseTagPattern),
525
551
  checkAllBranchesWhen: releaseGroup.releaseTag?.checkAllBranchesWhen ??
526
- releaseGroup.releaseTagPatternCheckAllBranchesWhen ??
527
552
  userConfig.releaseTag?.checkAllBranchesWhen ??
528
- userConfig.releaseTagPatternCheckAllBranchesWhen ??
529
553
  undefined,
530
554
  requireSemver: releaseGroup.releaseTag?.requireSemver ??
531
- releaseGroup.releaseTagPatternRequireSemver ??
532
555
  userConfig.releaseTag?.requireSemver ??
533
- userConfig.releaseTagPatternRequireSemver ??
534
556
  defaultReleaseTagPatternRequireSemver,
535
557
  preferDockerVersion: releaseGroup.releaseTag?.preferDockerVersion ??
536
- releaseGroup.releaseTagPatternPreferDockerVersion ??
537
558
  userConfig.releaseTag?.preferDockerVersion ??
538
- userConfig.releaseTagPatternPreferDockerVersion ??
539
559
  false,
540
560
  strictPreid: releaseGroup.releaseTag?.strictPreid ??
541
- releaseGroup.releaseTagPatternStrictPreid ??
542
561
  userConfig.releaseTag?.strictPreid ??
543
- userConfig.releaseTagPatternStrictPreid ??
544
562
  defaultReleaseTagPatternStrictPreid,
545
563
  },
546
564
  versionPlans: releaseGroup.versionPlans ?? rootVersionPlansConfig,
@@ -598,10 +616,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
598
616
  if (releaseGroup.releaseTag.preferDockerVersion === false &&
599
617
  userConfig.groups?.[releaseGroupName]?.releaseTag
600
618
  ?.preferDockerVersion === undefined &&
601
- userConfig.groups?.[releaseGroupName]
602
- ?.releaseTagPatternPreferDockerVersion === undefined &&
603
- userConfig.releaseTag?.preferDockerVersion === undefined &&
604
- userConfig.releaseTagPatternPreferDockerVersion === undefined) {
619
+ userConfig.releaseTag?.preferDockerVersion === undefined) {
605
620
  // Check if ALL projects have docker config, or just some
606
621
  const allProjectsHaveDocker = releaseGroup.projects.every((projectName) => {
607
622
  const projectNode = projectGraph.nodes[projectName];
@@ -760,6 +775,22 @@ async function handleNxReleaseConfigError(error) {
760
775
  });
761
776
  }
762
777
  break;
778
+ // TODO(v24): remove this case along with detectLegacyReleaseTagProperties
779
+ case 'LEGACY_RELEASE_TAG_PATTERN_PROPERTIES_DETECTED':
780
+ {
781
+ const properties = error.data.properties;
782
+ output_1.output.error({
783
+ title: `Found deprecated releaseTagPattern* properties in your nx.json that are no longer supported in Nx 23.`,
784
+ bodyLines: [
785
+ 'The following properties were moved to the nested "releaseTag" object in Nx 22 and removed in Nx 23:',
786
+ ...properties.map((p) => ` - ${p}`),
787
+ '',
788
+ 'Run "nx repair" to migrate them automatically.',
789
+ linkMessage,
790
+ ],
791
+ });
792
+ }
793
+ break;
763
794
  case 'RELEASE_GROUP_MATCHES_NO_PROJECTS':
764
795
  {
765
796
  const nxJsonMessage = await (0, resolve_nx_json_error_message_1.resolveNxJsonConfigErrorMessage)([
@@ -790,10 +821,11 @@ async function handleNxReleaseConfigError(error) {
790
821
  'release',
791
822
  'groups',
792
823
  error.data.releaseGroupName,
793
- 'releaseTagPattern',
824
+ 'releaseTag',
825
+ 'pattern',
794
826
  ]);
795
827
  output_1.output.error({
796
- title: `Release group "${error.data.releaseGroupName}" has an invalid releaseTagPattern. Please ensure the pattern contains exactly one instance of the "{version}" placeholder`,
828
+ title: `Release group "${error.data.releaseGroupName}" has an invalid releaseTag.pattern. Please ensure the pattern contains exactly one instance of the "{version}" placeholder`,
797
829
  bodyLines: [nxJsonMessage, linkMessage],
798
830
  });
799
831
  }
@@ -553,12 +553,11 @@ Valid values are: ${exports.validReleaseVersionPrefixes
553
553
  /**
554
554
  * adjustSemverBumpsForZeroMajorVersion
555
555
  *
556
- * TODO(v23): change the default value of this to true
557
- * This is false by default for backward compatibility.
556
+ * This is true by default. Set to false to treat all bumps the same regardless of major version.
558
557
  */
559
558
  const adjustSemverBumpsForZeroMajorVersion = projectVersionConfig?.adjustSemverBumpsForZeroMajorVersion ??
560
559
  releaseGroupVersionConfig?.adjustSemverBumpsForZeroMajorVersion ??
561
- false;
560
+ true;
562
561
  /**
563
562
  * applyPreidToDependents
564
563
  *
@@ -85,7 +85,7 @@ async function _RepoGitTags_getTags(checkAllBranchesWhen, alwaysCheckAllBranches
85
85
  async function _RepoGitTags_alwaysCheckAllBranches(checkAllBranchesWhen) {
86
86
  let alwaysCheckAllBranches = false;
87
87
  /**
88
- * By default, we will try and resolve the latest match for the releaseTagPattern from the current branch,
88
+ * By default, we will try and resolve the latest match for the releaseTag.pattern from the current branch,
89
89
  * falling back to all branches if no match is found on the current branch.
90
90
  *
91
91
  * - If checkAllBranchesWhen is true it will cause us to ALWAYS check all branches for the latest match.
@@ -151,7 +151,7 @@ async function resolveCurrentVersionFromGitTag(tree, projectGraphNode, releaseGr
151
151
  // The latest matching git tag was found in release-group-processor and has an extracted version, return it directly
152
152
  if (latestMatchingGitTag && latestMatchingGitTag.extractedVersion) {
153
153
  const currentVersion = latestMatchingGitTag.extractedVersion;
154
- logger.buffer(`🏷️ Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}", based on releaseTagPattern "${releaseTagPattern}"`);
154
+ logger.buffer(`🏷️ Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}", based on releaseTag.pattern "${releaseTagPattern}"`);
155
155
  // Write to the cache if the release group is fixed
156
156
  if (releaseGroup.projectsRelationship === 'fixed') {
157
157
  cachedCurrentVersionsPerFixedReleaseGroup.set(releaseGroup.name, {
@@ -20,10 +20,9 @@ function resolveTargetInfoData(t) {
20
20
  allTargetNames.add(name);
21
21
  }
22
22
  }
23
- const extraTargetDeps = Object.fromEntries(Object.entries(nxJson.targetDefaults ?? {})
24
- .filter(([, config]) => config.dependsOn)
25
- .map(([name, config]) => [name, config.dependsOn]));
26
- const depConfigs = (0, utils_1.getDependencyConfigs)({ project: projectName, target: targetName }, extraTargetDeps, graph, [...allTargetNames]) ?? [];
23
+ const depConfigs = (0, utils_1.getDependencyConfigs)({ project: projectName, target: targetName },
24
+ // no programmatic extras — `dependsOn` is already merged into the graph node
25
+ {}, graph, [...allTargetNames]) ?? [];
27
26
  // Determine the hoisted command value and which option key it came from
28
27
  let command;
29
28
  let commandSourceKey;
@@ -44,7 +43,7 @@ function resolveTargetInfoData(t) {
44
43
  command = targetConfig.options.script;
45
44
  commandSourceKey = 'options.script';
46
45
  }
47
- const { dependsOn, depSourceIndices, transitiveTasks } = resolveTaskGraphDependencies(graph, extraTargetDeps, projectName, targetName, configuration, depConfigs);
46
+ const { dependsOn, depSourceIndices, transitiveTasks } = resolveTaskGraphDependencies(graph, {}, projectName, targetName, configuration, depConfigs);
48
47
  const configurations = Object.keys(targetConfig.configurations ?? {});
49
48
  const targetSourceMap = extractTargetSourceMap(node.data.root, targetName, sourceMaps);
50
49
  const usesCustomHasher = (0, utils_2.hasCustomHasher)(projectName, targetName, graph);
@@ -13,7 +13,7 @@ exports.yargsWatchCommand = {
13
13
  },
14
14
  };
15
15
  function withWatchOptions(yargs) {
16
- return (0, shared_options_1.withVerbose)(yargs)
16
+ return ((0, shared_options_1.withVerbose)(yargs)
17
17
  .parserConfiguration({
18
18
  'strip-dashed': true,
19
19
  'populate--': true,
@@ -28,10 +28,16 @@ function withWatchOptions(yargs) {
28
28
  type: 'boolean',
29
29
  description: 'Watch all projects.',
30
30
  })
31
- .option('includeDependentProjects', {
31
+ .option('includeDependencies', {
32
32
  type: 'boolean',
33
- description: 'When watching selected projects, include dependent projects as well.',
33
+ description: 'When watching selected projects, also include the projects they depend on.',
34
34
  alias: 'd',
35
+ })
36
+ // TODO(v24): remove the deprecated --includeDependentProjects alias
37
+ .option('includeDependentProjects', {
38
+ type: 'boolean',
39
+ hidden: true,
40
+ describe: "Deprecated in favor of --includeDependencies; will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.",
35
41
  })
36
42
  .option('includeGlobalWorkspaceFiles', {
37
43
  type: 'boolean',
@@ -67,5 +73,19 @@ function withWatchOptions(yargs) {
67
73
  else {
68
74
  throw Error('No command specified for watch mode.');
69
75
  }
70
- }, true);
76
+ // --includeDependentProjects was renamed to --includeDependencies in
77
+ // Nx 23 because the original name was misleading: it includes the
78
+ // watched project's *dependencies*, not its dependents. The new flag
79
+ // is functionally identical — only the name changed. Map the legacy
80
+ // name through so existing scripts keep working during the
81
+ // deprecation window.
82
+ // TODO(v24): remove the legacy includeDependentProjects pass-through
83
+ const a = args;
84
+ if (a.includeDependentProjects !== undefined &&
85
+ a.includeDependencies === undefined) {
86
+ a.includeDependencies = a.includeDependentProjects;
87
+ // eslint-disable-next-line no-console
88
+ console.warn("--includeDependentProjects is deprecated in favor of --includeDependencies and will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.");
89
+ }
90
+ }, true));
71
91
  }
@@ -2,6 +2,13 @@ import { ChangedFile } from '../../daemon/client/client';
2
2
  export interface WatchArguments {
3
3
  projects?: string[];
4
4
  all?: boolean;
5
+ includeDependencies?: boolean;
6
+ /**
7
+ * @deprecated Renamed to {@link WatchArguments.includeDependencies}; will be
8
+ * removed in Nx 24. The original name was misleading: this flag includes
9
+ * the watched project's dependencies, not its dependents. The new property
10
+ * is functionally identical — only the name changed.
11
+ */
5
12
  includeDependentProjects?: boolean;
6
13
  includeGlobalWorkspaceFiles?: boolean;
7
14
  verbose?: boolean;
@@ -149,7 +149,7 @@ async function watch(args) {
149
149
  }
150
150
  await client_1.daemonClient.registerFileWatcher({
151
151
  watchProjects: whatToWatch,
152
- includeDependentProjects: args.includeDependentProjects,
152
+ includeDependencies: args.includeDependencies ?? args.includeDependentProjects,
153
153
  includeGlobalWorkspaceFiles: args.includeGlobalWorkspaceFiles,
154
154
  }, async (err, data) => {
155
155
  if (err === 'reconnecting') {