nx 18.1.0 → 18.1.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.
Files changed (121) hide show
  1. package/bin/init-local.js +13 -1
  2. package/package.json +12 -12
  3. package/release/changelog-renderer/index.d.ts +2 -0
  4. package/release/changelog-renderer/index.js +4 -18
  5. package/schemas/nx-schema.json +62 -1
  6. package/schemas/project-schema.json +20 -0
  7. package/src/adapter/angular-json.d.ts +1 -2
  8. package/src/adapter/angular-json.js +0 -1
  9. package/src/adapter/ngcli-adapter.js +3 -3
  10. package/src/command-line/generate/generator-utils.js +2 -2
  11. package/src/command-line/init/implementation/add-nx-to-nest.js +2 -2
  12. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +2 -2
  13. package/src/command-line/init/implementation/utils.d.ts +1 -3
  14. package/src/command-line/init/implementation/utils.js +9 -16
  15. package/src/command-line/init/init-v2.js +3 -2
  16. package/src/command-line/release/changelog.js +17 -14
  17. package/src/command-line/release/command-object.d.ts +1 -0
  18. package/src/command-line/release/config/config.d.ts +12 -15
  19. package/src/command-line/release/config/config.js +151 -22
  20. package/src/command-line/release/config/conventional-commits.d.ts +2 -0
  21. package/src/command-line/release/config/conventional-commits.js +98 -0
  22. package/src/command-line/release/publish.js +4 -3
  23. package/src/command-line/release/release.js +12 -11
  24. package/src/command-line/release/utils/git.js +30 -1
  25. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
  26. package/src/command-line/release/utils/resolve-semver-specifier.js +2 -13
  27. package/src/command-line/release/utils/semver.d.ts +2 -8
  28. package/src/command-line/release/utils/semver.js +4 -1
  29. package/src/command-line/release/utils/shared.d.ts +5 -1
  30. package/src/command-line/release/version.d.ts +6 -1
  31. package/src/command-line/release/version.js +71 -19
  32. package/src/command-line/run/executor-utils.js +2 -2
  33. package/src/command-line/run/run.js +3 -3
  34. package/src/config/nx-json.d.ts +31 -0
  35. package/src/config/schema-utils.js +2 -2
  36. package/src/core/graph/main.js +1 -1
  37. package/src/core/graph/polyfills.js +1 -1
  38. package/src/core/graph/styles.css +1 -1
  39. package/src/daemon/server/project-graph-incremental-recomputation.js +1 -0
  40. package/src/devkit-exports.d.ts +1 -2
  41. package/src/devkit-internals.d.ts +0 -1
  42. package/src/devkit-internals.js +1 -3
  43. package/src/executors/run-commands/run-commands.impl.d.ts +7 -1
  44. package/src/executors/run-commands/run-commands.impl.js +120 -57
  45. package/src/executors/run-script/run-script.impl.js +5 -5
  46. package/src/generators/utils/project-configuration.js +2 -2
  47. package/src/hasher/hash-task.js +2 -2
  48. package/src/migrations/update-15-1-0/set-project-names.js +2 -4
  49. package/src/migrations/update-17-2-0/move-default-base.d.ts +1 -1
  50. package/src/migrations/update-17-2-0/move-default-base.js +3 -1
  51. package/src/migrations/update-17-3-0/nx-release-path.js +0 -1
  52. package/src/native/index.d.ts +14 -11
  53. package/src/native/index.js +3 -4
  54. package/src/plugins/js/index.d.ts +1 -1
  55. package/src/plugins/js/lock-file/lock-file.d.ts +1 -1
  56. package/src/plugins/js/lock-file/lock-file.js +13 -1
  57. package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
  58. package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
  59. package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
  60. package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
  61. package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
  62. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
  63. package/src/plugins/js/utils/register.js +3 -1
  64. package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
  65. package/src/plugins/package-json-workspaces/create-nodes.js +31 -24
  66. package/src/plugins/package-json-workspaces/index.d.ts +0 -1
  67. package/src/plugins/package-json-workspaces/index.js +0 -2
  68. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +1 -2
  69. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +0 -1
  70. package/src/plugins/project-json/build-nodes/project-json.d.ts +1 -2
  71. package/src/plugins/project-json/build-nodes/project-json.js +0 -1
  72. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +1 -2
  73. package/src/plugins/target-defaults/target-defaults-plugin.js +0 -1
  74. package/src/project-graph/affected/locators/project-glob-changes.js +3 -2
  75. package/src/project-graph/build-project-graph.js +8 -11
  76. package/src/project-graph/file-utils.js +6 -4
  77. package/src/project-graph/project-graph-builder.d.ts +1 -1
  78. package/src/project-graph/project-graph.js +3 -0
  79. package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
  80. package/src/project-graph/utils/project-configuration-utils.d.ts +4 -4
  81. package/src/project-graph/utils/project-configuration-utils.js +58 -17
  82. package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -8
  83. package/src/project-graph/utils/retrieve-workspace-files.js +18 -20
  84. package/src/tasks-runner/fork.js +7 -7
  85. package/src/tasks-runner/forked-process-task-runner.d.ts +2 -4
  86. package/src/tasks-runner/forked-process-task-runner.js +13 -17
  87. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +16 -13
  88. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +8 -7
  89. package/src/tasks-runner/{psuedo-ipc.d.ts → pseudo-ipc.d.ts} +7 -7
  90. package/src/tasks-runner/{psuedo-ipc.js → pseudo-ipc.js} +9 -9
  91. package/src/tasks-runner/pseudo-terminal.d.ts +42 -0
  92. package/src/tasks-runner/pseudo-terminal.js +133 -0
  93. package/src/tasks-runner/task-orchestrator.js +45 -9
  94. package/src/tasks-runner/tasks-schedule.js +3 -3
  95. package/src/tasks-runner/utils.d.ts +7 -6
  96. package/src/tasks-runner/utils.js +11 -7
  97. package/src/utils/ignore.js +1 -1
  98. package/src/utils/logger.d.ts +0 -1
  99. package/src/utils/logger.js +0 -5
  100. package/src/{project-graph/plugins/public-api.d.ts → utils/nx-plugin.d.ts} +45 -7
  101. package/src/utils/nx-plugin.deprecated.d.ts +2 -4
  102. package/src/utils/nx-plugin.deprecated.js +4 -4
  103. package/src/utils/nx-plugin.js +293 -0
  104. package/src/utils/output.js +1 -1
  105. package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
  106. package/src/utils/plugins/plugin-capabilities.js +7 -8
  107. package/src/project-graph/plugins/index.d.ts +0 -2
  108. package/src/project-graph/plugins/index.js +0 -8
  109. package/src/project-graph/plugins/internal-api.d.ts +0 -18
  110. package/src/project-graph/plugins/internal-api.js +0 -48
  111. package/src/project-graph/plugins/messaging.d.ts +0 -94
  112. package/src/project-graph/plugins/messaging.js +0 -23
  113. package/src/project-graph/plugins/plugin-pool.d.ts +0 -4
  114. package/src/project-graph/plugins/plugin-pool.js +0 -216
  115. package/src/project-graph/plugins/plugin-worker.d.ts +0 -1
  116. package/src/project-graph/plugins/plugin-worker.js +0 -115
  117. package/src/project-graph/plugins/public-api.js +0 -4
  118. package/src/project-graph/plugins/utils.d.ts +0 -9
  119. package/src/project-graph/plugins/utils.js +0 -55
  120. package/src/project-graph/plugins/worker-api.d.ts +0 -26
  121. package/src/project-graph/plugins/worker-api.js +0 -177
@@ -12,7 +12,11 @@ export type ReleaseVersionGeneratorResult = {
12
12
  }) => Promise<string[]>;
13
13
  };
14
14
  export type VersionData = Record<string, {
15
- newVersion: string;
15
+ /**
16
+ * newVersion will be null in the case that no changes are detected for the project,
17
+ * e.g. when using conventional commits
18
+ */
19
+ newVersion: string | null;
16
20
  currentVersion: string;
17
21
  dependentProjects: any[];
18
22
  }>;
@@ -1,10 +1,11 @@
1
1
  import { ProjectGraph, ProjectGraphProjectNode } from '../../config/project-graph';
2
2
  import { VersionOptions } from './command-object';
3
+ import { NxReleaseConfig } from './config/config';
3
4
  import { ReleaseGroupWithName } from './config/filter-release-groups';
4
5
  import { VersionData } from './utils/shared';
5
6
  export { deriveNewSemverVersion } from './utils/semver';
6
7
  export type { ReleaseVersionGeneratorResult, VersionData, } from './utils/shared';
7
- export declare const validReleaseVersionPrefixes: string[];
8
+ export declare const validReleaseVersionPrefixes: readonly ["auto", "", "~", "^", "="];
8
9
  export interface ReleaseVersionGeneratorSchema {
9
10
  projects: ProjectGraphProjectNode[];
10
11
  releaseGroup: ReleaseGroupWithName;
@@ -18,6 +19,10 @@ export interface ReleaseVersionGeneratorSchema {
18
19
  fallbackCurrentVersionResolver?: 'disk';
19
20
  firstRelease?: boolean;
20
21
  versionPrefix?: typeof validReleaseVersionPrefixes[number];
22
+ skipLockFileUpdate?: boolean;
23
+ installArgs?: string;
24
+ installIgnoreScripts?: boolean;
25
+ conventionalCommitsConfig?: NxReleaseConfig['conventionalCommits'];
21
26
  }
22
27
  export interface NxReleaseVersionResult {
23
28
  /**
@@ -2,13 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseVersion = exports.releaseVersionCLIHandler = exports.validReleaseVersionPrefixes = exports.deriveNewSemverVersion = void 0;
4
4
  const chalk = require("chalk");
5
+ const node_child_process_1 = require("node:child_process");
5
6
  const node_fs_1 = require("node:fs");
6
7
  const node_path_1 = require("node:path");
7
8
  const nx_json_1 = require("../../config/nx-json");
8
- const devkit_exports_1 = require("../../devkit-exports");
9
9
  const tree_1 = require("../../generators/tree");
10
+ const file_map_utils_1 = require("../../project-graph/file-map-utils");
10
11
  const project_graph_1 = require("../../project-graph/project-graph");
12
+ const output_1 = require("../../utils/output");
11
13
  const params_1 = require("../../utils/params");
14
+ const path_1 = require("../../utils/path");
15
+ const workspace_root_1 = require("../../utils/workspace-root");
12
16
  const generate_1 = require("../generate/generate");
13
17
  const generator_utils_1 = require("../generate/generator-utils");
14
18
  const config_1 = require("./config/config");
@@ -18,10 +22,11 @@ const git_1 = require("./utils/git");
18
22
  const print_changes_1 = require("./utils/print-changes");
19
23
  const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
20
24
  const shared_1 = require("./utils/shared");
25
+ const LARGE_BUFFER = 1024 * 1000000;
21
26
  // Reexport some utils for use in plugin release-version generator implementations
22
27
  var semver_1 = require("./utils/semver");
23
28
  Object.defineProperty(exports, "deriveNewSemverVersion", { enumerable: true, get: function () { return semver_1.deriveNewSemverVersion; } });
24
- exports.validReleaseVersionPrefixes = ['auto', '', '~', '^'];
29
+ exports.validReleaseVersionPrefixes = ['auto', '', '~', '^', '='];
25
30
  const releaseVersionCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => releaseVersion(args));
26
31
  exports.releaseVersionCLIHandler = releaseVersionCLIHandler;
27
32
  /**
@@ -37,7 +42,7 @@ async function releaseVersion(args) {
37
42
  process.env.NX_VERBOSE_LOGGING = 'true';
38
43
  }
39
44
  // Apply default configuration to any optional user configuration
40
- const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, nxJson.release);
45
+ const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), nxJson.release);
41
46
  if (configError) {
42
47
  return await (0, config_1.handleNxReleaseConfigError)(configError);
43
48
  }
@@ -53,7 +58,7 @@ async function releaseVersion(args) {
53
58
  'release',
54
59
  'git',
55
60
  ]);
56
- devkit_exports_1.output.error({
61
+ output_1.output.error({
57
62
  title: `The "release.git" property in nx.json may not be used with the "nx release version" subcommand or programmatic API. Instead, configure git options for subcommands directly with "release.version.git" and "release.changelog.git".`,
58
63
  bodyLines: [nxJsonMessage],
59
64
  });
@@ -61,10 +66,14 @@ async function releaseVersion(args) {
61
66
  }
62
67
  const { error: filterError, releaseGroups, releaseGroupToFilteredProjects, } = (0, filter_release_groups_1.filterReleaseGroups)(projectGraph, nxReleaseConfig, args.projects, args.groups);
63
68
  if (filterError) {
64
- devkit_exports_1.output.error(filterError);
69
+ output_1.output.error(filterError);
65
70
  process.exit(1);
66
71
  }
67
- const tree = new tree_1.FsTree(devkit_exports_1.workspaceRoot, args.verbose);
72
+ runPreVersionCommand(nxReleaseConfig.version.preVersionCommand, {
73
+ dryRun: args.dryRun,
74
+ verbose: args.verbose,
75
+ });
76
+ const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose);
68
77
  const versionData = {};
69
78
  const commitMessage = args.gitCommitMessage || nxReleaseConfig.version.git.commitMessage;
70
79
  const additionalChangedFiles = new Set();
@@ -88,13 +97,16 @@ async function releaseVersion(args) {
88
97
  // all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
89
98
  projects,
90
99
  });
91
- const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData);
100
+ const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
92
101
  // Capture the callback so that we can run it after flushing the changes to disk
93
102
  generatorCallbacks.push(async () => {
94
103
  const changedFiles = await generatorCallback(tree, {
95
104
  dryRun: !!args.dryRun,
96
105
  verbose: !!args.verbose,
97
- generatorOptions,
106
+ generatorOptions: {
107
+ ...generatorOptions,
108
+ ...args.generatorOptionsOverrides,
109
+ },
98
110
  });
99
111
  changedFiles.forEach((f) => additionalChangedFiles.add(f));
100
112
  });
@@ -125,7 +137,7 @@ async function releaseVersion(args) {
125
137
  await (0, shared_1.commitChanges)(changedFiles, !!args.dryRun, !!args.verbose, (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage), args.gitCommitArgs || nxReleaseConfig.version.git.commitArgs);
126
138
  }
127
139
  else if (args.stageChanges ?? nxReleaseConfig.version.git.stageChanges) {
128
- devkit_exports_1.output.logSingleLine(`Staging changed files with git`);
140
+ output_1.output.logSingleLine(`Staging changed files with git`);
129
141
  await (0, git_1.gitAdd)({
130
142
  changedFiles,
131
143
  dryRun: args.dryRun,
@@ -133,7 +145,7 @@ async function releaseVersion(args) {
133
145
  });
134
146
  }
135
147
  if (args.gitTag ?? nxReleaseConfig.version.git.tag) {
136
- devkit_exports_1.output.logSingleLine(`Tagging commit with git`);
148
+ output_1.output.logSingleLine(`Tagging commit with git`);
137
149
  for (const tag of gitTagValues) {
138
150
  await (0, git_1.gitTag)({
139
151
  tag,
@@ -167,13 +179,16 @@ async function releaseVersion(args) {
167
179
  // all project data from the project graph (not to be confused with projectNamesToRunVersionOn)
168
180
  projects,
169
181
  });
170
- const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData);
182
+ const generatorCallback = await runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, args.generatorOptionsOverrides, projectNames, releaseGroup, versionData, nxReleaseConfig.conventionalCommits);
171
183
  // Capture the callback so that we can run it after flushing the changes to disk
172
184
  generatorCallbacks.push(async () => {
173
185
  const changedFiles = await generatorCallback(tree, {
174
186
  dryRun: !!args.dryRun,
175
187
  verbose: !!args.verbose,
176
- generatorOptions,
188
+ generatorOptions: {
189
+ ...generatorOptions,
190
+ ...args.generatorOptionsOverrides,
191
+ },
177
192
  });
178
193
  changedFiles.forEach((f) => additionalChangedFiles.add(f));
179
194
  });
@@ -212,7 +227,7 @@ async function releaseVersion(args) {
212
227
  await (0, shared_1.commitChanges)(changedFiles, !!args.dryRun, !!args.verbose, (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage), args.gitCommitArgs || nxReleaseConfig.version.git.commitArgs);
213
228
  }
214
229
  else if (args.stageChanges ?? nxReleaseConfig.version.git.stageChanges) {
215
- devkit_exports_1.output.logSingleLine(`Staging changed files with git`);
230
+ output_1.output.logSingleLine(`Staging changed files with git`);
216
231
  await (0, git_1.gitAdd)({
217
232
  changedFiles,
218
233
  dryRun: args.dryRun,
@@ -220,7 +235,7 @@ async function releaseVersion(args) {
220
235
  });
221
236
  }
222
237
  if (args.gitTag ?? nxReleaseConfig.version.git.tag) {
223
- devkit_exports_1.output.logSingleLine(`Tagging commit with git`);
238
+ output_1.output.logSingleLine(`Tagging commit with git`);
224
239
  for (const tag of gitTagValues) {
225
240
  await (0, git_1.gitTag)({
226
241
  tag,
@@ -247,20 +262,22 @@ function appendVersionData(existingVersionData, newVersionData) {
247
262
  }
248
263
  return existingVersionData;
249
264
  }
250
- async function runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, projectNames, releaseGroup, versionData) {
265
+ async function runVersionOnProjects(projectGraph, nxJson, args, tree, generatorData, generatorOverrides, projectNames, releaseGroup, versionData, conventionalCommitsConfig) {
251
266
  const generatorOptions = {
252
267
  // Always ensure a string to avoid generator schema validation errors
253
268
  specifier: args.specifier ?? '',
254
269
  preid: args.preid ?? '',
255
270
  ...generatorData.configGeneratorOptions,
271
+ ...(generatorOverrides ?? {}),
256
272
  // The following are not overridable by user config
257
273
  projects: projectNames.map((p) => projectGraph.nodes[p]),
258
274
  projectGraph,
259
275
  releaseGroup,
260
276
  firstRelease: args.firstRelease ?? false,
277
+ conventionalCommitsConfig,
261
278
  };
262
279
  // Apply generator defaults from schema.json file etc
263
- const combinedOpts = await (0, params_1.combineOptionsForGenerator)(generatorOptions, generatorData.collectionName, generatorData.normalizedGeneratorName, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), nxJson, generatorData.schema, false, null, (0, node_path_1.relative)(process.cwd(), devkit_exports_1.workspaceRoot), args.verbose);
280
+ const combinedOpts = await (0, params_1.combineOptionsForGenerator)(generatorOptions, generatorData.collectionName, generatorData.normalizedGeneratorName, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph), nxJson, generatorData.schema, false, null, (0, node_path_1.relative)(process.cwd(), workspace_root_1.workspaceRoot), args.verbose);
264
281
  const releaseVersionGenerator = generatorData.implementationFactory();
265
282
  // We expect all version generator implementations to return a ReleaseVersionGeneratorResult object, rather than a GeneratorCallback
266
283
  const versionResult = (await releaseVersionGenerator(tree, combinedOpts));
@@ -282,7 +299,7 @@ function printAndFlushChanges(tree, isDryRun) {
282
299
  }
283
300
  else if (f.type === 'UPDATE') {
284
301
  console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
285
- const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, devkit_exports_1.joinPathFragments)(tree.root, f.path)).toString();
302
+ const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
286
303
  (0, print_changes_1.printDiff)(currentContentsOnDisk, f.content?.toString() || '');
287
304
  }
288
305
  else if (f.type === 'DELETE') {
@@ -290,7 +307,7 @@ function printAndFlushChanges(tree, isDryRun) {
290
307
  }
291
308
  });
292
309
  if (!isDryRun) {
293
- (0, tree_1.flushChanges)(devkit_exports_1.workspaceRoot, changes);
310
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
294
311
  }
295
312
  }
296
313
  function extractGeneratorCollectionAndName(description, generatorString) {
@@ -306,7 +323,7 @@ function extractGeneratorCollectionAndName(description, generatorString) {
306
323
  }
307
324
  function resolveGeneratorData({ collectionName, generatorName, configGeneratorOptions, projects, }) {
308
325
  try {
309
- const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, devkit_exports_1.workspaceRoot, projects);
326
+ const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(collectionName, generatorName, workspace_root_1.workspaceRoot, projects);
310
327
  return {
311
328
  collectionName,
312
329
  generatorName,
@@ -339,3 +356,38 @@ function resolveGeneratorData({ collectionName, generatorName, configGeneratorOp
339
356
  throw err;
340
357
  }
341
358
  }
359
+ function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
360
+ if (!preVersionCommand) {
361
+ return;
362
+ }
363
+ output_1.output.logSingleLine(`Executing pre-version command`);
364
+ if (verbose) {
365
+ console.log(`Executing the following pre-version command:`);
366
+ console.log(preVersionCommand);
367
+ }
368
+ let env = {
369
+ ...process.env,
370
+ };
371
+ if (dryRun) {
372
+ env.NX_DRY_RUN = 'true';
373
+ }
374
+ const stdio = verbose ? 'inherit' : 'pipe';
375
+ try {
376
+ (0, node_child_process_1.execSync)(preVersionCommand, {
377
+ encoding: 'utf-8',
378
+ maxBuffer: LARGE_BUFFER,
379
+ stdio,
380
+ env,
381
+ });
382
+ }
383
+ catch (e) {
384
+ const title = verbose
385
+ ? `The pre-version command failed. See the full output above.`
386
+ : `The pre-version command failed. Retry with --verbose to see the full output of the pre-version command.`;
387
+ output_1.output.error({
388
+ title,
389
+ bodyLines: [preVersionCommand, e],
390
+ });
391
+ process.exit(1);
392
+ }
393
+ }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExecutorInformation = exports.normalizeExecutorSchema = void 0;
4
4
  const path_1 = require("path");
5
- const plugins_1 = require("../../project-graph/plugins");
5
+ const nx_plugin_1 = require("../../utils/nx-plugin");
6
6
  const fileutils_1 = require("../../utils/fileutils");
7
7
  const schema_utils_1 = require("../../config/schema-utils");
8
8
  const installation_directory_1 = require("../../utils/installation-directory");
@@ -55,7 +55,7 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
55
55
  }
56
56
  exports.getExecutorInformation = getExecutorInformation;
57
57
  function readExecutorJson(nodeModule, executor, root, projects) {
58
- const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, projects, root
58
+ const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, projects, root
59
59
  ? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
60
60
  : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
61
61
  const executorsFile = packageJson.executors ?? packageJson.builders;
@@ -7,10 +7,9 @@ const path_1 = require("path");
7
7
  const serialize_overrides_into_command_line_1 = require("../../utils/serialize-overrides-into-command-line");
8
8
  const project_graph_1 = require("../../project-graph/project-graph");
9
9
  const configuration_1 = require("../../config/configuration");
10
- const native_1 = require("../../native");
11
10
  const async_iterator_1 = require("../../utils/async-iterator");
12
11
  const executor_utils_1 = require("./executor-utils");
13
- const child_process_1 = require("../../utils/child-process");
12
+ const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
14
13
  function printRunHelp(opts, schema, plugin) {
15
14
  (0, print_help_1.printHelp)(`run ${opts.project}:${opts.target}`, schema, {
16
15
  mode: 'run',
@@ -67,8 +66,9 @@ async function printTargetRunHelpInternal({ project, target }, root, projectsCon
67
66
  executor === 'run-commands' &&
68
67
  targetConfig.options.command) {
69
68
  const command = targetConfig.options.command.split(' ')[0];
69
+ const terminal = (0, pseudo_terminal_1.getPseudoTerminal)();
70
70
  await new Promise(() => {
71
- const cp = new child_process_1.PseudoTtyProcess((0, native_1.runCommand)(`${command} --help`));
71
+ const cp = terminal.runCommand(`${command} --help`);
72
72
  cp.onExit((code) => {
73
73
  process.exit(code);
74
74
  });
@@ -120,6 +120,30 @@ export interface NxReleaseGitConfiguration {
120
120
  */
121
121
  tagArgs?: string;
122
122
  }
123
+ export interface NxReleaseConventionalCommitsConfiguration {
124
+ types?: Record<string,
125
+ /**
126
+ * A map of commit types to their configuration.
127
+ * If a type is set to 'true', then it will be enabled with the default 'semverBump' of 'patch' and will appear in the changelog.
128
+ * If a type is set to 'false', then it will not trigger a version bump and will be hidden from the changelog.
129
+ */
130
+ {
131
+ /**
132
+ * The semver bump to apply when a commit of this type is found.
133
+ * If set to "none", the commit will be ignored for versioning purposes.
134
+ */
135
+ semverBump?: 'patch' | 'minor' | 'major' | 'none';
136
+ /**
137
+ * Configuration for the changelog section for commits of this type.
138
+ * If set to 'true', then commits of this type will be included in the changelog with their default title for the type.
139
+ * If set to 'false', then commits of this type will not be included in the changelog.
140
+ */
141
+ changelog?: {
142
+ title?: string;
143
+ hidden?: boolean;
144
+ } | boolean;
145
+ } | boolean>;
146
+ }
123
147
  interface NxReleaseConfiguration {
124
148
  /**
125
149
  * Shorthand for amending the projects which will be included in the implicit default release group (all projects by default).
@@ -207,6 +231,12 @@ interface NxReleaseConfiguration {
207
231
  * Enable or override configuration for git operations as part of the version subcommand
208
232
  */
209
233
  git?: NxReleaseGitConfiguration;
234
+ /**
235
+ * A command to run after validation of nx release configuration, but before versioning begins.
236
+ * Used for preparing build artifacts. If --dry-run is passed, the command is still executed, but
237
+ * with the NX_DRY_RUN environment variable set to 'true'.
238
+ */
239
+ preVersionCommand?: string;
210
240
  };
211
241
  /**
212
242
  * Optionally override the git/release tag pattern to use. This field is the source of truth
@@ -223,6 +253,7 @@ interface NxReleaseConfiguration {
223
253
  * Enable and configure automatic git operations as part of the release
224
254
  */
225
255
  git?: NxReleaseGitConfiguration;
256
+ conventionalCommits?: NxReleaseConventionalCommitsConfiguration;
226
257
  }
227
258
  /**
228
259
  * Nx.json configuration
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveSchema = exports.resolveImplementation = exports.getImplementationFactory = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
- const plugins_1 = require("../project-graph/plugins");
6
+ const nx_plugin_1 = require("../utils/nx-plugin");
7
7
  /**
8
8
  * This function is used to get the implementation factory of an executor or generator.
9
9
  * @param implementation path to the implementation
@@ -15,7 +15,7 @@ function getImplementationFactory(implementation, directory) {
15
15
  return () => {
16
16
  const modulePath = resolveImplementation(implementationModulePath, directory);
17
17
  if ((0, path_1.extname)(modulePath) === '.ts') {
18
- (0, plugins_1.registerPluginTSTranspiler)();
18
+ (0, nx_plugin_1.registerPluginTSTranspiler)();
19
19
  }
20
20
  const module = require(modulePath);
21
21
  return implementationExportName