@storm-software/git-tools 2.123.16 → 2.124.0

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 (84) hide show
  1. package/README.md +1 -1
  2. package/bin/{chunk-SWXHQXUT.cjs → chunk-AU5PZKTN.cjs} +2 -0
  3. package/bin/chunk-AU5PZKTN.cjs.map +1 -0
  4. package/bin/{chunk-G3JMIIRF.cjs → chunk-EHPPIARR.cjs} +12 -17
  5. package/bin/chunk-EHPPIARR.cjs.map +1 -0
  6. package/bin/{chunk-L64XVBGM.cjs → chunk-FH5OSXAJ.cjs} +2 -0
  7. package/bin/chunk-FH5OSXAJ.cjs.map +1 -0
  8. package/bin/{chunk-S5PS23TL.js → chunk-G3YPGVPS.js} +2 -0
  9. package/bin/chunk-G3YPGVPS.js.map +1 -0
  10. package/bin/{chunk-AMSZ7DVW.js → chunk-Q3DQKTOI.js} +2 -0
  11. package/bin/chunk-Q3DQKTOI.js.map +1 -0
  12. package/bin/{chunk-K3LWFM6S.js → chunk-VBJB46HW.js} +13 -17
  13. package/bin/chunk-VBJB46HW.js.map +1 -0
  14. package/bin/git.cjs +941 -1500
  15. package/bin/git.cjs.map +1 -0
  16. package/bin/git.js +887 -1447
  17. package/bin/git.js.map +1 -0
  18. package/bin/post-checkout.cjs +16 -14
  19. package/bin/post-checkout.cjs.map +1 -0
  20. package/bin/post-checkout.js +5 -3
  21. package/bin/post-checkout.js.map +1 -0
  22. package/bin/post-commit.cjs +16 -14
  23. package/bin/post-commit.cjs.map +1 -0
  24. package/bin/post-commit.js +5 -3
  25. package/bin/post-commit.js.map +1 -0
  26. package/bin/post-merge.cjs +16 -14
  27. package/bin/post-merge.cjs.map +1 -0
  28. package/bin/post-merge.js +5 -3
  29. package/bin/post-merge.js.map +1 -0
  30. package/bin/pre-commit.cjs +14 -12
  31. package/bin/pre-commit.cjs.map +1 -0
  32. package/bin/pre-commit.js +4 -2
  33. package/bin/pre-commit.js.map +1 -0
  34. package/bin/pre-install.cjs +13 -11
  35. package/bin/pre-install.cjs.map +1 -0
  36. package/bin/pre-install.js +4 -2
  37. package/bin/pre-install.js.map +1 -0
  38. package/bin/pre-push.cjs +21 -19
  39. package/bin/pre-push.cjs.map +1 -0
  40. package/bin/pre-push.js +5 -3
  41. package/bin/pre-push.js.map +1 -0
  42. package/bin/prepare.cjs +11 -9
  43. package/bin/prepare.cjs.map +1 -0
  44. package/bin/prepare.js +4 -2
  45. package/bin/prepare.js.map +1 -0
  46. package/bin/version-warning.cjs +9 -7
  47. package/bin/version-warning.cjs.map +1 -0
  48. package/bin/version-warning.js +4 -2
  49. package/bin/version-warning.js.map +1 -0
  50. package/dist/chunk-3GGWHKRP.js +3 -6
  51. package/dist/chunk-4VPJA7YJ.cjs +9 -9
  52. package/dist/chunk-5XU2KBM6.js +1 -3
  53. package/dist/chunk-F7OO6L26.cjs +11 -16
  54. package/dist/chunk-JCEVFJCA.js +4 -14
  55. package/dist/chunk-KZRVQ5RZ.js +3 -11
  56. package/dist/chunk-M4QURF2M.cjs +2454 -0
  57. package/dist/chunk-NY53WLGC.cjs +16 -23
  58. package/dist/chunk-RJCCG4TV.js +2420 -0
  59. package/dist/chunk-YBAE6I5L.cjs +3 -3
  60. package/dist/commit/minimal.cjs +11 -3
  61. package/dist/commit/minimal.js +3 -10
  62. package/dist/commit/monorepo.cjs +11 -3
  63. package/dist/commit/monorepo.d.cts +1 -0
  64. package/dist/commit/monorepo.d.ts +1 -0
  65. package/dist/commit/monorepo.js +4 -11
  66. package/dist/commitlint/minimal.cjs +4 -5
  67. package/dist/commitlint/minimal.js +3 -6
  68. package/dist/commitlint/monorepo.cjs +4 -5
  69. package/dist/commitlint/monorepo.js +3 -6
  70. package/dist/index.cjs +40 -14
  71. package/dist/index.d.cts +4 -3
  72. package/dist/index.d.ts +4 -3
  73. package/dist/index.js +5 -20
  74. package/dist/release/config.cjs +30 -6
  75. package/dist/release/config.d.cts +33 -243
  76. package/dist/release/config.d.ts +33 -243
  77. package/dist/release/config.js +5 -14
  78. package/dist/types.cjs +7 -3
  79. package/dist/types.d.cts +91 -94
  80. package/dist/types.d.ts +91 -94
  81. package/dist/types.js +1 -6
  82. package/package.json +12 -12
  83. package/dist/chunk-GOKUSEH3.cjs +0 -77
  84. package/dist/chunk-YCEUZFMU.js +0 -77
package/bin/git.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var chunkL64XVBGM_cjs = require('./chunk-L64XVBGM.cjs');
5
- var chunkG3JMIIRF_cjs = require('./chunk-G3JMIIRF.cjs');
4
+ var chunkFH5OSXAJ_cjs = require('./chunk-FH5OSXAJ.cjs');
5
+ var chunkEHPPIARR_cjs = require('./chunk-EHPPIARR.cjs');
6
6
  var TOML = require('@ltd/j-toml');
7
7
  var commander = require('commander');
8
8
  var prompts = require('@inquirer/prompts');
@@ -25,38 +25,25 @@ var htmlparser2 = require('htmlparser2');
25
25
  var _ = require('underscore');
26
26
  var updateSection = require('update-section');
27
27
  var devkit = require('@nx/devkit');
28
- var publish_js = require('nx/src/command-line/release/publish.js');
29
- var version_js = require('nx/src/command-line/release/version.js');
30
- var nxJson_js = require('nx/src/config/nx-json.js');
31
- var enquirer = require('enquirer');
32
- var config$1 = require('nx/src/command-line/release/config/config');
33
- var deepMergeJson = require('nx/src/command-line/release/config/deep-merge-json');
34
- var filterReleaseGroups = require('nx/src/command-line/release/config/filter-release-groups');
35
- var versionPlans = require('nx/src/command-line/release/config/version-plans');
36
- var git = require('nx/src/command-line/release/utils/git');
37
- var launchEditor = require('nx/src/command-line/release/utils/launch-editor');
28
+ var axios = require('axios');
29
+ require('enquirer');
30
+ var os = require('os');
38
31
  var printChanges = require('nx/src/command-line/release/utils/print-changes');
39
- var printConfig = require('nx/src/command-line/release/utils/print-config');
40
32
  var github = require('nx/src/command-line/release/utils/remote-release-clients/github');
41
- var resolveNxJsonErrorMessage = require('nx/src/command-line/release/utils/resolve-nx-json-error-message');
42
33
  var shared = require('nx/src/command-line/release/utils/shared');
34
+ var yaml = require('yaml');
35
+ var chalk = require('chalk');
36
+ var utils = require('nx/src/tasks-runner/utils');
37
+ var prettier = require('prettier');
38
+ var release = require('nx/release');
39
+ var git = require('nx/src/command-line/release/utils/git');
43
40
  var nxJson = require('nx/src/config/nx-json');
44
41
  var tree = require('nx/src/generators/tree');
45
42
  var fileMapUtils = require('nx/src/project-graph/file-map-utils');
46
- var utils = require('nx/src/tasks-runner/utils');
47
- var isCi = require('nx/src/utils/is-ci');
48
- var output = require('nx/src/utils/output');
49
- var path = require('nx/src/utils/path');
50
- var workspaceRoot = require('nx/src/utils/workspace-root');
51
- var semver = require('semver');
52
- var tmp = require('tmp');
53
- var prettier = require('prettier');
54
43
  var execCommand_js = require('nx/src/command-line/release/utils/exec-command.js');
55
- var axios = require('axios');
44
+ var semver = require('semver');
56
45
  var DefaultChangelogRenderer = require('nx/release/changelog-renderer');
57
46
  var conventionalCommits = require('nx/src/command-line/release/config/conventional-commits');
58
- var os = require('os');
59
- var yaml = require('yaml');
60
47
 
61
48
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
62
49
 
@@ -74,6 +61,7 @@ var anchor__default = /*#__PURE__*/_interopDefault(anchor);
74
61
  var ___default = /*#__PURE__*/_interopDefault(_);
75
62
  var updateSection__default = /*#__PURE__*/_interopDefault(updateSection);
76
63
  var axios__default = /*#__PURE__*/_interopDefault(axios);
64
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
77
65
  var DefaultChangelogRenderer__default = /*#__PURE__*/_interopDefault(DefaultChangelogRenderer);
78
66
 
79
67
  function parseCargoToml(cargoString) {
@@ -402,9 +390,9 @@ function getRuleFromScopeEnum(scopeEnum) {
402
390
 
403
391
  // ../conventional-changelog/src/index.ts
404
392
  async function createPreset(variant = "monorepo") {
405
- const workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
393
+ const workspaceConfig = await chunkEHPPIARR_cjs.getWorkspaceConfig();
406
394
  if (variant === "minimal") {
407
- return chunkG3JMIIRF_cjs.defu(
395
+ return chunkEHPPIARR_cjs.defu(
408
396
  await createBasePreset__default.default({ ...COMMIT_CONFIGS.minimal.changelogs.props }),
409
397
  {
410
398
  ...COMMIT_CONFIGS.minimal,
@@ -418,7 +406,7 @@ async function createPreset(variant = "monorepo") {
418
406
  );
419
407
  }
420
408
  const nxScopes = await getNxScopes({ config: workspaceConfig });
421
- return chunkG3JMIIRF_cjs.defu(
409
+ return chunkEHPPIARR_cjs.defu(
422
410
  await createBasePreset__default.default({
423
411
  ...COMMIT_CONFIGS.monorepo.changelogs.props,
424
412
  scope: nxScopes
@@ -941,10 +929,10 @@ async function lint(message, config5) {
941
929
  throw new Error(`Could not find rule implementation for ${name}`);
942
930
  }
943
931
  const executableRule = rule;
944
- const [valid3, message2] = await executableRule(parsed, when, value);
932
+ const [valid2, message2] = await executableRule(parsed, when, value);
945
933
  return {
946
934
  level,
947
- valid: valid3,
935
+ valid: valid2,
948
936
  name,
949
937
  message: message2
950
938
  };
@@ -958,9 +946,9 @@ async function lint(message, config5) {
958
946
  const warnings = results.filter(
959
947
  (result) => result.level === 1 /* Warning */ && !result.valid
960
948
  );
961
- const valid2 = errors.length === 0;
949
+ const valid = errors.length === 0;
962
950
  return {
963
- valid: valid2,
951
+ valid,
964
952
  errors,
965
953
  warnings,
966
954
  input: buildCommitMessage(parsed)
@@ -970,7 +958,7 @@ async function lint(message, config5) {
970
958
  // src/commitlint/run.ts
971
959
  var COMMIT_EDITMSG_PATH = ".git/COMMIT_EDITMSG";
972
960
  async function runCommitLint(workspaceConfig, options) {
973
- chunkG3JMIIRF_cjs.writeInfo(
961
+ chunkEHPPIARR_cjs.writeInfo(
974
962
  "\u{1F4DD} Validating git commit message aligns with the Storm Software specification",
975
963
  workspaceConfig
976
964
  );
@@ -978,7 +966,7 @@ async function runCommitLint(workspaceConfig, options) {
978
966
  if (options.message && options.message !== COMMIT_EDITMSG_PATH) {
979
967
  commitMessage = options.message;
980
968
  } else {
981
- const commitFile = chunkG3JMIIRF_cjs.joinPaths(
969
+ const commitFile = chunkEHPPIARR_cjs.joinPaths(
982
970
  workspaceConfig.workspaceRoot,
983
971
  options.file || options.message || COMMIT_EDITMSG_PATH
984
972
  );
@@ -995,17 +983,17 @@ async function runCommitLint(workspaceConfig, options) {
995
983
  if (upstreamRemote) {
996
984
  const upstreamRemoteIdentifier = upstreamRemote.split(" ")[0]?.trim();
997
985
  if (!upstreamRemoteIdentifier) {
998
- chunkG3JMIIRF_cjs.writeWarning(
986
+ chunkEHPPIARR_cjs.writeWarning(
999
987
  `No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison.`,
1000
988
  workspaceConfig
1001
989
  );
1002
990
  return;
1003
991
  }
1004
- chunkG3JMIIRF_cjs.writeDebug(`Comparing against remote ${upstreamRemoteIdentifier}`);
992
+ chunkEHPPIARR_cjs.writeDebug(`Comparing against remote ${upstreamRemoteIdentifier}`);
1005
993
  const currentBranch = childProcess__default.default.execSync("git branch --show-current").toString().trim();
1006
994
  gitLogCmd = gitLogCmd + ` ${currentBranch} ^${upstreamRemoteIdentifier}/main`;
1007
995
  } else {
1008
- chunkG3JMIIRF_cjs.writeWarning(
996
+ chunkEHPPIARR_cjs.writeWarning(
1009
997
  `No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison against upstream main.`,
1010
998
  workspaceConfig
1011
999
  );
@@ -1013,7 +1001,7 @@ async function runCommitLint(workspaceConfig, options) {
1013
1001
  }
1014
1002
  commitMessage = childProcess__default.default.execSync(gitLogCmd).toString().trim();
1015
1003
  if (!commitMessage) {
1016
- chunkG3JMIIRF_cjs.writeWarning(
1004
+ chunkEHPPIARR_cjs.writeWarning(
1017
1005
  "No commits found. Skipping commit message validation.",
1018
1006
  workspaceConfig
1019
1007
  );
@@ -1023,7 +1011,7 @@ async function runCommitLint(workspaceConfig, options) {
1023
1011
  const preset = await createPreset(workspaceConfig.variant);
1024
1012
  const report = await lint(commitMessage, preset);
1025
1013
  if (!preset.commitlint.regex.test(commitMessage) || report.errors.length || report.warnings.length) {
1026
- chunkG3JMIIRF_cjs.writeSuccess(
1014
+ chunkEHPPIARR_cjs.writeSuccess(
1027
1015
  `Commit was processing completed successfully!`,
1028
1016
  workspaceConfig
1029
1017
  );
@@ -1235,7 +1223,7 @@ async function createState(workspaceConfig, configPath) {
1235
1223
  const project = projectConfigurations.projects[scope];
1236
1224
  if (project) {
1237
1225
  let description = `${project.name} - ${project.root}`;
1238
- const packageJsonPath = chunkG3JMIIRF_cjs.joinPaths(project.root, "package.json");
1226
+ const packageJsonPath = chunkEHPPIARR_cjs.joinPaths(project.root, "package.json");
1239
1227
  if (fs$1.existsSync(packageJsonPath)) {
1240
1228
  const packageJsonFile = await fs.readFile(packageJsonPath, "utf8");
1241
1229
  const packageJson = JSON.parse(packageJsonFile);
@@ -1309,10 +1297,10 @@ ${closedIssueEmoji}${config5.settings.closedIssueMessage}${issues}`;
1309
1297
 
1310
1298
  // src/commit/run.ts
1311
1299
  async function runCommit(commitizenFile, dryRun = false) {
1312
- const workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
1300
+ const workspaceConfig = await chunkEHPPIARR_cjs.getWorkspaceConfig();
1313
1301
  const state = await createState(workspaceConfig);
1314
1302
  if (dryRun) {
1315
- chunkG3JMIIRF_cjs.writeInfo("Running in dry mode.", workspaceConfig);
1303
+ chunkEHPPIARR_cjs.writeInfo("Running in dry mode.", workspaceConfig);
1316
1304
  }
1317
1305
  console.log(chalkTemplate__default.default`
1318
1306
  {bold.#999999 ----------------------------------------}
@@ -1322,7 +1310,7 @@ async function runCommit(commitizenFile, dryRun = false) {
1322
1310
  `);
1323
1311
  state.answers = await askQuestions(state);
1324
1312
  const message = formatCommitMessage(state, workspaceConfig);
1325
- const commitMsgFile = chunkG3JMIIRF_cjs.joinPaths(getGitDir(), "COMMIT_EDITMSG");
1313
+ const commitMsgFile = chunkEHPPIARR_cjs.joinPaths(getGitDir(), "COMMIT_EDITMSG");
1326
1314
  console.log(chalkTemplate__default.default`
1327
1315
  {bold.#999999 ----------------------------------------}
1328
1316
 
@@ -1335,14 +1323,14 @@ async function runCommit(commitizenFile, dryRun = false) {
1335
1323
  commandItems.push(...["--file", commitMsgFile]);
1336
1324
  const command = shellescape__default.default(commandItems);
1337
1325
  if (dryRun) {
1338
- chunkG3JMIIRF_cjs.writeDebug(
1326
+ chunkEHPPIARR_cjs.writeDebug(
1339
1327
  `Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
1340
1328
  workspaceConfig
1341
1329
  );
1342
- chunkG3JMIIRF_cjs.writeDebug(`Message [dry-run]: ${message}`, workspaceConfig);
1330
+ chunkEHPPIARR_cjs.writeDebug(`Message [dry-run]: ${message}`, workspaceConfig);
1343
1331
  } else {
1344
1332
  await fs__default.default.writeFile(commitMsgFile, message);
1345
- chunkL64XVBGM_cjs.run(workspaceConfig, command);
1333
+ chunkFH5OSXAJ_cjs.run(workspaceConfig, command);
1346
1334
  }
1347
1335
  }
1348
1336
  async function askQuestions(state) {
@@ -1405,6 +1393,15 @@ function findFileName(filePath) {
1405
1393
  function findFilePath(filePath) {
1406
1394
  return filePath.replace(findFileName(filePath), "");
1407
1395
  }
1396
+ function createFileToProjectMap(projectFileMap) {
1397
+ const fileToProjectMap = {};
1398
+ for (const [projectName, projectFiles] of Object.entries(projectFileMap)) {
1399
+ for (const file of projectFiles) {
1400
+ fileToProjectMap[file.file] = projectName;
1401
+ }
1402
+ }
1403
+ return fileToProjectMap;
1404
+ }
1408
1405
  var start = "<!-- START doctoc -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->";
1409
1406
  var end = "<!-- END doctoc -->";
1410
1407
  var skipTag = "<!-- DOCTOC SKIP -->";
@@ -1969,7 +1966,7 @@ var createRegExp = (sectionName) => {
1969
1966
  var runReadme = async ({
1970
1967
  templates = "./tools/readme-templates",
1971
1968
  project,
1972
- output: output3,
1969
+ output: output4,
1973
1970
  clean = true,
1974
1971
  prettier = true
1975
1972
  }) => {
@@ -1980,7 +1977,7 @@ var runReadme = async ({
1980
1977
  if (project) {
1981
1978
  await runProjectReadme(project, {
1982
1979
  templates,
1983
- output: output3,
1980
+ output: output4,
1984
1981
  clean,
1985
1982
  prettier
1986
1983
  });
@@ -1988,14 +1985,14 @@ var runReadme = async ({
1988
1985
  for (const projectName of Object.keys(projectConfigs.projects)) {
1989
1986
  await runProjectReadme(projectName, {
1990
1987
  templates,
1991
- output: output3,
1988
+ output: output4,
1992
1989
  clean,
1993
1990
  prettier
1994
1991
  });
1995
1992
  }
1996
1993
  }
1997
1994
  };
1998
- var runProjectReadme = async (projectName, { templates, output: output3, clean = true, prettier = true }) => {
1995
+ var runProjectReadme = async (projectName, { templates, output: output4, clean = true, prettier = true }) => {
1999
1996
  const projectGraph = await projectGraph_js.createProjectGraphAsync({
2000
1997
  exitOnError: true
2001
1998
  });
@@ -2004,7 +2001,7 @@ var runProjectReadme = async (projectName, { templates, output: output3, clean =
2004
2001
  const inputFile = Path.join(project?.root ?? "./", "README.md");
2005
2002
  if (fs$1.existsSync(inputFile)) {
2006
2003
  console.info(`Formatting ${projectName}'s README file at "${inputFile}"`);
2007
- const outputFilePath = output3 ? output3.includes("README.md") ? output3 : Path.join(findFilePath(output3), "README.md") : inputFile;
2004
+ const outputFilePath = output4 ? output4.includes("README.md") ? output4 : Path.join(findFilePath(output4), "README.md") : inputFile;
2008
2005
  if (clean && fs$1.existsSync(outputFilePath)) {
2009
2006
  if (outputFilePath === inputFile) {
2010
2007
  console.warn(
@@ -2371,7 +2368,7 @@ async function generateChangelogContent(releaseVersion, filepath, newContent, cu
2371
2368
  const header = await prettier.format(
2372
2369
  `![${(typeof workspaceConfig?.release.banner === "string" ? workspaceConfig.organization ? titleCase(
2373
2370
  typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization.name
2374
- ) : void 0 : workspaceConfig?.release.banner.alt) || "Branded release banner image"}](${bannerUrl || chunkG3JMIIRF_cjs.STORM_DEFAULT_RELEASE_BANNER})
2371
+ ) : void 0 : workspaceConfig?.release.banner.alt) || "Branded release banner image"}](${bannerUrl || chunkEHPPIARR_cjs.STORM_DEFAULT_RELEASE_BANNER})
2375
2372
 
2376
2373
  # Changelog ${project || workspaceConfig?.name ? "for" : ""}${workspaceConfig?.name ? ` ${titleCase(workspaceConfig.name)}` : ""}${project ? `${workspaceConfig?.name ? " -" : ""} ${titleCase(project)}` : ""}
2377
2374
 
@@ -2413,7 +2410,7 @@ function generateChangelogTitle(version, project, workspaceConfig) {
2413
2410
  if (!workspaceConfig?.name || !project) {
2414
2411
  return version;
2415
2412
  }
2416
- return `[${version}](https://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}/releases/tag/${project}%40${version}) (${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)})`;
2413
+ return `[${version}](https://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}/releases/tag/${project}%40${version}) (${(/* @__PURE__ */ new Date()).getMonth() + 1}/${(/* @__PURE__ */ new Date()).getDate()}/${(/* @__PURE__ */ new Date()).getFullYear()})`;
2417
2414
  }
2418
2415
  function parseChangelogMarkdown(contents) {
2419
2416
  const CHANGELOG_RELEASE_HEAD_RE = new RegExp(
@@ -2442,6 +2439,357 @@ function parseChangelogMarkdown(contents) {
2442
2439
  releases
2443
2440
  };
2444
2441
  }
2442
+ function filterHiddenChanges(changes, conventionalCommitsConfig) {
2443
+ return changes.filter((change) => {
2444
+ const type = change.type;
2445
+ const typeConfig = conventionalCommitsConfig.types[type];
2446
+ if (!typeConfig) {
2447
+ return false;
2448
+ }
2449
+ return !typeConfig.changelog.hidden;
2450
+ });
2451
+ }
2452
+ async function generateChangelogForProjects({
2453
+ args,
2454
+ changes,
2455
+ projectsVersionData,
2456
+ releaseGroup,
2457
+ projects,
2458
+ releaseConfig,
2459
+ projectToAdditionalDependencyBumps,
2460
+ workspaceConfig,
2461
+ ChangelogRendererClass
2462
+ }) {
2463
+ const config5 = releaseGroup.changelog;
2464
+ if (config5 === false) {
2465
+ return;
2466
+ }
2467
+ const dryRun = !!args.dryRun;
2468
+ const remoteReleaseClient = await createGithubRemoteReleaseClient(
2469
+ workspaceConfig,
2470
+ args.gitRemote
2471
+ );
2472
+ const projectChangelogs = {};
2473
+ for (const project of projects) {
2474
+ let interpolatedTreePath = config5.file || "";
2475
+ if (interpolatedTreePath) {
2476
+ interpolatedTreePath = utils.interpolate(interpolatedTreePath, {
2477
+ projectName: project.name,
2478
+ projectRoot: project.data.root,
2479
+ workspaceRoot: ""
2480
+ // within the tree, workspaceRoot is the root
2481
+ });
2482
+ }
2483
+ if (!projectsVersionData[project.name] || projectsVersionData[project.name]?.newVersion === null && !projectsVersionData[project.name]?.dockerVersion) {
2484
+ continue;
2485
+ }
2486
+ const preferDockerVersion = shared.shouldPreferDockerVersionForReleaseGroup(releaseGroup);
2487
+ const releaseVersion = new shared.ReleaseVersion({
2488
+ version: (preferDockerVersion === true || preferDockerVersion === "both") && projectsVersionData[project.name]?.dockerVersion ? projectsVersionData[project.name]?.dockerVersion : projectsVersionData[project.name]?.newVersion,
2489
+ releaseTagPattern: releaseGroup.releaseTag.pattern,
2490
+ projectName: project.name
2491
+ });
2492
+ if (interpolatedTreePath) {
2493
+ const prefix = dryRun ? "Previewing" : "Generating";
2494
+ devkit.output.log({
2495
+ title: `${prefix} an entry in ${interpolatedTreePath} for ${chalk__default.default.white(
2496
+ releaseVersion.gitTag
2497
+ )}`
2498
+ });
2499
+ }
2500
+ const changelogRenderer = new ChangelogRendererClass({
2501
+ changes,
2502
+ changelogEntryVersion: releaseVersion.rawVersion,
2503
+ project: project.name,
2504
+ entryWhenNoChanges: typeof config5.entryWhenNoChanges === "string" ? utils.interpolate(config5.entryWhenNoChanges, {
2505
+ projectName: project.name,
2506
+ projectRoot: project.data.root,
2507
+ workspaceRoot: ""
2508
+ // within the tree, workspaceRoot is the root
2509
+ }) : false,
2510
+ changelogRenderOptions: config5.renderOptions,
2511
+ isVersionPlans: !!releaseGroup.versionPlans,
2512
+ conventionalCommitsConfig: releaseConfig.conventionalCommits,
2513
+ dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
2514
+ remoteReleaseClient,
2515
+ workspaceConfig
2516
+ });
2517
+ const contents = await changelogRenderer.render();
2518
+ const postGitTask = args.createRelease !== false && config5.createRelease ? remoteReleaseClient.createPostGitTask(
2519
+ releaseVersion,
2520
+ contents,
2521
+ dryRun
2522
+ ) : null;
2523
+ projectChangelogs[project.name] = {
2524
+ releaseVersion,
2525
+ contents,
2526
+ postGitTask
2527
+ };
2528
+ }
2529
+ return projectChangelogs;
2530
+ }
2531
+
2532
+ // src/release/github.ts
2533
+ var StormGithubRemoteReleaseClient = class extends github.GithubRemoteReleaseClient {
2534
+ #remoteRepoData;
2535
+ #workspaceConfig;
2536
+ /**
2537
+ * Creates an instance of {@link StormGithubRemoteReleaseClient}.
2538
+ *
2539
+ * @param remoteRepoData - Data about the remote repository
2540
+ * @param createReleaseConfig - Configuration for creating releases
2541
+ * @param tokenData - Token data for authentication
2542
+ * @param workspaceConfig - The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
2543
+ */
2544
+ constructor(remoteRepoData, createReleaseConfig, tokenData, workspaceConfig) {
2545
+ super(remoteRepoData, createReleaseConfig, tokenData);
2546
+ this.#remoteRepoData = remoteRepoData;
2547
+ this.#workspaceConfig = workspaceConfig;
2548
+ }
2549
+ createPostGitTask(releaseVersion, changelogContents, dryRun) {
2550
+ return async (latestCommit) => {
2551
+ if (!this.#workspaceConfig) {
2552
+ this.#workspaceConfig = await chunkEHPPIARR_cjs.getWorkspaceConfig();
2553
+ }
2554
+ devkit.output.logSingleLine(`Creating GitHub Release`);
2555
+ const name = releaseVersion.gitTag.includes("@") ? releaseVersion.gitTag.replace(new RegExp(`^@${this.#workspaceConfig.name}/`), "").replace(/@.*$/, "") : releaseVersion.gitTag;
2556
+ await this.createOrUpdateRelease(
2557
+ releaseVersion,
2558
+ `![${(typeof this.#workspaceConfig.release.banner === "string" ? this.#workspaceConfig.organization ? titleCase(
2559
+ typeof this.#workspaceConfig.organization === "string" ? this.#workspaceConfig.organization : this.#workspaceConfig.organization.name
2560
+ ) : void 0 : this.#workspaceConfig.release.banner.alt) || "Release banner header"}](${typeof this.#workspaceConfig.release.banner === "string" ? this.#workspaceConfig.release.banner : this.#workspaceConfig.release.banner?.url})
2561
+ ${this.#workspaceConfig.release.header || ""}
2562
+
2563
+ # ${name ? `${titleCase(name)} ` : ""}v${releaseVersion.rawVersion}
2564
+
2565
+ We at [${this.#workspaceConfig.organization ? titleCase(
2566
+ typeof this.#workspaceConfig.organization === "string" ? this.#workspaceConfig.organization : this.#workspaceConfig.organization.name
2567
+ ) : ""}](${this.#workspaceConfig.homepage}) are very excited to announce the v${releaseVersion.rawVersion} release of the ${name ? this.#workspaceConfig.name ? `${titleCase(this.#workspaceConfig.name)} - ${titleCase(name)}` : titleCase(name) : this.#workspaceConfig.name ? titleCase(this.#workspaceConfig.name) : "Storm Software"} project! \u{1F680}
2568
+
2569
+ These changes are released under the ${this.#workspaceConfig.license.includes("license") ? this.#workspaceConfig.license : `${this.#workspaceConfig.license} license`}. You can find more details on [our licensing page](${this.#workspaceConfig.licensing}). You can find guides, API references, and other documentation around this release (and much more) on [our documentation site](${this.#workspaceConfig.docs}).
2570
+
2571
+ If you have any questions or comments, feel free to reach out to the team on [Discord](${this.#workspaceConfig.socials.discord}) or [our contact page](${this.#workspaceConfig.contact}). Please help us spread the word by giving [this repository](https://github.com/${typeof this.#workspaceConfig.organization === "string" ? this.#workspaceConfig.organization : this.#workspaceConfig.organization?.name}/${this.#workspaceConfig.name}) a star \u2B50 on GitHub or [posting on X (Twitter)](https://x.com/intent/tweet?text=Check%20out%20the%20latest%20@${this.#workspaceConfig.socials.twitter}%20release%20${name ? `${titleCase(name)?.replaceAll(" ", "%20")}%20` : ""}v${releaseVersion.rawVersion}%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/${typeof this.#workspaceConfig.organization === "string" ? this.#workspaceConfig.organization : this.#workspaceConfig.organization?.name}/${this.#workspaceConfig.name}/releases/tag/${releaseVersion.gitTag}) about this release!
2572
+
2573
+ ## Release Notes
2574
+
2575
+ ${changelogContents.replaceAll(
2576
+ `## ${generateChangelogTitle(
2577
+ releaseVersion.rawVersion,
2578
+ name,
2579
+ this.#workspaceConfig
2580
+ )}`,
2581
+ ""
2582
+ ).replaceAll(
2583
+ `# ${generateChangelogTitle(releaseVersion.rawVersion, name, this.#workspaceConfig)}`,
2584
+ ""
2585
+ )}
2586
+
2587
+ ---
2588
+
2589
+ ${this.#workspaceConfig.release.footer}
2590
+ `,
2591
+ latestCommit,
2592
+ { dryRun }
2593
+ );
2594
+ };
2595
+ }
2596
+ /**
2597
+ * Get remote repository data, attempting to resolve it if not already set.
2598
+ */
2599
+ getRemoteRepoData() {
2600
+ if (!this.#remoteRepoData) {
2601
+ let githubRepoData = super.getRemoteRepoData();
2602
+ if (!githubRepoData) {
2603
+ githubRepoData = getGitHubRepoData();
2604
+ if (!githubRepoData) {
2605
+ devkit.output.error({
2606
+ title: `Unable to create a GitHub release because the GitHub repo slug could not be determined.`,
2607
+ bodyLines: [
2608
+ `Please ensure you have a valid GitHub remote configured. You can run \`git remote -v\` to list your current remotes.`
2609
+ ]
2610
+ });
2611
+ process.exit(1);
2612
+ }
2613
+ }
2614
+ this.#remoteRepoData = githubRepoData;
2615
+ }
2616
+ return this.#remoteRepoData;
2617
+ }
2618
+ };
2619
+ function getGitHubRepoData(remoteName = "origin", createReleaseConfig = "github") {
2620
+ try {
2621
+ const remoteUrl = childProcess.execSync(`git remote get-url ${remoteName}`, {
2622
+ encoding: "utf8",
2623
+ stdio: "pipe"
2624
+ }).trim();
2625
+ let hostname = github.defaultCreateReleaseProvider.hostname;
2626
+ let apiBaseUrl = github.defaultCreateReleaseProvider.apiBaseUrl;
2627
+ if (createReleaseConfig && typeof createReleaseConfig !== "string") {
2628
+ hostname = createReleaseConfig.hostname;
2629
+ apiBaseUrl = createReleaseConfig.apiBaseUrl;
2630
+ }
2631
+ const escapedHostname = hostname.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2632
+ const regexString = `${escapedHostname}[/:]([\\w.-]+/[\\w.-]+)(\\.git)?`;
2633
+ const regex = new RegExp(regexString);
2634
+ const match = remoteUrl?.match(regex);
2635
+ if (match && match[1]) {
2636
+ return {
2637
+ hostname,
2638
+ apiBaseUrl,
2639
+ // Ensure any trailing .git is stripped
2640
+ slug: match[1].replace(/\.git$/, "")
2641
+ };
2642
+ } else {
2643
+ throw new Error(
2644
+ `Could not extract "user/repo" data from the resolved remote URL: ${remoteUrl}`
2645
+ );
2646
+ }
2647
+ } catch (error) {
2648
+ devkit.output.error({
2649
+ title: `Failed to get GitHub repo data`,
2650
+ bodyLines: [error.message]
2651
+ });
2652
+ return void 0;
2653
+ }
2654
+ }
2655
+ async function resolveTokenData(hostname) {
2656
+ const tokenFromEnv = process.env.STORM_BOT_GITHUB_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
2657
+ if (tokenFromEnv) {
2658
+ return { token: tokenFromEnv, headerName: "Authorization" };
2659
+ }
2660
+ const ghCLIPath = devkit.joinPathFragments(
2661
+ process.env.XDG_CONFIG_HOME || devkit.joinPathFragments(os.homedir(), ".config"),
2662
+ "gh",
2663
+ "hosts.yml"
2664
+ );
2665
+ if (fs$1.existsSync(ghCLIPath)) {
2666
+ const yamlContents = await fs$1.promises.readFile(ghCLIPath, "utf8");
2667
+ const ghCLIConfig = yaml.parse(yamlContents);
2668
+ if (ghCLIConfig[hostname]) {
2669
+ if (ghCLIConfig[hostname].oauth_token) {
2670
+ return ghCLIConfig[hostname].oauth_token;
2671
+ }
2672
+ if (ghCLIConfig[hostname].user && ghCLIConfig[hostname].git_protocol === "ssh") {
2673
+ const token = childProcess.execSync(`gh auth token`, {
2674
+ encoding: "utf8",
2675
+ stdio: "pipe",
2676
+ windowsHide: false
2677
+ }).trim();
2678
+ return { token, headerName: "Authorization" };
2679
+ }
2680
+ }
2681
+ }
2682
+ if (hostname !== "github.com") {
2683
+ console.log(
2684
+ `Warning: It was not possible to automatically resolve a GitHub token from your environment for hostname ${hostname}. If you set the GITHUB_TOKEN or GH_TOKEN environment variable, that will be used for GitHub API requests.`
2685
+ );
2686
+ }
2687
+ throw new Error(
2688
+ `Unable to resolve a GitHub token for hostname ${hostname}. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
2689
+ );
2690
+ }
2691
+ async function makeGithubRequest(config5, url, opts = {}) {
2692
+ return await axios__default.default(url, {
2693
+ ...opts,
2694
+ baseURL: config5.apiBaseUrl,
2695
+ headers: {
2696
+ ...opts.headers,
2697
+ Authorization: config5.token ? `Bearer ${config5.token}` : void 0
2698
+ }
2699
+ });
2700
+ }
2701
+ async function createGithubRemoteReleaseClient(workspaceConfig, remoteName = "origin") {
2702
+ const repoData = getGitHubRepoData(remoteName, "github");
2703
+ if (!repoData) {
2704
+ throw new Error(
2705
+ `Unable to create a remote release client because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
2706
+ );
2707
+ }
2708
+ return new StormGithubRemoteReleaseClient(
2709
+ repoData,
2710
+ {
2711
+ provider: "github",
2712
+ hostname: repoData.hostname,
2713
+ apiBaseUrl: repoData.apiBaseUrl
2714
+ },
2715
+ await resolveTokenData(repoData.hostname),
2716
+ workspaceConfig
2717
+ );
2718
+ }
2719
+ async function isUserAnOrganizationMember(userId, config5, remoteName = "origin") {
2720
+ try {
2721
+ const repoData = getGitHubRepoData(remoteName, "github");
2722
+ if (!repoData) {
2723
+ throw new Error(
2724
+ `Unable to validate GitHub actor because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
2725
+ );
2726
+ }
2727
+ const tokenData = await resolveTokenData(repoData.hostname);
2728
+ if (!tokenData.token) {
2729
+ throw new Error(
2730
+ `Unable to validate GitHub actor because no token was provided. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
2731
+ );
2732
+ }
2733
+ const result = await makeGithubRequest(
2734
+ {
2735
+ repo: repoData.slug,
2736
+ hostname: repoData.hostname,
2737
+ apiBaseUrl: repoData.apiBaseUrl,
2738
+ token: tokenData?.token || null
2739
+ },
2740
+ `/orgs/${typeof config5.organization === "string" ? config5.organization : config5.organization?.name}/members/${userId}`,
2741
+ {}
2742
+ );
2743
+ if (result.status !== 204) {
2744
+ return false;
2745
+ }
2746
+ return true;
2747
+ } catch {
2748
+ return false;
2749
+ }
2750
+ }
2751
+ async function getCommits(fromSHA, toSHA) {
2752
+ const rawCommits = await git.getGitDiff(fromSHA, toSHA);
2753
+ return git.parseCommits(rawCommits);
2754
+ }
2755
+ async function filterProjectCommits({
2756
+ fromSHA,
2757
+ toSHA,
2758
+ projectPath
2759
+ }) {
2760
+ const allCommits = await getCommits(fromSHA, toSHA);
2761
+ return allCommits.filter(
2762
+ (c) => c.affectedFiles.find((f) => f.startsWith(projectPath))
2763
+ );
2764
+ }
2765
+ function commitChangesNonProjectFiles(commit, nonProjectFiles) {
2766
+ return nonProjectFiles.some(
2767
+ (fileData) => commit.affectedFiles.includes(fileData.file)
2768
+ );
2769
+ }
2770
+ function getProjectsAffectedByCommit(commit, fileToProjectMap) {
2771
+ const affectedProjects = /* @__PURE__ */ new Set();
2772
+ for (const file of commit.affectedFiles) {
2773
+ affectedProjects.add(fileToProjectMap[file]);
2774
+ }
2775
+ return Array.from(affectedProjects);
2776
+ }
2777
+ function extractPreid(version) {
2778
+ if (!shared.isPrerelease(version)) {
2779
+ return void 0;
2780
+ }
2781
+ const preid = semver.prerelease(version)?.[0];
2782
+ if (typeof preid === "string") {
2783
+ if (preid.trim() === "") {
2784
+ return void 0;
2785
+ }
2786
+ return preid;
2787
+ }
2788
+ if (typeof preid === "number") {
2789
+ return preid.toString();
2790
+ }
2791
+ return void 0;
2792
+ }
2445
2793
  function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versionData) {
2446
2794
  const tags = [];
2447
2795
  for (const releaseGroup of releaseGroups) {
@@ -2588,30 +2936,43 @@ async function commitChanges({
2588
2936
  verbose: isVerbose2
2589
2937
  });
2590
2938
  }
2939
+
2940
+ // src/utilities/omit.ts
2941
+ function omit(obj, keys) {
2942
+ const result = { ...obj };
2943
+ for (let i = 0; i < keys.length; i++) {
2944
+ const key = keys[i];
2945
+ if (key && key in result) {
2946
+ delete result[key];
2947
+ }
2948
+ }
2949
+ return result;
2950
+ }
2591
2951
  var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.default {
2592
2952
  /**
2593
2953
  * The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
2594
2954
  */
2595
- workspaceConfig = null;
2596
- /**
2597
- * The configuration object for the ChangelogRenderer, which includes the changes, version, project, and other options.
2598
- */
2599
- config;
2955
+ workspaceConfig;
2600
2956
  /**
2601
2957
  * A ChangelogRenderer class takes in the determined changes and other relevant metadata and returns a string, or a Promise of a string of changelog contents (usually markdown).
2602
2958
  *
2603
2959
  * @param config - The configuration object for the ChangelogRenderer
2604
2960
  */
2605
2961
  constructor(config5) {
2606
- super(config5);
2607
- this.config = {
2608
- ...config5,
2609
- repoData: config5.remoteReleaseClient.getRemoteRepoData()
2962
+ const resolvedConfig = {
2963
+ entryWhenNoChanges: false,
2964
+ conventionalCommitsConfig: conventionalCommits.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
2965
+ ...config5
2610
2966
  };
2967
+ super(resolvedConfig);
2968
+ this.workspaceConfig = config5.workspaceConfig;
2969
+ this.remoteReleaseClient = resolvedConfig.remoteReleaseClient;
2611
2970
  }
2612
2971
  async render() {
2613
- this.workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
2614
- return await super.render();
2972
+ if (!this.workspaceConfig) {
2973
+ this.workspaceConfig = await chunkEHPPIARR_cjs.getWorkspaceConfig();
2974
+ }
2975
+ return super.render();
2615
2976
  }
2616
2977
  preprocessChanges() {
2617
2978
  this.relevantChanges = [...this.changes];
@@ -2690,7 +3051,7 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
2690
3051
  renderDependencyBumps() {
2691
3052
  const markdownLines = ["", "### Updated Dependencies", ""];
2692
3053
  this.dependencyBumps?.forEach(({ dependencyName, newVersion }) => {
2693
- const markdownLine = `- Updated ${dependencyName} to ${newVersion}`;
3054
+ const markdownLine = `- Updated **${dependencyName}** to **v${newVersion}**`;
2694
3055
  if (!markdownLines.includes(markdownLine)) {
2695
3056
  markdownLines.push(markdownLine);
2696
3057
  }
@@ -2720,7 +3081,7 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
2720
3081
  }
2721
3082
  }
2722
3083
  }
2723
- if (this.config.repoData && this.changelogRenderOptions.mapAuthorsToGitHubUsernames) {
3084
+ if (this.changelogRenderOptions.mapAuthorsToGitHubUsernames) {
2724
3085
  await Promise.all(
2725
3086
  [..._authors.keys()].map(async (authorName) => {
2726
3087
  const meta = _authors.get(authorName);
@@ -2777,7 +3138,7 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
2777
3138
  extraLinesStr = extraLines.filter((l) => l.trim().length > 0).map((l) => `${indentation}${l}`).join("\n");
2778
3139
  }
2779
3140
  let changeLine = "- " + (!this.isVersionPlans && change.scope ? `**${change.scope.trim()}:** ` : "") + description;
2780
- if (this.config.repoData && change.githubReferences) {
3141
+ if (change.githubReferences) {
2781
3142
  changeLine += this.remoteReleaseClient.formatReferences(
2782
3143
  change.githubReferences
2783
3144
  );
@@ -2788,626 +3149,239 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
2788
3149
  return changeLine;
2789
3150
  }
2790
3151
  };
2791
- function getGitHubRepoData(remoteName = "origin", createReleaseConfig) {
2792
- try {
2793
- const remoteUrl = childProcess.execSync(`git remote get-url ${remoteName}`, {
2794
- encoding: "utf8",
2795
- stdio: "pipe"
2796
- }).trim();
2797
- let hostname = github.defaultCreateReleaseProvider.hostname;
2798
- let apiBaseUrl = github.defaultCreateReleaseProvider.apiBaseUrl;
2799
- if (createReleaseConfig && typeof createReleaseConfig !== "string") {
2800
- hostname = createReleaseConfig.hostname;
2801
- apiBaseUrl = createReleaseConfig.apiBaseUrl;
2802
- }
2803
- const escapedHostname = hostname.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2804
- const regexString = `${escapedHostname}[/:]([\\w.-]+/[\\w.-]+)(\\.git)?`;
2805
- const regex = new RegExp(regexString);
2806
- const match = remoteUrl?.match(regex);
2807
- if (match && match[1]) {
2808
- return {
2809
- hostname,
2810
- apiBaseUrl,
2811
- // Ensure any trailing .git is stripped
2812
- slug: match[1].replace(/\.git$/, "")
2813
- };
2814
- } else {
2815
- throw new Error(
2816
- `Could not extract "user/repo" data from the resolved remote URL: ${remoteUrl}`
2817
- );
2818
- }
2819
- } catch (error) {
2820
- devkit.output.error({
2821
- title: `Failed to get GitHub repo data`,
2822
- bodyLines: [error.message]
2823
- });
2824
- return void 0;
2825
- }
2826
- }
2827
- async function createOrUpdateGithubRelease(createReleaseConfig, releaseVersion, changelogContents, latestCommit, { dryRun }) {
2828
- const githubRepoData = getGitHubRepoData(void 0, createReleaseConfig);
2829
- if (!githubRepoData) {
2830
- devkit.output.error({
2831
- title: `Unable to create a GitHub release because the GitHub repo slug could not be determined.`,
2832
- bodyLines: [
2833
- `Please ensure you have a valid GitHub remote configured. You can run \`git remote -v\` to list your current remotes.`
2834
- ]
2835
- });
2836
- process.exit(1);
2837
- }
2838
- const tokenData = await resolveTokenData(githubRepoData.hostname);
2839
- const githubRequestConfig = {
2840
- repo: githubRepoData.slug,
2841
- hostname: githubRepoData.hostname,
2842
- apiBaseUrl: githubRepoData.apiBaseUrl,
2843
- token: tokenData?.token || null
2844
- };
2845
- let existingGithubReleaseForVersion;
2846
- try {
2847
- existingGithubReleaseForVersion = await getGithubReleaseByTag(
2848
- githubRequestConfig,
2849
- releaseVersion.gitTag
2850
- );
2851
- } catch (err) {
2852
- if (err.response?.status === 401) {
2853
- devkit.output.error({
2854
- title: `Unable to resolve data via the GitHub API. You can use any of the following options to resolve this:`,
2855
- bodyLines: [
2856
- "- Set the `GITHUB_TOKEN` or `GH_TOKEN` environment variable to a valid GitHub token with `repo` scope",
2857
- "- Have an active session via the official gh CLI tool (https://cli.github.com) in your current terminal"
2858
- ]
2859
- });
2860
- process.exit(1);
2861
- }
2862
- if (err.response?.status === 404) ; else {
2863
- throw err;
2864
- }
2865
- }
2866
- const logTitle = `https://${githubRepoData.hostname}/${githubRepoData.slug}/releases/tag/${releaseVersion.gitTag}`;
2867
- if (existingGithubReleaseForVersion) {
2868
- console.error(`UPDATE ${logTitle}${dryRun ? " [dry-run]" : ""}`);
2869
- } else {
2870
- console.error(`CREATE ${logTitle}${dryRun ? " [dry-run]" : ""}`);
2871
- }
2872
- console.log("");
2873
- printChanges.printDiff(
2874
- existingGithubReleaseForVersion?.body ? existingGithubReleaseForVersion.body : "",
2875
- changelogContents,
2876
- 3,
2877
- shared.noDiffInChangelogMessage
2878
- );
2879
- if (!dryRun) {
2880
- await createOrUpdateGithubReleaseInternal(
2881
- githubRequestConfig,
2882
- {
2883
- version: releaseVersion.gitTag,
2884
- prerelease: releaseVersion.isPrerelease,
2885
- body: changelogContents,
2886
- commit: latestCommit
2887
- },
2888
- existingGithubReleaseForVersion
2889
- );
2890
- }
2891
- }
2892
- async function createOrUpdateGithubReleaseInternal(githubRequestConfig, release, existingGithubReleaseForVersion) {
2893
- const result = await syncGithubRelease(
2894
- githubRequestConfig,
2895
- release,
2896
- existingGithubReleaseForVersion
2897
- );
2898
- if (result.status === "manual") {
2899
- if (result.error) {
2900
- process.exitCode = 1;
2901
- if (result.error.response?.data) {
2902
- devkit.output.error({
2903
- title: `A GitHub API Error occurred when creating/updating the release`,
2904
- bodyLines: [
2905
- `GitHub Error: ${JSON.stringify(result.error.response.data)}`,
2906
- `---`,
2907
- `Request Data:`,
2908
- `Repo: ${githubRequestConfig.repo}`,
2909
- `Token: ${githubRequestConfig.token}`,
2910
- `Body: ${JSON.stringify(result.requestData)}`
2911
- ]
2912
- });
2913
- } else {
2914
- console.log(result.error);
2915
- console.error(
2916
- `An unknown error occurred while trying to create a release on GitHub, please report this on https://github.com/nrwl/nx (NOTE: make sure to redact your GitHub token from the error message!)`
2917
- );
2918
- }
2919
- }
2920
- const shouldContinueInGitHub = await promptForContinueInGitHub();
2921
- if (!shouldContinueInGitHub) {
2922
- return;
2923
- }
2924
- const open = chunkG3JMIIRF_cjs.__require("open");
2925
- await open(result.url).then(() => {
2926
- console.info(
2927
- `
2928
- Follow up in the browser to manually create the release:
2929
3152
 
2930
- ` + result.url + `
2931
- `
2932
- );
2933
- }).catch(() => {
2934
- console.info(
2935
- `Open this link to manually create a release:
2936
- ` + result.url + "\n"
2937
- );
2938
- });
2939
- if (result.error) {
2940
- console.error(result.error);
2941
- process.exitCode = 1;
3153
+ // src/release/config.ts
3154
+ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
3155
+ questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
3156
+ types: DEFAULT_COMMIT_TYPES
3157
+ };
3158
+ var DEFAULT_RELEASE_TAG_PATTERN = "{projectName}@{version}";
3159
+ var DEFAULT_RELEASE_GROUP_CONFIG = {
3160
+ projectsRelationship: "independent",
3161
+ changelog: {
3162
+ createRelease: "github",
3163
+ entryWhenNoChanges: false,
3164
+ file: false,
3165
+ renderOptions: {
3166
+ authors: false,
3167
+ commitReferences: true,
3168
+ versionTitleDate: true
2942
3169
  }
2943
- await open(result.url).then(() => {
2944
- console.info(
2945
- `Follow up in the browser to manually create the release.`
2946
- );
2947
- }).catch(() => {
2948
- console.info(
2949
- `Open this link to manually create a release:
2950
- ` + result.url + "\n"
2951
- );
2952
- });
2953
- }
2954
- }
2955
- async function promptForContinueInGitHub() {
2956
- try {
2957
- const reply = await enquirer.prompt([
3170
+ },
3171
+ version: {
3172
+ currentVersionResolver: "git-tag",
3173
+ specifierSource: "conventional-commits",
3174
+ groupPreVersionCommand: "pnpm build"
3175
+ },
3176
+ releaseTag: { pattern: DEFAULT_RELEASE_TAG_PATTERN }
3177
+ };
3178
+ var DEFAULT_JS_RELEASE_GROUP_CONFIG = {
3179
+ ...DEFAULT_RELEASE_GROUP_CONFIG,
3180
+ projects: ["packages/*"],
3181
+ version: {
3182
+ ...DEFAULT_RELEASE_GROUP_CONFIG.version,
3183
+ versionActions: "@storm-software/workspace-tools/release/js-version-actions",
3184
+ versionActionsOptions: {
3185
+ currentVersionResolver: "git-tag",
3186
+ specifierSource: "conventional-commits"
3187
+ },
3188
+ manifestRootsToUpdate: [
3189
+ "{projectRoot}",
2958
3190
  {
2959
- name: "open",
2960
- message: "Do you want to finish creating the release manually in your browser?",
2961
- type: "autocomplete",
2962
- choices: [
2963
- {
2964
- name: "Yes",
2965
- hint: "It will pre-populate the form for you"
2966
- },
2967
- {
2968
- name: "No"
2969
- }
2970
- ],
2971
- initial: 0
3191
+ path: "dist/{projectRoot}",
3192
+ preserveLocalDependencyProtocols: false
2972
3193
  }
2973
- ]);
2974
- return reply.open === "Yes";
2975
- } catch {
2976
- process.stdout.write("\x1B[?25h");
2977
- process.exit(1);
3194
+ ]
2978
3195
  }
2979
- }
2980
- async function syncGithubRelease(githubRequestConfig, release, existingGithubReleaseForVersion) {
2981
- const ghRelease = {
2982
- tag_name: release.version,
2983
- name: release.version,
2984
- body: release.body,
2985
- prerelease: release.prerelease,
2986
- // legacy specifies that the latest release should be determined based on the release creation date and higher semantic version.
2987
- make_latest: "legacy"
2988
- };
2989
- try {
2990
- const newGhRelease = await (existingGithubReleaseForVersion ? updateGithubRelease(
2991
- githubRequestConfig,
2992
- existingGithubReleaseForVersion.id,
2993
- ghRelease
2994
- ) : createGithubRelease(githubRequestConfig, {
2995
- ...ghRelease,
2996
- target_commitish: release.commit
2997
- }));
2998
- return {
2999
- status: existingGithubReleaseForVersion ? "updated" : "created",
3000
- id: newGhRelease.id,
3001
- url: newGhRelease.html_url
3002
- };
3003
- } catch (error) {
3004
- if (process.env.CI) {
3005
- console.error(
3006
- `An error occurred while trying to create a release on GitHub, please report this on https://github.com/storm-software/storm-ops (NOTE: make sure to redact your GitHub token from the error message!): ${typeof error?.message === "string" ? error?.message : `
3007
-
3008
- ${error}`}`
3009
- );
3010
- throw new Error(
3011
- "`An error occurred while trying to create a release on GitHub in a CI environment",
3196
+ };
3197
+ var DEFAULT_RUST_RELEASE_GROUP_CONFIG = {
3198
+ ...DEFAULT_RELEASE_GROUP_CONFIG,
3199
+ projects: ["crates/*"],
3200
+ version: {
3201
+ ...DEFAULT_RELEASE_GROUP_CONFIG.version,
3202
+ versionActions: "@storm-software/workspace-tools/release/rust-version-actions",
3203
+ versionActionsOptions: {
3204
+ currentVersionResolver: "git-tag",
3205
+ specifierSource: "conventional-commits"
3206
+ },
3207
+ manifestRootsToUpdate: ["{projectRoot}"]
3208
+ }
3209
+ };
3210
+ var DEFAULT_RELEASE_CONFIG = {
3211
+ conventionalCommits: DEFAULT_CONVENTIONAL_COMMITS_CONFIG2,
3212
+ groups: {
3213
+ packages: DEFAULT_JS_RELEASE_GROUP_CONFIG,
3214
+ crates: DEFAULT_RUST_RELEASE_GROUP_CONFIG
3215
+ },
3216
+ changelog: {
3217
+ automaticFromRef: true,
3218
+ workspaceChangelog: false,
3219
+ projectChangelogs: true
3220
+ },
3221
+ releaseTag: { pattern: DEFAULT_RELEASE_TAG_PATTERN }
3222
+ };
3223
+ function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
3224
+ return !releaseConfig?.groups || Object.keys(releaseConfig.groups).length === 0 ? {} : Object.fromEntries(
3225
+ Object.entries(releaseConfig.groups).map(([name, group]) => {
3226
+ const config5 = chunkEHPPIARR_cjs.defu(
3227
+ {
3228
+ ...omit(DEFAULT_RELEASE_GROUP_CONFIG, ["changelog"]),
3229
+ ...group
3230
+ },
3012
3231
  {
3013
- cause: error
3232
+ changelog: {
3233
+ ...DEFAULT_RELEASE_GROUP_CONFIG.changelog,
3234
+ renderer: StormChangelogRenderer,
3235
+ renderOptions: {
3236
+ ...DEFAULT_RELEASE_GROUP_CONFIG.changelog.renderOptions,
3237
+ workspaceConfig
3238
+ }
3239
+ }
3014
3240
  }
3015
3241
  );
3016
- }
3017
- return {
3018
- status: "manual",
3019
- error,
3020
- url: githubNewReleaseURL(githubRequestConfig, release),
3021
- requestData: ghRelease
3022
- };
3023
- }
3024
- }
3025
- async function resolveTokenData(hostname) {
3026
- const tokenFromEnv = process.env.STORM_BOT_GITHUB_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
3027
- if (tokenFromEnv) {
3028
- return { token: tokenFromEnv, headerName: "Authorization" };
3029
- }
3030
- const ghCLIPath = devkit.joinPathFragments(
3031
- process.env.XDG_CONFIG_HOME || devkit.joinPathFragments(os.homedir(), ".config"),
3032
- "gh",
3033
- "hosts.yml"
3034
- );
3035
- if (fs$1.existsSync(ghCLIPath)) {
3036
- const yamlContents = await fs$1.promises.readFile(ghCLIPath, "utf8");
3037
- const ghCLIConfig = yaml.parse(yamlContents);
3038
- if (ghCLIConfig[hostname]) {
3039
- if (ghCLIConfig[hostname].oauth_token) {
3040
- return ghCLIConfig[hostname].oauth_token;
3041
- }
3042
- if (ghCLIConfig[hostname].user && ghCLIConfig[hostname].git_protocol === "ssh") {
3043
- const token = childProcess.execSync(`gh auth token`, {
3044
- encoding: "utf8",
3045
- stdio: "pipe",
3046
- windowsHide: false
3047
- }).trim();
3048
- return { token, headerName: "Authorization" };
3242
+ if (workspaceConfig?.workspaceRoot) {
3243
+ if (config5.changelog?.renderer && typeof config5.changelog?.renderer === "string" && config5.changelog?.renderer?.toString().startsWith("./")) {
3244
+ config5.changelog.renderer = chunkEHPPIARR_cjs.joinPaths(
3245
+ workspaceConfig.workspaceRoot,
3246
+ config5.changelog.renderer
3247
+ );
3248
+ }
3249
+ if (config5.version?.versionActions && config5.version.versionActions.startsWith("./")) {
3250
+ config5.version.versionActions = chunkEHPPIARR_cjs.joinPaths(
3251
+ workspaceConfig.workspaceRoot,
3252
+ config5.version?.versionActions
3253
+ );
3254
+ }
3049
3255
  }
3050
- }
3051
- }
3052
- if (hostname !== "github.com") {
3053
- console.log(
3054
- `Warning: It was not possible to automatically resolve a GitHub token from your environment for hostname ${hostname}. If you set the GITHUB_TOKEN or GH_TOKEN environment variable, that will be used for GitHub API requests.`
3055
- );
3056
- }
3057
- throw new Error(
3058
- `Unable to resolve a GitHub token for hostname ${hostname}. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
3256
+ return [name, config5];
3257
+ })
3059
3258
  );
3060
3259
  }
3061
- async function getGithubReleaseByTag(config5, tag) {
3062
- return (await makeGithubRequest(
3063
- config5,
3064
- `/repos/${config5.repo}/releases/tags/${tag}`,
3065
- {}
3066
- )).data;
3067
- }
3068
- async function makeGithubRequest(config5, url, opts = {}) {
3069
- return await axios__default.default(url, {
3070
- ...opts,
3071
- baseURL: config5.apiBaseUrl,
3072
- headers: {
3073
- ...opts.headers,
3074
- Authorization: config5.token ? `Bearer ${config5.token}` : void 0
3260
+
3261
+ // src/release/release-client.ts
3262
+ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient {
3263
+ static async create(releaseConfig = {}, ignoreNxJsonConfig = false, workspaceConfig) {
3264
+ if (!workspaceConfig) {
3265
+ workspaceConfig = await chunkEHPPIARR_cjs.getWorkspaceConfig();
3075
3266
  }
3076
- });
3077
- }
3078
- async function createGithubRelease(config5, body) {
3079
- return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases`, {
3080
- method: "POST",
3081
- data: body
3082
- })).data;
3083
- }
3084
- async function updateGithubRelease(config5, id, body) {
3085
- return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases/${id}`, {
3086
- method: "PATCH",
3087
- data: body
3088
- })).data;
3089
- }
3090
- function githubNewReleaseURL(config5, release) {
3091
- let url = `https://${config5.hostname}/${config5.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
3092
- if (release.prerelease) {
3093
- url += "&prerelease=true";
3094
- }
3095
- return url;
3096
- }
3097
- async function createGithubRemoteReleaseClient(remoteName = "origin") {
3098
- const repoData = getGitHubRepoData(remoteName, "github");
3099
- if (!repoData) {
3100
- throw new Error(
3101
- `Unable to create a remote release client because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
3102
- );
3103
- }
3104
- return new github.GithubRemoteReleaseClient(
3105
- repoData,
3106
- {
3107
- provider: "github",
3108
- hostname: repoData.hostname,
3109
- apiBaseUrl: repoData.apiBaseUrl
3110
- },
3111
- await resolveTokenData(repoData.hostname)
3112
- );
3113
- }
3114
- async function isUserAnOrganizationMember(userId, config5, remoteName = "origin") {
3115
- try {
3116
- const repoData = getGitHubRepoData(remoteName, "github");
3117
- if (!repoData) {
3118
- throw new Error(
3119
- `Unable to validate GitHub actor because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
3120
- );
3267
+ let projectGraph;
3268
+ try {
3269
+ projectGraph = devkit.readCachedProjectGraph();
3270
+ } catch {
3271
+ projectGraph = await devkit.createProjectGraphAsync({
3272
+ exitOnError: true,
3273
+ resetDaemonClient: true
3274
+ });
3121
3275
  }
3122
- const tokenData = await resolveTokenData(repoData.hostname);
3123
- if (!tokenData.token) {
3276
+ if (!projectGraph) {
3124
3277
  throw new Error(
3125
- `Unable to validate GitHub actor because no token was provided. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
3278
+ "Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
3126
3279
  );
3127
3280
  }
3128
- const result = await makeGithubRequest(
3129
- {
3130
- repo: repoData.slug,
3131
- hostname: repoData.hostname,
3132
- apiBaseUrl: repoData.apiBaseUrl,
3133
- token: tokenData?.token || null
3134
- },
3135
- `/orgs/${typeof config5.organization === "string" ? config5.organization : config5.organization?.name}/members/${userId}`,
3136
- {}
3281
+ return new _StormReleaseClient(
3282
+ projectGraph,
3283
+ releaseConfig,
3284
+ ignoreNxJsonConfig,
3285
+ workspaceConfig
3137
3286
  );
3138
- if (result.status !== 204) {
3139
- return false;
3140
- }
3141
- return true;
3142
- } catch {
3143
- return false;
3144
3287
  }
3145
- }
3146
-
3147
- // src/release/changelog.ts
3148
- function createAPI(overrideReleaseConfig) {
3149
- return async function releaseChangelog(args) {
3150
- const workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
3151
- const projectGraph$1 = await projectGraph.createProjectGraphAsync({ exitOnError: true });
3152
- const nxJson$1 = nxJson.readNxJson();
3153
- const userProvidedReleaseConfig = deepMergeJson.deepMergeJson(
3154
- nxJson$1.release ?? {},
3155
- overrideReleaseConfig ?? {}
3156
- );
3157
- const { error: configError, nxReleaseConfig } = await config$1.createNxReleaseConfig(
3158
- projectGraph$1,
3159
- await fileMapUtils.createProjectFileMapUsingProjectGraph(projectGraph$1),
3160
- userProvidedReleaseConfig
3161
- );
3162
- if (configError) {
3163
- return await config$1.handleNxReleaseConfigError(configError, false);
3164
- }
3165
- if (args.printConfig) {
3166
- return printConfig.printConfigAndExit({
3167
- userProvidedReleaseConfig,
3168
- nxReleaseConfig,
3169
- isDebug: args.printConfig === "debug"
3170
- });
3171
- }
3172
- if ((args.gitCommit === void 0 || args.gitTag === void 0 || args.stageChanges === void 0) && userProvidedReleaseConfig.git) {
3173
- const nxJsonMessage = await resolveNxJsonErrorMessage.resolveNxJsonConfigErrorMessage([
3174
- "release",
3175
- "git"
3176
- ]);
3177
- output.output.error({
3178
- title: `The "release.git" property in nx.json may not be used with the "nx release changelog" subcommand or programmatic API. Instead, configure git options for subcommands directly with "release.version.git" and "release.changelog.git".`,
3179
- bodyLines: [nxJsonMessage]
3180
- });
3181
- process.exit(1);
3182
- }
3183
- const {
3184
- error: filterError,
3185
- filterLog,
3186
- releaseGroups,
3187
- releaseGroupToFilteredProjects
3188
- } = filterReleaseGroups.filterReleaseGroups(
3189
- projectGraph$1,
3190
- nxReleaseConfig,
3191
- args.projects,
3192
- args.groups
3193
- );
3194
- if (filterError) {
3195
- output.output.error(filterError);
3196
- process.exit(1);
3197
- }
3198
- if (filterLog && process.env.NX_RELEASE_INTERNAL_SUPPRESS_FILTER_LOG !== "true") {
3199
- output.output.note(filterLog);
3200
- }
3201
- const rawVersionPlans = await versionPlans.readRawVersionPlans();
3202
- await versionPlans.setResolvedVersionPlansOnGroups(
3203
- rawVersionPlans,
3204
- releaseGroups,
3205
- Object.keys(projectGraph$1.nodes),
3206
- !!args.verbose
3207
- );
3208
- if (args.deleteVersionPlans === void 0) {
3209
- args.deleteVersionPlans = true;
3210
- }
3211
- const changelogGenerationEnabled = !!nxReleaseConfig?.changelog?.workspaceChangelog || nxReleaseConfig?.groups && Object.values(nxReleaseConfig?.groups).some((g) => g.changelog);
3212
- if (!changelogGenerationEnabled) {
3213
- output.output.warn({
3214
- title: `Changelogs are disabled. No changelog entries will be generated`,
3215
- bodyLines: [
3216
- `To explicitly enable changelog generation, configure "release.changelog.workspaceChangelog" or "release.changelog.projectChangelogs" in nx.json.`
3217
- ]
3218
- });
3219
- return {};
3220
- }
3221
- const tree$1 = new tree.FsTree(workspaceRoot.workspaceRoot, !!args.verbose);
3222
- const useAutomaticFromRef = nxReleaseConfig?.changelog?.automaticFromRef || args.firstRelease;
3223
- const { workspaceChangelogVersion, projectsVersionData } = resolveChangelogVersions(
3224
- args,
3225
- releaseGroups,
3226
- releaseGroupToFilteredProjects
3227
- );
3228
- const to = args.to || "HEAD";
3229
- const toSHA = await git.getCommitHash(to);
3230
- const headSHA = to === "HEAD" ? toSHA : await git.getCommitHash("HEAD");
3231
- const autoCommitEnabled = args.gitCommit ?? nxReleaseConfig.changelog?.git.commit;
3232
- if (autoCommitEnabled && headSHA !== toSHA) {
3233
- throw new Error(
3234
- `You are attempting to recreate the changelog for an old release (Head: "${headSHA}", To: "${toSHA}", From: "${args.from}"), but you have enabled auto-commit mode. Please disable auto-commit mode by updating your nx.json, or passing --git-commit=false`
3235
- );
3288
+ /**
3289
+ * The release configuration used by this release client.
3290
+ */
3291
+ config;
3292
+ /**
3293
+ * The workspace configuration used by this release client.
3294
+ */
3295
+ workspaceConfig;
3296
+ /**
3297
+ * The project graph of the workspace.
3298
+ */
3299
+ projectGraph;
3300
+ /**
3301
+ * The project configurations of the workspace.
3302
+ */
3303
+ projectConfigurations;
3304
+ /**
3305
+ * The file system tree used by this release client.
3306
+ */
3307
+ tree;
3308
+ /**
3309
+ * Creates an instance of {@link StormReleaseClient}.
3310
+ *
3311
+ * @param projectGraph - The project graph of the workspace.
3312
+ * @param releaseConfig - Release configuration to use for the current release client. By default, it will be combined with any configuration in `nx.json`, but you can choose to use it as the sole source of truth by setting {@link ignoreNxJsonConfig} to true.
3313
+ * @param ignoreNxJsonConfig - Whether to ignore the nx.json configuration and use only the provided {@link releaseConfig}. Default is false.
3314
+ * @param workspaceConfig - Optional Storm workspace configuration object for logging purposes.
3315
+ */
3316
+ constructor(projectGraph, releaseConfig, ignoreNxJsonConfig, workspaceConfig) {
3317
+ let nxJson$1;
3318
+ if (!ignoreNxJsonConfig && fs$1.existsSync(chunkEHPPIARR_cjs.joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
3319
+ nxJson$1 = nxJson.readNxJson();
3236
3320
  }
3237
- const commitMessage = args.gitCommitMessage || nxReleaseConfig.changelog?.git?.commitMessage;
3238
- const commitMessageValues = shared.createCommitMessageValues(
3239
- releaseGroups,
3240
- releaseGroupToFilteredProjects,
3241
- projectsVersionData,
3242
- commitMessage
3243
- );
3244
- const gitTagValues = args.gitTag ?? nxReleaseConfig.changelog?.git.tag ? createGitTagValues(
3245
- releaseGroups,
3246
- releaseGroupToFilteredProjects,
3247
- projectsVersionData
3248
- ) : [];
3249
- shared.handleDuplicateGitTags(gitTagValues);
3250
- const postGitTasks = [];
3251
- let workspaceChangelogChanges = [];
3252
- let workspaceChangelogCommits = [];
3253
- const versionPlansEnabledForWorkspaceChangelog = releaseGroups[0]?.resolvedVersionPlans;
3254
- if (versionPlansEnabledForWorkspaceChangelog) {
3255
- if (releaseGroups.length === 1) {
3256
- const releaseGroup = releaseGroups[0];
3257
- if (releaseGroup?.projectsRelationship === "fixed") {
3258
- const versionPlans = releaseGroup?.resolvedVersionPlans;
3259
- workspaceChangelogChanges = versionPlans.flatMap((vp) => {
3260
- const releaseType = versionPlanSemverReleaseTypeToChangelogType(
3261
- vp.groupVersionBump
3262
- );
3263
- let githubReferences = [];
3264
- let author = void 0;
3265
- const parsedCommit = vp.commit ? git.parseGitCommit(vp.commit, true) : null;
3266
- if (parsedCommit) {
3267
- githubReferences = parsedCommit.references;
3268
- author = parsedCommit.author;
3269
- }
3270
- if (!author) {
3271
- return [];
3272
- }
3273
- const changes = !vp.triggeredByProjects ? {
3274
- type: releaseType.type,
3275
- scope: "",
3276
- description: vp.message,
3277
- body: "",
3278
- isBreaking: releaseType.isBreaking,
3279
- githubReferences,
3280
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
3281
- authors: [author],
3282
- affectedProjects: "*"
3283
- } : vp.triggeredByProjects.map((project) => {
3284
- return {
3285
- type: releaseType.type,
3286
- scope: project,
3287
- description: vp.message,
3288
- body: "",
3289
- isBreaking: releaseType.isBreaking,
3290
- githubReferences,
3291
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
3292
- authors: [author],
3293
- affectedProjects: [project]
3294
- };
3295
- });
3296
- return changes;
3297
- }).filter(Boolean);
3298
- }
3299
- }
3300
- } else {
3301
- let workspaceChangelogFromRef = args.from || (await git.getLatestGitTagForPattern(
3302
- nxReleaseConfig.releaseTagPattern,
3303
- {},
3304
- {
3305
- checkAllBranchesWhen: nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen,
3306
- // preid:
3307
- // workspacePreid ??
3308
- // projectsPreid?.[Object.keys(projectsPreid)[0]],
3309
- releaseTagPatternRequireSemver: nxReleaseConfig.releaseTagPatternRequireSemver,
3310
- releaseTagPatternStrictPreid: nxReleaseConfig.releaseTagPatternStrictPreid
3311
- }
3312
- ))?.tag;
3313
- if (!workspaceChangelogFromRef) {
3314
- if (useAutomaticFromRef) {
3315
- workspaceChangelogFromRef = await git.getFirstGitCommit();
3316
- if (args.verbose) {
3317
- console.log(
3318
- `Determined workspace --from ref from the first commit in the workspace: ${workspaceChangelogFromRef}`
3319
- );
3321
+ const config5 = chunkEHPPIARR_cjs.defu(
3322
+ {
3323
+ changelog: {
3324
+ renderOptions: {
3325
+ workspaceConfig
3320
3326
  }
3321
- } else {
3322
- throw new Error(
3323
- `Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`
3324
- );
3325
3327
  }
3326
- }
3327
- const workspaceChangelogFromSHA = await git.getCommitHash(
3328
- workspaceChangelogFromRef
3329
- );
3330
- workspaceChangelogCommits = await getCommits(
3331
- workspaceChangelogFromSHA,
3332
- toSHA
3333
- );
3334
- workspaceChangelogChanges = filterHiddenChanges(
3335
- workspaceChangelogCommits.map((c) => {
3336
- return {
3337
- type: c.type,
3338
- scope: c.scope,
3339
- description: c.description,
3340
- body: c.body,
3341
- isBreaking: c.isBreaking,
3342
- githubReferences: c.references,
3343
- authors: [c.author],
3344
- shortHash: c.shortHash,
3345
- revertedHashes: c.revertedHashes,
3346
- affectedProjects: "*"
3347
- };
3348
- }),
3349
- nxReleaseConfig.conventionalCommits
3350
- );
3351
- }
3352
- const workspaceChangelog = await generateChangelogForWorkspace({
3353
- tree: tree$1,
3354
- args,
3355
- nxReleaseConfig,
3356
- workspaceChangelogVersion,
3357
- changes: workspaceChangelogChanges,
3358
- // TODO: remove this after the changelog renderer is refactored to remove coupling with git commits
3359
- commits: filterHiddenCommits(
3360
- workspaceChangelogCommits,
3361
- nxReleaseConfig.conventionalCommits
3362
- )
3363
- });
3364
- if (workspaceChangelog && shouldCreateGitHubRelease(
3365
- nxReleaseConfig.changelog?.workspaceChangelog,
3366
- args.createRelease
3367
- )) {
3368
- postGitTasks.push(async (latestCommit) => {
3369
- const contents = formatGithubReleaseNotes(
3370
- workspaceChangelog.releaseVersion,
3371
- workspaceChangelog.contents,
3372
- null,
3328
+ },
3329
+ {
3330
+ groups: getReleaseGroupConfig(releaseConfig, workspaceConfig)
3331
+ },
3332
+ {
3333
+ groups: getReleaseGroupConfig(
3334
+ nxJson$1.release ?? {},
3373
3335
  workspaceConfig
3374
- );
3375
- output.output.logSingleLine(`Creating GitHub Release
3376
-
3377
- ${contents}`);
3378
- await createOrUpdateGithubRelease(
3379
- nxReleaseConfig.changelog?.workspaceChangelog ? nxReleaseConfig.changelog?.workspaceChangelog.createRelease : github.defaultCreateReleaseProvider,
3380
- workspaceChangelog.releaseVersion,
3381
- contents,
3382
- latestCommit,
3383
- { dryRun: !!args.dryRun }
3384
- );
3385
- });
3386
- } else {
3387
- output.output.logSingleLine(
3388
- `Skipping GitHub Release for workspace changelog as it is disabled in the release group configuration`
3389
- );
3390
- }
3336
+ )
3337
+ },
3338
+ omit(releaseConfig, ["groups"]),
3339
+ nxJson$1.release ? omit(nxJson$1.release, ["groups"]) : {},
3340
+ omit(DEFAULT_RELEASE_CONFIG, ["groups"])
3341
+ );
3342
+ super(config5, true);
3343
+ chunkEHPPIARR_cjs.writeDebug(
3344
+ "Executing release with the following configuration",
3345
+ workspaceConfig
3346
+ );
3347
+ chunkEHPPIARR_cjs.writeDebug(config5, workspaceConfig);
3348
+ this.projectGraph = projectGraph;
3349
+ this.config = config5;
3350
+ this.workspaceConfig = workspaceConfig;
3351
+ this.tree = new tree.FsTree(workspaceConfig.workspaceRoot, false);
3352
+ this.projectConfigurations = devkit.readProjectsConfigurationFromProjectGraph(projectGraph);
3353
+ }
3354
+ releaseChangelog = async (options) => {
3355
+ const to = options.to || "HEAD";
3356
+ const toSHA = await git.getCommitHash(to);
3357
+ const postGitTasks = [];
3358
+ let projectChangelogs = {};
3359
+ const projectsPreid = Object.fromEntries(
3360
+ Object.entries(options.versionData).map(([projectName, v]) => [
3361
+ projectName,
3362
+ v.newVersion ? extractPreid(v.newVersion) : void 0
3363
+ ])
3364
+ );
3391
3365
  const projectToAdditionalDependencyBumps = /* @__PURE__ */ new Map();
3392
- for (const releaseGroup of releaseGroups) {
3366
+ for (const releaseGroup of options.releaseGraph.releaseGroups) {
3393
3367
  if (releaseGroup.projectsRelationship !== "independent") {
3394
3368
  continue;
3395
3369
  }
3396
3370
  for (const project of releaseGroup.projects) {
3397
- if (!projectsVersionData[project]?.newVersion) {
3371
+ if (!options.versionData[project] || options.versionData[project].newVersion === null) {
3398
3372
  continue;
3399
3373
  }
3400
- const dependentProjects = (projectsVersionData[project].dependentProjects || []).map((dep) => {
3374
+ const dependentProjects = (options.versionData[project].dependentProjects || []).map((dep) => {
3401
3375
  return {
3402
3376
  dependencyName: dep.source,
3403
- newVersion: projectsVersionData[dep.source]?.newVersion
3377
+ newVersion: options.versionData[dep.source]?.newVersion ?? null
3404
3378
  };
3405
3379
  }).filter((b) => b.newVersion !== null);
3406
3380
  for (const dependent of dependentProjects) {
3407
- const additionalDependencyBumpsForProject = (projectToAdditionalDependencyBumps.has(dependent.dependencyName) ? projectToAdditionalDependencyBumps.get(dependent.dependencyName) : []) ?? [];
3381
+ const additionalDependencyBumpsForProject = projectToAdditionalDependencyBumps.has(dependent.dependencyName) ? projectToAdditionalDependencyBumps.get(dependent.dependencyName) : [];
3408
3382
  additionalDependencyBumpsForProject.push({
3409
3383
  dependencyName: project,
3410
- newVersion: projectsVersionData[project].newVersion
3384
+ newVersion: options.versionData[project].newVersion
3411
3385
  });
3412
3386
  projectToAdditionalDependencyBumps.set(
3413
3387
  dependent.dependencyName,
@@ -3417,218 +3391,85 @@ ${contents}`);
3417
3391
  }
3418
3392
  }
3419
3393
  const allProjectChangelogs = {};
3420
- for (const releaseGroup of releaseGroups) {
3394
+ for (const releaseGroup of options.releaseGraph.releaseGroups) {
3421
3395
  const config5 = releaseGroup.changelog;
3422
3396
  if (config5 === false) {
3423
3397
  continue;
3424
3398
  }
3425
- const projects = args.projects?.length ? (
3399
+ if (!options.releaseGraph.releaseGroupToFilteredProjects.has(releaseGroup)) {
3400
+ throw new Error(
3401
+ `No filtered projects found for release group ${releaseGroup.name}`
3402
+ );
3403
+ }
3404
+ const projects = options.projects?.length ? (
3426
3405
  // If the user has passed a list of projects, we need to use the filtered list of projects within the release group, plus any dependents
3427
- Array.from(releaseGroupToFilteredProjects.get(releaseGroup)).flatMap(
3428
- (project) => {
3429
- return [
3430
- project,
3431
- ...projectsVersionData[project]?.dependentProjects.map(
3432
- (dep) => dep.source
3433
- ) || []
3434
- ];
3435
- }
3436
- )
3406
+ Array.from(
3407
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3408
+ options.releaseGraph.releaseGroupToFilteredProjects.get(
3409
+ releaseGroup
3410
+ )
3411
+ ).flatMap((project) => {
3412
+ return [
3413
+ project,
3414
+ ...options.versionData[project]?.dependentProjects.map(
3415
+ (dep) => dep.source
3416
+ ) || []
3417
+ ];
3418
+ })
3437
3419
  ) : (
3438
3420
  // Otherwise, we use the full list of projects within the release group
3439
3421
  releaseGroup.projects
3440
3422
  );
3441
- const projectNodes = projects.map((name) => projectGraph$1.nodes[name]);
3423
+ const projectNodes = projects.map((name) => this.projectGraph.nodes[name]);
3442
3424
  if (releaseGroup.projectsRelationship === "independent") {
3443
3425
  for (const project of projectNodes) {
3444
3426
  let changes = null;
3445
- let commits = void 0;
3446
- if (releaseGroup.resolvedVersionPlans) {
3447
- changes = releaseGroup.resolvedVersionPlans.filter((vp) => vp.projectVersionBumps[project.name]).map((vp) => {
3448
- const bumpForProject = vp.projectVersionBumps[project.name];
3449
- const releaseType = versionPlanSemverReleaseTypeToChangelogType(bumpForProject);
3450
- let githubReferences = [];
3451
- let authors = [];
3452
- const parsedCommit = vp.commit ? git.parseGitCommit(vp.commit, true) : null;
3453
- if (parsedCommit) {
3454
- githubReferences = parsedCommit.references;
3455
- authors = [parsedCommit.author];
3456
- }
3457
- return {
3458
- type: releaseType.type,
3459
- scope: project.name,
3460
- description: vp.message,
3461
- body: "",
3462
- isBreaking: releaseType.isBreaking,
3463
- affectedProjects: Object.keys(vp.projectVersionBumps),
3464
- githubReferences,
3465
- authors
3466
- };
3467
- }).filter(Boolean);
3468
- } else {
3469
- let fromRef = args.from || (await git.getLatestGitTagForPattern(
3470
- releaseGroup.releaseTagPattern,
3471
- {
3472
- projectName: project.name,
3473
- releaseGroupName: releaseGroup.name
3474
- },
3475
- releaseGroup.releaseTagPatternCheckAllBranchesWhen
3476
- ))?.tag;
3477
- if (!fromRef && useAutomaticFromRef) {
3478
- const firstCommit = await git.getFirstGitCommit();
3479
- const allCommits = await getCommits(firstCommit, toSHA);
3480
- const commitsForProject = allCommits.filter(
3481
- (c) => c.affectedFiles.find((f) => f.startsWith(project.data.root))
3482
- );
3483
- fromRef = commitsForProject[0]?.shortHash;
3484
- if (args.verbose) {
3485
- console.log(
3486
- `Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`
3487
- );
3488
- }
3489
- commits = commitsForProject;
3427
+ let fromRef = options.from || (await git.getLatestGitTagForPattern(
3428
+ releaseGroup.releaseTag.pattern,
3429
+ {
3430
+ projectName: project.name,
3431
+ releaseGroupName: releaseGroup.name
3432
+ },
3433
+ {
3434
+ checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
3435
+ preid: projectsPreid[project.name],
3436
+ requireSemver: releaseGroup.releaseTag.requireSemver,
3437
+ strictPreid: releaseGroup.releaseTag.strictPreid
3490
3438
  }
3491
- if (!fromRef && !commits) {
3492
- throw new Error(
3493
- `Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`
3439
+ ))?.tag;
3440
+ let commits = void 0;
3441
+ if (!fromRef) {
3442
+ const firstCommit = await git.getFirstGitCommit();
3443
+ commits = await filterProjectCommits({
3444
+ fromSHA: firstCommit,
3445
+ toSHA,
3446
+ projectPath: project.data.root
3447
+ });
3448
+ fromRef = commits[0]?.shortHash;
3449
+ if (options.verbose) {
3450
+ console.log(
3451
+ `Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`
3494
3452
  );
3495
3453
  }
3496
- if (!commits) {
3497
- commits = await getCommits(fromRef, toSHA);
3498
- }
3499
- const { fileMap } = await fileMapUtils.createFileMapUsingProjectGraph(projectGraph$1);
3500
- const fileToProjectMap = createFileToProjectMap(
3501
- fileMap.projectFileMap
3502
- );
3503
- changes = filterHiddenChanges(
3504
- commits.map((c) => ({
3505
- type: c.type,
3506
- scope: c.scope,
3507
- description: c.description,
3508
- body: c.body,
3509
- isBreaking: c.isBreaking,
3510
- githubReferences: c.references,
3511
- // TODO: Implement support for Co-authored-by and adding multiple authors
3512
- authors: [c.author],
3513
- shortHash: c.shortHash,
3514
- revertedHashes: c.revertedHashes,
3515
- affectedProjects: commitChangesNonProjectFiles(
3516
- c,
3517
- fileMap.nonProjectFiles
3518
- ) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
3519
- })),
3520
- nxReleaseConfig.conventionalCommits
3521
- );
3522
3454
  }
3523
- const projectChangelogs = await generateChangelogForProjects({
3524
- tree: tree$1,
3525
- args,
3526
- changes,
3527
- projectsVersionData,
3528
- releaseGroup,
3529
- projects: [project],
3530
- nxReleaseConfig,
3531
- projectToAdditionalDependencyBumps
3532
- });
3533
- for (const [projectName, projectChangelog] of Object.entries(
3534
- projectChangelogs
3535
- )) {
3536
- if (projectChangelogs && shouldCreateGitHubRelease(
3537
- releaseGroup.changelog,
3538
- args.createRelease
3539
- )) {
3540
- postGitTasks.push(async (latestCommit) => {
3541
- const contents = formatGithubReleaseNotes(
3542
- projectChangelog.releaseVersion,
3543
- projectChangelog.contents,
3544
- projectName,
3545
- workspaceConfig
3546
- );
3547
- output.output.logSingleLine(`Creating GitHub Release
3548
-
3549
- ${contents}`);
3550
- await createOrUpdateGithubRelease(
3551
- releaseGroup.changelog ? releaseGroup.changelog.createRelease : github.defaultCreateReleaseProvider,
3552
- projectChangelog.releaseVersion,
3553
- contents,
3554
- latestCommit,
3555
- { dryRun: !!args.dryRun }
3556
- );
3557
- });
3558
- } else {
3559
- output.output.logSingleLine(
3560
- `Skipping GitHub Release for ${projectName} as it is disabled in the release group configuration`
3561
- );
3562
- }
3563
- allProjectChangelogs[projectName] = projectChangelog;
3564
- }
3565
- }
3566
- } else {
3567
- let changes = [];
3568
- let commits = [];
3569
- if (releaseGroup.resolvedVersionPlans) {
3570
- changes = releaseGroup.resolvedVersionPlans.flatMap((vp) => {
3571
- const releaseType = versionPlanSemverReleaseTypeToChangelogType(
3572
- vp.groupVersionBump
3455
+ if (!fromRef && !commits) {
3456
+ throw new Error(
3457
+ `Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTag.pattern" property in nx.json to match the structure of your repository's git tags.`
3573
3458
  );
3574
- let githubReferences = [];
3575
- let author = void 0;
3576
- const parsedCommit = vp.commit ? git.parseGitCommit(vp.commit, true) : null;
3577
- if (parsedCommit) {
3578
- githubReferences = parsedCommit.references;
3579
- author = parsedCommit.author;
3580
- }
3581
- const changes2 = !vp.triggeredByProjects ? {
3582
- type: releaseType.type,
3583
- scope: "",
3584
- description: vp.message,
3585
- body: "",
3586
- isBreaking: releaseType.isBreaking,
3587
- githubReferences,
3588
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
3589
- authors: [author],
3590
- affectedProjects: "*"
3591
- } : vp.triggeredByProjects.map((project) => {
3592
- return {
3593
- type: releaseType.type,
3594
- scope: project,
3595
- description: vp.message,
3596
- body: "",
3597
- isBreaking: releaseType.isBreaking,
3598
- githubReferences,
3599
- // TODO(JamesHenry): Implement support for Co-authored-by and adding multiple authors
3600
- authors: [author],
3601
- affectedProjects: [project]
3602
- };
3459
+ }
3460
+ if (!commits) {
3461
+ commits = await filterProjectCommits({
3462
+ fromSHA: fromRef,
3463
+ toSHA,
3464
+ projectPath: project.data.root
3603
3465
  });
3604
- return changes2;
3605
- }).filter(Boolean);
3606
- } else {
3607
- let fromRef = args.from || (await git.getLatestGitTagForPattern(
3608
- releaseGroup.releaseTagPattern,
3609
- {},
3610
- releaseGroup.releaseTagPatternCheckAllBranchesWhen
3611
- ))?.tag;
3612
- if (!fromRef) {
3613
- if (useAutomaticFromRef) {
3614
- fromRef = await git.getFirstGitCommit();
3615
- if (args.verbose) {
3616
- console.log(
3617
- `Determined release group --from ref from the first commit in the workspace: ${fromRef}`
3618
- );
3619
- }
3620
- } else {
3621
- throw new Error(
3622
- `Unable to determine the previous git tag. If this is the first release of your release group, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`
3623
- );
3624
- }
3625
3466
  }
3626
- const fromSHA = await git.getCommitHash(fromRef);
3627
- const { fileMap } = await fileMapUtils.createFileMapUsingProjectGraph(projectGraph$1);
3467
+ const { fileMap } = await fileMapUtils.createFileMapUsingProjectGraph(
3468
+ this.projectGraph
3469
+ );
3628
3470
  const fileToProjectMap = createFileToProjectMap(
3629
3471
  fileMap.projectFileMap
3630
3472
  );
3631
- commits = await getCommits(fromSHA, toSHA);
3632
3473
  changes = filterHiddenChanges(
3633
3474
  commits.map((c) => ({
3634
3475
  type: c.type,
@@ -3637,8 +3478,7 @@ ${contents}`);
3637
3478
  body: c.body,
3638
3479
  isBreaking: c.isBreaking,
3639
3480
  githubReferences: c.references,
3640
- // TODO: Implement support for Co-authored-by and adding multiple authors
3641
- authors: [c.author],
3481
+ authors: c.authors,
3642
3482
  shortHash: c.shortHash,
3643
3483
  revertedHashes: c.revertedHashes,
3644
3484
  affectedProjects: commitChangesNonProjectFiles(
@@ -3646,628 +3486,249 @@ ${contents}`);
3646
3486
  fileMap.nonProjectFiles
3647
3487
  ) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
3648
3488
  })),
3649
- nxReleaseConfig.conventionalCommits
3489
+ this.config.conventionalCommits
3650
3490
  );
3491
+ projectChangelogs = await generateChangelogForProjects({
3492
+ tree: this.tree,
3493
+ args: options,
3494
+ changes,
3495
+ projectsVersionData: options.versionData,
3496
+ releaseGroup,
3497
+ projects: [project],
3498
+ releaseConfig: this.config,
3499
+ projectToAdditionalDependencyBumps,
3500
+ workspaceConfig: this.workspaceConfig,
3501
+ ChangelogRendererClass: StormChangelogRenderer
3502
+ });
3503
+ if (projectChangelogs) {
3504
+ for (const [projectName, projectChangelog] of Object.entries(
3505
+ projectChangelogs
3506
+ )) {
3507
+ if (projectChangelog.postGitTask) {
3508
+ postGitTasks.push(projectChangelog.postGitTask);
3509
+ }
3510
+ allProjectChangelogs[projectName] = projectChangelog;
3511
+ }
3512
+ }
3513
+ }
3514
+ } else {
3515
+ let changes = [];
3516
+ let fromRef = options.from || (await git.getLatestGitTagForPattern(
3517
+ releaseGroup.releaseTag.pattern,
3518
+ {},
3519
+ {
3520
+ checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
3521
+ preid: Object.keys(projectsPreid)[0] ? projectsPreid?.[Object.keys(projectsPreid)[0]] : void 0,
3522
+ requireSemver: releaseGroup.releaseTag.requireSemver,
3523
+ strictPreid: releaseGroup.releaseTag.strictPreid
3524
+ }
3525
+ ))?.tag;
3526
+ if (!fromRef) {
3527
+ fromRef = await git.getFirstGitCommit();
3528
+ if (options.verbose) {
3529
+ console.log(
3530
+ `Determined release group --from ref from the first commit in the workspace: ${fromRef}`
3531
+ );
3532
+ }
3651
3533
  }
3652
- const projectChangelogs = await generateChangelogForProjects({
3653
- tree: tree$1,
3654
- args,
3534
+ const fromSHA = await git.getCommitHash(fromRef);
3535
+ const { fileMap } = await fileMapUtils.createFileMapUsingProjectGraph(
3536
+ this.projectGraph
3537
+ );
3538
+ const fileToProjectMap = createFileToProjectMap(fileMap.projectFileMap);
3539
+ changes = filterHiddenChanges(
3540
+ (await getCommits(fromSHA, toSHA)).map((c) => ({
3541
+ type: c.type,
3542
+ scope: c.scope,
3543
+ description: c.description,
3544
+ body: c.body,
3545
+ isBreaking: c.isBreaking,
3546
+ githubReferences: c.references,
3547
+ authors: c.authors,
3548
+ shortHash: c.shortHash,
3549
+ revertedHashes: c.revertedHashes,
3550
+ affectedProjects: commitChangesNonProjectFiles(
3551
+ c,
3552
+ fileMap.nonProjectFiles
3553
+ ) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
3554
+ })),
3555
+ this.config.conventionalCommits
3556
+ );
3557
+ projectChangelogs = await generateChangelogForProjects({
3558
+ tree: this.tree,
3559
+ args: options,
3655
3560
  changes,
3656
- projectsVersionData,
3561
+ projectsVersionData: options.versionData,
3657
3562
  releaseGroup,
3658
3563
  projects: projectNodes,
3659
- nxReleaseConfig,
3660
- projectToAdditionalDependencyBumps
3564
+ releaseConfig: this.config,
3565
+ projectToAdditionalDependencyBumps,
3566
+ workspaceConfig: this.workspaceConfig,
3567
+ ChangelogRendererClass: StormChangelogRenderer
3661
3568
  });
3662
- for (const [projectName, projectChangelog] of Object.entries(
3663
- projectChangelogs
3664
- )) {
3665
- if (projectChangelogs && shouldCreateGitHubRelease(
3666
- releaseGroup.changelog,
3667
- args.createRelease
3569
+ if (projectChangelogs) {
3570
+ for (const [projectName, projectChangelog] of Object.entries(
3571
+ projectChangelogs
3668
3572
  )) {
3669
- postGitTasks.push(async (latestCommit) => {
3670
- output.output.logSingleLine(`Creating GitHub Release`);
3671
- await createOrUpdateGithubRelease(
3672
- releaseGroup.changelog ? releaseGroup.changelog.createRelease : github.defaultCreateReleaseProvider,
3673
- projectChangelog.releaseVersion,
3674
- projectChangelog.contents,
3675
- latestCommit,
3676
- { dryRun: !!args.dryRun }
3677
- );
3678
- });
3679
- } else {
3680
- output.output.logSingleLine(
3681
- `Skipping GitHub Release for ${projectName} as it is disabled in the release group configuration`
3682
- );
3573
+ if (projectChangelog.postGitTask) {
3574
+ postGitTasks.push(projectChangelog.postGitTask);
3575
+ }
3576
+ allProjectChangelogs[projectName] = projectChangelog;
3683
3577
  }
3684
- allProjectChangelogs[projectName] = projectChangelog;
3685
3578
  }
3686
3579
  }
3687
3580
  }
3688
- await applyChangesAndExit(
3689
- args,
3690
- nxReleaseConfig,
3691
- tree$1,
3692
- toSHA,
3693
- postGitTasks,
3694
- commitMessageValues,
3695
- gitTagValues,
3696
- releaseGroups
3697
- );
3581
+ if (projectChangelogs) {
3582
+ await Promise.all(
3583
+ Object.entries(projectChangelogs).map(async ([project, changelog]) => {
3584
+ if (!this.projectGraph.nodes[project]?.data.root) {
3585
+ chunkEHPPIARR_cjs.writeWarning(
3586
+ `A changelog was generated for ${project}, but it could not be found in the project graph. Skipping writing changelog file.`,
3587
+ this.workspaceConfig
3588
+ );
3589
+ } else if (changelog.contents) {
3590
+ const filePath = chunkEHPPIARR_cjs.joinPaths(
3591
+ this.projectGraph.nodes[project].data.root,
3592
+ "CHANGELOG.md"
3593
+ );
3594
+ let currentContent;
3595
+ if (fs$1.existsSync(filePath)) {
3596
+ currentContent = await fs.readFile(filePath, "utf8");
3597
+ }
3598
+ chunkEHPPIARR_cjs.writeDebug(
3599
+ `\u270D\uFE0F Writing changelog for project ${project} to ${filePath}`,
3600
+ this.workspaceConfig
3601
+ );
3602
+ const content = await generateChangelogContent(
3603
+ changelog.releaseVersion,
3604
+ filePath,
3605
+ changelog.contents,
3606
+ currentContent,
3607
+ project,
3608
+ this.workspaceConfig
3609
+ );
3610
+ this.tree.write(filePath, content);
3611
+ printChanges.printAndFlushChanges(
3612
+ this.tree,
3613
+ !!options.dryRun,
3614
+ 3,
3615
+ false,
3616
+ shared.noDiffInChangelogMessage,
3617
+ // Only print the change for the current changelog file at this point
3618
+ (f) => f.path === filePath
3619
+ );
3620
+ }
3621
+ })
3622
+ );
3623
+ this.applyChangesAndExit(options, postGitTasks);
3624
+ }
3698
3625
  return {
3699
- workspaceChangelog,
3626
+ workspaceChangelog: void 0,
3700
3627
  projectChangelogs: allProjectChangelogs
3701
3628
  };
3702
3629
  };
3703
- }
3704
- function resolveChangelogVersions(args, releaseGroups, releaseGroupToFilteredProjects) {
3705
- if (!args.version && !args.versionData) {
3706
- throw new Error(
3707
- `You must provide a version string and/or a versionData object.`
3708
- );
3709
- }
3710
- if (args.version && !semver.valid(args.version)) {
3711
- throw new Error(
3712
- `The given version "${args.version}" is not a valid semver version. Please provide your version in the format "1.0.0", "1.0.0-beta.1" etc`
3713
- );
3714
- }
3715
- const versionData = releaseGroups.reduce(
3716
- (versionData2, releaseGroup) => {
3717
- const releaseGroupProjectNames = Array.from(
3718
- releaseGroupToFilteredProjects.get(releaseGroup)
3719
- );
3720
- for (const projectName of releaseGroupProjectNames) {
3721
- if (!args.versionData) {
3722
- versionData2[projectName] = {
3723
- newVersion: args.version,
3724
- currentVersion: "",
3725
- // not relevant within changelog/commit generation
3726
- dependentProjects: []
3727
- // not relevant within changelog/commit generation
3728
- };
3729
- continue;
3730
- }
3731
- if (!args.versionData[projectName]) {
3732
- throw new Error(
3733
- `The provided versionData object does not contain a version for project "${projectName}". This suggests a filtering mismatch between the version and changelog command invocations.`
3734
- );
3735
- }
3630
+ checkChangelogFilesEnabled() {
3631
+ if (this.config.changelog?.workspaceChangelog && (this.config.changelog?.workspaceChangelog === true || this.config.changelog?.workspaceChangelog.file)) {
3632
+ return true;
3633
+ }
3634
+ for (const releaseGroup of Object.values(this.config.groups)) {
3635
+ if (releaseGroup.changelog && releaseGroup.changelog !== true && releaseGroup.changelog.file) {
3636
+ return true;
3736
3637
  }
3737
- return versionData2;
3738
- },
3739
- args.versionData || {}
3740
- );
3741
- return {
3742
- workspaceChangelogVersion: args.version,
3743
- projectsVersionData: versionData
3744
- };
3745
- }
3746
- async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTasks, commitMessageValues, gitTagValues, releaseGroups) {
3747
- let latestCommit = toSHA;
3748
- const changes = tree.listChanges();
3749
- const changelogFilesEnabled = checkChangelogFilesEnabled(nxReleaseConfig);
3750
- if (changelogFilesEnabled && !changes.length) {
3751
- output.output.warn({
3752
- title: `No changes detected for changelogs`,
3753
- bodyLines: [
3754
- `No changes were detected for any changelog files, so no changelog entries will be generated.`
3755
- ]
3756
- });
3757
- if (!postGitTasks.length) {
3758
- return;
3759
3638
  }
3760
- if (isCi.isCI()) {
3761
- output.output.warn({
3762
- title: `Skipped GitHub release creation because no changes were detected for any changelog files.`
3763
- });
3764
- return;
3639
+ return false;
3640
+ }
3641
+ isCI = () => {
3642
+ if (process.env.CI === "false") {
3643
+ return false;
3765
3644
  }
3766
- const shouldCreateGitHubReleaseAnyway = await promptForGitHubRelease();
3767
- if (!shouldCreateGitHubReleaseAnyway) {
3645
+ return process.env.CI || process.env.TF_BUILD === "true" || process.env.GITHUB_ACTIONS === "true" || process.env.BUILDKITE === "true" || process.env.CIRCLECI === "true" || process.env.CIRRUS_CI === "true" || process.env.TRAVIS === "true" || !!process.env["bamboo.buildKey"] || !!process.env["bamboo_buildKey"] || !!process.env.CODEBUILD_BUILD_ID || !!process.env.GITLAB_CI || !!process.env.HEROKU_TEST_RUN_ID || !!process.env.BUILD_ID || !!process.env.BUILD_NUMBER || !!process.env.BUILD_BUILDID || !!process.env.TEAMCITY_VERSION || !!process.env.JENKINS_URL || !!process.env.HUDSON_URL;
3646
+ };
3647
+ applyChangesAndExit = async (options, postGitTasks) => {
3648
+ const to = options.to || "HEAD";
3649
+ let latestCommit = await git.getCommitHash(to);
3650
+ const gitTagValues = options.gitTag ?? this.config.changelog?.git?.tag ? createGitTagValues(
3651
+ options.releaseGraph.releaseGroups,
3652
+ options.releaseGraph.releaseGroupToFilteredProjects,
3653
+ options.versionData
3654
+ ) : [];
3655
+ shared.handleDuplicateGitTags(gitTagValues);
3656
+ const commitMessageValues = shared.createCommitMessageValues(
3657
+ options.releaseGraph.releaseGroups,
3658
+ options.releaseGraph.releaseGroupToFilteredProjects,
3659
+ options.versionData,
3660
+ options.gitCommitMessage || this.config.changelog?.git?.commitMessage || "release(monorepo): Publish workspace release updates"
3661
+ );
3662
+ const changes = this.tree.listChanges();
3663
+ if (this.checkChangelogFilesEnabled() && !changes.length) {
3664
+ devkit.output.warn({
3665
+ title: `No changes detected for changelogs`,
3666
+ bodyLines: [
3667
+ `No changes were detected for any changelog files, so no changelog entries will be generated.`
3668
+ ]
3669
+ });
3670
+ if (!postGitTasks.length) {
3671
+ return;
3672
+ }
3673
+ for (const postGitTask of postGitTasks) {
3674
+ await postGitTask(latestCommit);
3675
+ }
3768
3676
  return;
3769
3677
  }
3770
- for (const postGitTask of postGitTasks) {
3771
- await postGitTask(latestCommit);
3772
- }
3773
- return;
3774
- }
3775
- const changedFiles = changes.map((f) => f.path);
3776
- let deletedFiles = [];
3777
- if (args.deleteVersionPlans) {
3778
- const planFiles = /* @__PURE__ */ new Set();
3779
- releaseGroups.forEach((group) => {
3780
- if (group.resolvedVersionPlans) {
3781
- group.resolvedVersionPlans.forEach((plan) => {
3782
- if (!args.dryRun) {
3783
- fs$1.rmSync(plan.absolutePath, { recursive: true, force: true });
3784
- if (args.verbose) {
3785
- console.log(`Removing ${plan.relativePath}`);
3786
- }
3787
- } else {
3788
- if (args.verbose) {
3789
- console.log(
3790
- `Would remove ${plan.relativePath}, but --dry-run was set`
3791
- );
3792
- }
3793
- }
3794
- planFiles.add(plan.relativePath);
3795
- });
3796
- }
3797
- });
3798
- deletedFiles = Array.from(planFiles);
3799
- }
3800
- if (args.gitCommit ?? nxReleaseConfig.changelog?.git.commit) {
3678
+ const changedFiles = changes.map((f) => f.path);
3801
3679
  await commitChanges({
3802
3680
  changedFiles,
3803
- deletedFiles,
3804
- isDryRun: !!args.dryRun,
3805
- isVerbose: !!args.verbose,
3681
+ deletedFiles: [],
3682
+ isDryRun: !!options.dryRun,
3683
+ isVerbose: !!options.verbose,
3806
3684
  gitCommitMessages: commitMessageValues,
3807
- gitCommitArgs: args.gitCommitArgs ?? nxReleaseConfig.changelog?.git.commitArgs
3685
+ gitCommitArgs: options.gitCommitArgs || this.config.changelog?.git?.commitArgs
3808
3686
  });
3809
3687
  latestCommit = await git.getCommitHash("HEAD");
3810
- } else if ((args.stageChanges ?? nxReleaseConfig.changelog?.git.stageChanges) && changes.length) {
3811
- chunkG3JMIIRF_cjs.writeDebug(`Staging changed files with git`);
3812
- await git.gitAdd({
3813
- changedFiles,
3814
- deletedFiles,
3815
- dryRun: args.dryRun,
3816
- verbose: args.verbose
3817
- });
3818
- }
3819
- if (args.gitTag ?? nxReleaseConfig.changelog?.git.tag) {
3820
- chunkG3JMIIRF_cjs.writeDebug(`Tagging commit with git`);
3688
+ devkit.output.logSingleLine(`Tagging commit with git`);
3821
3689
  for (const tag of gitTagValues) {
3822
3690
  await gitTag({
3823
3691
  tag,
3824
- message: args.gitTagMessage || nxReleaseConfig.changelog?.git.tagMessage,
3825
- additionalArgs: args.gitTagArgs || nxReleaseConfig.changelog?.git.tagArgs,
3826
- dryRun: args.dryRun,
3827
- verbose: args.verbose
3692
+ message: options.gitTagMessage || this.config.changelog?.git?.tagMessage,
3693
+ additionalArgs: options.gitTagArgs || this.config.changelog?.git?.tagArgs,
3694
+ dryRun: options.dryRun,
3695
+ verbose: options.verbose
3828
3696
  });
3829
3697
  }
3830
- }
3831
- if (args.gitPush ?? nxReleaseConfig.changelog?.git.push) {
3832
- chunkG3JMIIRF_cjs.writeDebug(`Pushing to git remote "${args.gitRemote}"`);
3833
- await git.gitPush({
3834
- gitRemote: args.gitRemote,
3835
- dryRun: args.dryRun,
3836
- verbose: args.verbose
3837
- });
3838
- }
3839
- for (const postGitTask of postGitTasks) {
3840
- await postGitTask(latestCommit);
3841
- }
3842
- return;
3843
- }
3844
- async function generateChangelogForWorkspace({
3845
- tree,
3846
- args,
3847
- nxReleaseConfig,
3848
- workspaceChangelogVersion,
3849
- changes
3850
- }) {
3851
- const workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
3852
- if (!workspaceConfig) {
3853
- throw new Error(
3854
- `Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
3855
- );
3856
- }
3857
- const config5 = nxReleaseConfig.changelog?.workspaceChangelog;
3858
- if (config5 === false) {
3859
- return;
3860
- }
3861
- if (workspaceChangelogVersion === null) {
3862
- return;
3863
- }
3864
- if (!config5) {
3865
- throw new Error(
3866
- `Workspace changelog is enabled but no configuration was provided. Please provide a workspaceChangelog object in your nx.json`
3867
- );
3868
- }
3869
- if (Object.entries(nxReleaseConfig.groups ?? {}).length > 1) {
3870
- output.output.warn({
3871
- title: `Workspace changelog is enabled, but you have multiple release groups configured. This is not supported, so workspace changelog will be disabled.`,
3872
- bodyLines: [
3873
- `A single workspace version cannot be determined when defining multiple release groups because versions can differ between each group.`,
3874
- `Project level changelogs can be enabled with the "release.changelog.projectChangelogs" property.`
3875
- ]
3876
- });
3877
- return;
3878
- }
3879
- if (Object.values(nxReleaseConfig.groups ?? {})[0]?.projectsRelationship === "independent") {
3880
- output.output.warn({
3881
- title: `Workspace changelog is enabled, but you have configured an independent projects relationship. This is not supported, so workspace changelog will be disabled.`,
3882
- bodyLines: [
3883
- `A single workspace version cannot be determined when using independent projects because versions can differ between each project.`,
3884
- `Project level changelogs can be enabled with the "release.changelog.projectChangelogs" property.`
3885
- ]
3886
- });
3887
- return;
3888
- }
3889
- const interactive = args.interactive === "all" || args.interactive === "workspace";
3890
- const dryRun = !!args.dryRun;
3891
- const gitRemote = args.gitRemote;
3892
- let interpolatedTreePath = config5.file || "";
3893
- if (interpolatedTreePath) {
3894
- interpolatedTreePath = utils.interpolate(interpolatedTreePath, {
3895
- projectName: "",
3896
- // n/a for the workspace changelog
3897
- projectRoot: "",
3898
- // n/a for the workspace changelog
3899
- workspaceRoot: ""
3900
- // within the tree, workspaceRoot is the root
3901
- });
3902
- }
3903
- const releaseVersion = new shared.ReleaseVersion({
3904
- version: workspaceChangelogVersion,
3905
- releaseTagPattern: nxReleaseConfig.releaseTagPattern
3906
- });
3907
- if (interpolatedTreePath) {
3908
- const prefix = dryRun ? "Previewing" : "Generating";
3909
- output.output.log({
3910
- title: `${prefix} an entry in ${interpolatedTreePath} for ${releaseVersion.gitTag}`
3911
- });
3912
- }
3913
- const remoteReleaseClient = await createGithubRemoteReleaseClient(gitRemote);
3914
- const changelogRenderer = new StormChangelogRenderer({
3915
- changes,
3916
- changelogEntryVersion: releaseVersion.rawVersion,
3917
- project: null,
3918
- isVersionPlans: false,
3919
- entryWhenNoChanges: config5.entryWhenNoChanges,
3920
- changelogRenderOptions: config5.renderOptions,
3921
- conventionalCommitsConfig: nxReleaseConfig.conventionalCommits,
3922
- remoteReleaseClient
3923
- });
3924
- let contents = await changelogRenderer.render();
3925
- if (interactive) {
3926
- const tmpDir = tmp.dirSync().name;
3927
- const changelogPath = path.joinPathFragments(
3928
- tmpDir,
3929
- // Include the tree path in the name so that it is easier to identify which changelog file is being edited
3930
- `PREVIEW__${interpolatedTreePath.replace(/\//g, "_")}`
3931
- );
3932
- fs$1.writeFileSync(changelogPath, contents);
3933
- await launchEditor.launchEditor(changelogPath);
3934
- contents = fs$1.readFileSync(changelogPath, "utf8");
3935
- }
3936
- if (interpolatedTreePath) {
3937
- tree.write(
3938
- interpolatedTreePath,
3939
- await generateChangelogContent(
3940
- releaseVersion,
3941
- interpolatedTreePath,
3942
- contents,
3943
- tree.exists(interpolatedTreePath) ? tree.read(interpolatedTreePath)?.toString() : "",
3944
- null,
3945
- workspaceConfig
3946
- )
3947
- );
3948
- printChanges.printAndFlushChanges(tree, !!dryRun, 3, false, shared.noDiffInChangelogMessage);
3949
- }
3950
- return {
3951
- releaseVersion,
3952
- contents
3953
- };
3954
- }
3955
- async function generateChangelogForProjects({
3956
- tree,
3957
- args,
3958
- changes,
3959
- projectsVersionData,
3960
- releaseGroup,
3961
- projects,
3962
- nxReleaseConfig,
3963
- projectToAdditionalDependencyBumps
3964
- }) {
3965
- const workspaceConfig = await chunkG3JMIIRF_cjs.getWorkspaceConfig();
3966
- if (!workspaceConfig) {
3967
- throw new Error(
3968
- `Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
3969
- );
3970
- }
3971
- const config5 = releaseGroup.changelog;
3972
- if (config5 === false) {
3973
- return;
3974
- }
3975
- const interactive = args.interactive === "all" || args.interactive === "projects";
3976
- const dryRun = !!args.dryRun;
3977
- const gitRemote = args.gitRemote;
3978
- const projectChangelogs = {};
3979
- for (const project of projects) {
3980
- let interpolatedTreePath = config5.file || "";
3981
- if (interpolatedTreePath) {
3982
- interpolatedTreePath = utils.interpolate(interpolatedTreePath, {
3983
- projectName: project.name,
3984
- projectRoot: project.data.root,
3985
- workspaceRoot: ""
3986
- });
3987
- }
3988
- const newVersion = projectsVersionData[project.name]?.newVersion;
3989
- if (!newVersion) {
3990
- continue;
3991
- }
3992
- const releaseVersion = new shared.ReleaseVersion({
3993
- version: newVersion,
3994
- releaseTagPattern: releaseGroup.releaseTagPattern,
3995
- projectName: project.name
3996
- });
3997
- if (interpolatedTreePath) {
3998
- const prefix = dryRun ? "Previewing" : "Generating";
3999
- output.output.log({
4000
- title: `${prefix} an entry in ${interpolatedTreePath} for ${releaseVersion.gitTag}`
4001
- });
4002
- const remoteReleaseClient = await createGithubRemoteReleaseClient(gitRemote);
4003
- const changelogRenderer = new StormChangelogRenderer({
4004
- changes,
4005
- changelogEntryVersion: releaseVersion.rawVersion,
4006
- project: project.name,
4007
- entryWhenNoChanges: typeof config5.entryWhenNoChanges === "string" ? utils.interpolate(config5.entryWhenNoChanges, {
4008
- projectName: project.name,
4009
- projectRoot: project.data.root,
4010
- workspaceRoot: ""
4011
- }) : false,
4012
- changelogRenderOptions: config5.renderOptions,
4013
- isVersionPlans: !!releaseGroup.versionPlans,
4014
- conventionalCommitsConfig: releaseGroup.versionPlans ? null : nxReleaseConfig.conventionalCommits,
4015
- dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
4016
- remoteReleaseClient
4017
- });
4018
- let contents = await changelogRenderer.render();
4019
- output.output.log({
4020
- title: `Changelog renderer for ${project.name} rendered the following content:
4021
-
4022
- ${contents}`.trim()
3698
+ if (options.gitPush ?? this.config.changelog?.git?.push) {
3699
+ devkit.output.logSingleLine(
3700
+ `Pushing to git remote "${options.gitRemote ?? "origin"}"`
3701
+ );
3702
+ await git.gitPush({
3703
+ gitRemote: options.gitRemote,
3704
+ dryRun: options.dryRun,
3705
+ verbose: options.verbose,
3706
+ additionalArgs: options.gitPushArgs || this.config.changelog?.git?.pushArgs
4023
3707
  });
4024
- if (interactive) {
4025
- const tmpDir = tmp.dirSync().name;
4026
- const changelogPath = path.joinPathFragments(
4027
- tmpDir,
4028
- // Include the tree path in the name so that it is easier to identify which changelog file is being edited
4029
- `PREVIEW__${interpolatedTreePath.replace(/\//g, "_")}`
4030
- );
4031
- fs$1.writeFileSync(changelogPath, contents);
4032
- await launchEditor.launchEditor(changelogPath);
4033
- contents = fs$1.readFileSync(changelogPath, "utf8");
4034
- }
4035
- if (interpolatedTreePath) {
4036
- tree.write(
4037
- interpolatedTreePath,
4038
- await generateChangelogContent(
4039
- releaseVersion,
4040
- interpolatedTreePath,
4041
- contents,
4042
- tree.exists(interpolatedTreePath) ? tree.read(interpolatedTreePath)?.toString() : "",
4043
- project.name,
4044
- workspaceConfig
4045
- )
4046
- );
4047
- printChanges.printAndFlushChanges(
4048
- tree,
4049
- !!dryRun,
4050
- 3,
4051
- false,
4052
- shared.noDiffInChangelogMessage,
4053
- // Only print the change for the current changelog file at this point
4054
- (f) => f.path === interpolatedTreePath
4055
- );
4056
- }
4057
- projectChangelogs[project.name] = {
4058
- releaseVersion,
4059
- contents
4060
- };
4061
- }
4062
- }
4063
- return projectChangelogs;
4064
- }
4065
- function checkChangelogFilesEnabled(nxReleaseConfig) {
4066
- if (nxReleaseConfig.changelog?.workspaceChangelog && nxReleaseConfig.changelog?.workspaceChangelog.file) {
4067
- return true;
4068
- }
4069
- return Object.values(nxReleaseConfig.groups ?? {}).some(
4070
- (releaseGroup) => typeof releaseGroup?.changelog === "boolean" && releaseGroup.changelog || releaseGroup?.changelog?.file
4071
- );
4072
- }
4073
- async function getCommits(fromSHA, toSHA) {
4074
- const rawCommits = await git.getGitDiff(fromSHA, toSHA);
4075
- return git.parseCommits(rawCommits);
4076
- }
4077
- function filterHiddenChanges(changes, conventionalCommitsConfig) {
4078
- return changes.filter((change) => {
4079
- const type = change.type;
4080
- const typeConfig = conventionalCommitsConfig.types[type];
4081
- if (!typeConfig) {
4082
- return false;
4083
3708
  }
4084
- return !typeConfig.changelog.hidden;
4085
- });
4086
- }
4087
- function filterHiddenCommits(commits, conventionalCommitsConfig) {
4088
- if (!commits) {
4089
- return [];
4090
- }
4091
- return commits.filter((commit) => {
4092
- const type = commit.type;
4093
- const typeConfig = conventionalCommitsConfig.types[type];
4094
- if (!typeConfig) {
4095
- return false;
4096
- }
4097
- return !typeConfig.changelog.hidden;
4098
- });
4099
- }
4100
- function shouldCreateGitHubRelease(changelogConfig, createReleaseArg = void 0) {
4101
- if (createReleaseArg !== void 0) {
4102
- return createReleaseArg === "github";
4103
- }
4104
- if (changelogConfig === false) {
4105
- return false;
4106
- }
4107
- return changelogConfig.createRelease !== false;
4108
- }
4109
- async function promptForGitHubRelease() {
4110
- try {
4111
- const result = await enquirer.prompt([
4112
- {
4113
- name: "confirmation",
4114
- message: "Do you want to create a GitHub release anyway?",
4115
- type: "confirm"
4116
- }
4117
- ]);
4118
- return result.confirmation;
4119
- } catch (e) {
4120
- return false;
4121
- }
4122
- }
4123
- function getProjectsAffectedByCommit(commit, fileToProjectMap) {
4124
- const affectedProjects = /* @__PURE__ */ new Set();
4125
- for (const file of commit.affectedFiles) {
4126
- affectedProjects.add(fileToProjectMap[file]);
4127
- }
4128
- return Array.from(affectedProjects);
4129
- }
4130
- function commitChangesNonProjectFiles(commit, nonProjectFiles) {
4131
- return nonProjectFiles.some(
4132
- (fileData) => commit.affectedFiles.includes(fileData.file)
4133
- );
4134
- }
4135
- function createFileToProjectMap(projectFileMap) {
4136
- const fileToProjectMap = {};
4137
- for (const [projectName, projectFiles] of Object.entries(projectFileMap)) {
4138
- for (const file of projectFiles) {
4139
- fileToProjectMap[file.file] = projectName;
4140
- }
4141
- }
4142
- return fileToProjectMap;
4143
- }
4144
- function versionPlanSemverReleaseTypeToChangelogType(bump) {
4145
- switch (bump) {
4146
- case "premajor":
4147
- case "major":
4148
- return { type: "feat", isBreaking: true };
4149
- case "preminor":
4150
- case "minor":
4151
- return { type: "feat", isBreaking: false };
4152
- case "prerelease":
4153
- case "prepatch":
4154
- case "patch":
4155
- return { type: "fix", isBreaking: false };
4156
- default:
4157
- throw new Error(`Invalid semver bump type: ${bump}`);
4158
- }
4159
- }
4160
- function formatGithubReleaseNotes(releaseVersion, content, projectName, workspaceConfig) {
4161
- if (!workspaceConfig) {
4162
- return content;
4163
- }
4164
- return `![${(typeof workspaceConfig.release.banner === "string" ? workspaceConfig.organization ? titleCase(
4165
- typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization.name
4166
- ) : void 0 : workspaceConfig.release.banner.alt) || "Release banner header"}](${typeof workspaceConfig.release.banner === "string" ? workspaceConfig.release.banner : workspaceConfig.release.banner?.url})
4167
- ${workspaceConfig.release.header || ""}
4168
-
4169
- # ${projectName ? `${titleCase(projectName)} ` : ""}v${releaseVersion.rawVersion}
4170
-
4171
- We at [${workspaceConfig.organization ? titleCase(
4172
- typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization.name
4173
- ) : ""}](${workspaceConfig.homepage}) are very excited to announce the v${releaseVersion.rawVersion} release of the ${projectName ? workspaceConfig.name ? `${titleCase(workspaceConfig.name)} - ${titleCase(projectName)}` : titleCase(projectName) : workspaceConfig.name ? titleCase(workspaceConfig.name) : "Storm Software"} project! \u{1F680}
4174
-
4175
- These changes are released under the ${workspaceConfig.license.includes("license") ? workspaceConfig.license : `${workspaceConfig.license} license`}. You can find more details on [our licensing page](${workspaceConfig.licensing}). You can find guides, API references, and other documentation around this release (and much more) on [our documentation site](${workspaceConfig.docs}).
4176
-
4177
- If you have any questions or comments, feel free to reach out to the team on [Discord](${workspaceConfig.socials.discord}) or [our contact page](${workspaceConfig.contact}). Please help us spread the word by giving [this repository](https://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}) a star \u2B50 on GitHub or [posting on X (Twitter)](https://x.com/intent/tweet?text=Check%20out%20the%20latest%20@${workspaceConfig.socials.twitter}%20release%20${projectName ? `${titleCase(projectName)?.replaceAll(" ", "%20")}%20` : ""}v${releaseVersion.rawVersion}%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}/releases/tag/${releaseVersion.gitTag}) about this release!
4178
-
4179
- ## Release Notes
4180
-
4181
- ${content.replaceAll(
4182
- `## ${generateChangelogTitle(
4183
- releaseVersion.rawVersion,
4184
- projectName,
4185
- workspaceConfig
4186
- )}`,
4187
- ""
4188
- ).replaceAll(
4189
- `# ${generateChangelogTitle(releaseVersion.rawVersion, projectName, workspaceConfig)}`,
4190
- ""
4191
- )}
4192
-
4193
- ---
4194
-
4195
- ${workspaceConfig.release.footer}
4196
- `;
4197
- }
4198
-
4199
- // src/release/config.ts
4200
- var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
4201
- questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
4202
- types: DEFAULT_COMMIT_TYPES
4203
- };
4204
- var DEFAULT_RELEASE_GROUP_CONFIG = {
4205
- projectsRelationship: "independent",
4206
- releaseTagPattern: "{projectName}@{version}",
4207
- changelog: {
4208
- git: {
4209
- tag: true
4210
- },
4211
- createRelease: "github",
4212
- entryWhenNoChanges: false,
4213
- file: "{projectRoot}/CHANGELOG.md",
4214
- renderOptions: {
4215
- authors: false,
4216
- commitReferences: true,
4217
- versionTitleDate: true
4218
- }
4219
- },
4220
- version: {
4221
- groupPreVersionCommand: "pnpm build",
4222
- useLegacyVersioning: true,
4223
- currentVersionResolver: "git-tag",
4224
- specifierSource: "conventional-commits",
4225
- generator: "@storm-software/workspace-tools:release-version",
4226
- generatorOptions: {
4227
- currentVersionResolver: "git-tag",
4228
- specifierSource: "conventional-commits"
4229
- }
4230
- }
4231
- };
4232
- var DEFAULT_RELEASE_CONFIG = {
4233
- conventionalCommits: DEFAULT_CONVENTIONAL_COMMITS_CONFIG2,
4234
- changelog: {
4235
- git: {
4236
- tag: true
4237
- },
4238
- automaticFromRef: true,
4239
- workspaceChangelog: false,
4240
- projectChangelogs: {
4241
- createRelease: "github",
4242
- entryWhenNoChanges: false,
4243
- file: "{projectRoot}/CHANGELOG.md",
4244
- renderOptions: {
4245
- authors: false,
4246
- commitReferences: true,
4247
- versionTitleDate: true
4248
- }
4249
- }
4250
- },
4251
- version: {
4252
- preVersionCommand: "pnpm build",
4253
- useLegacyVersioning: true,
4254
- currentVersionResolver: "git-tag",
4255
- specifierSource: "conventional-commits",
4256
- generator: "@storm-software/workspace-tools:release-version",
4257
- generatorOptions: {
4258
- currentVersionResolver: "git-tag",
4259
- specifierSource: "conventional-commits"
3709
+ for (const postGitTask of postGitTasks) {
3710
+ await postGitTask(latestCommit);
4260
3711
  }
4261
- }
3712
+ return;
3713
+ };
4262
3714
  };
4263
3715
 
4264
3716
  // src/release/run.ts
4265
- var runRelease = async (config5, options) => {
3717
+ var runRelease = async (config5, {
3718
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3719
+ project,
3720
+ head,
3721
+ base,
3722
+ dryRun = false,
3723
+ skipPublish = false,
3724
+ ignoreNxJsonConfig = false,
3725
+ ...releaseConfig
3726
+ }) => {
4266
3727
  if (!process.env.GITHUB_ACTOR) {
4267
3728
  throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
4268
3729
  }
4269
3730
  if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config5)) {
4270
- chunkG3JMIIRF_cjs.writeFatal(
3731
+ chunkEHPPIARR_cjs.writeFatal(
4271
3732
  "You must be a member of the Storm Software organization to run the release process.",
4272
3733
  config5
4273
3734
  );
@@ -4284,63 +3745,42 @@ var runRelease = async (config5, options) => {
4284
3745
  process.env.NODE_AUTH_TOKEN = process.env.NPM_TOKEN;
4285
3746
  process.env.NPM_AUTH_TOKEN = process.env.NPM_TOKEN;
4286
3747
  process.env.NPM_CONFIG_PROVENANCE = "true";
4287
- chunkG3JMIIRF_cjs.writeDebug("Creating workspace Project Graph data...", config5);
4288
- const nxJson = nxJson_js.readNxJson();
4289
- chunkG3JMIIRF_cjs.writeDebug("Reading in the workspaces release configuration", config5);
4290
- const to = options.head || process.env.NX_HEAD;
4291
- const from = options.base || process.env.NX_BASE;
4292
- chunkG3JMIIRF_cjs.writeDebug(
3748
+ chunkEHPPIARR_cjs.writeDebug("Creating Storm release client...", config5);
3749
+ const releaseClient = await StormReleaseClient.create(
3750
+ releaseConfig,
3751
+ ignoreNxJsonConfig,
3752
+ config5
3753
+ );
3754
+ chunkEHPPIARR_cjs.writeDebug("Reading in the workspaces release configuration", config5);
3755
+ const to = head || process.env.NX_HEAD;
3756
+ const from = base || process.env.NX_BASE;
3757
+ chunkEHPPIARR_cjs.writeDebug(
4293
3758
  `Using the following Git SHAs to determine the release content:
4294
3759
  - From: ${from}
4295
3760
  - To: ${to}
4296
3761
  `,
4297
3762
  config5
4298
3763
  );
4299
- if (nxJson.release?.groups) {
4300
- nxJson.release.groups = Object.keys(nxJson.release.groups).reduce(
4301
- (ret, groupName) => {
4302
- const groupConfig = nxJson.release?.groups?.[groupName];
4303
- ret[groupName] = chunkG3JMIIRF_cjs.defu(groupConfig, DEFAULT_RELEASE_GROUP_CONFIG);
4304
- return ret;
4305
- },
4306
- {}
4307
- );
4308
- }
4309
- const nxReleaseConfig = chunkG3JMIIRF_cjs.defu(
4310
- nxJson.release,
4311
- DEFAULT_RELEASE_CONFIG
4312
- );
4313
- chunkG3JMIIRF_cjs.writeInfo(
4314
- "Using the following `nx.json` release configuration values",
4315
- config5
4316
- );
4317
- chunkG3JMIIRF_cjs.writeInfo(nxReleaseConfig, config5);
4318
- const releaseVersion = version_js.createAPI(nxReleaseConfig);
4319
- const releaseChangelog = createAPI(nxReleaseConfig);
4320
- const releasePublish = publish_js.createAPI(nxReleaseConfig);
4321
- chunkG3JMIIRF_cjs.writeDebug("Determining the current release versions...", config5);
4322
- const { workspaceVersion, projectsVersionData } = await releaseVersion({
4323
- dryRun: false,
4324
- verbose: chunkG3JMIIRF_cjs.isVerbose(config5.logLevel),
3764
+ chunkEHPPIARR_cjs.writeDebug("Determining the current release versions...", config5);
3765
+ const { workspaceVersion, projectsVersionData, releaseGraph } = await releaseClient.releaseVersion({
3766
+ dryRun,
3767
+ verbose: chunkEHPPIARR_cjs.isVerbose(config5.logLevel),
4325
3768
  preid: config5.preid,
4326
- deleteVersionPlans: false,
4327
3769
  stageChanges: true,
4328
3770
  gitCommit: false
4329
3771
  });
4330
- await releaseChangelog({
4331
- ...options,
4332
- version: nxReleaseConfig?.projectsRelationship !== "fixed" ? void 0 : workspaceVersion,
3772
+ await releaseClient.releaseChangelog({
3773
+ version: releaseConfig?.projectsRelationship === "fixed" ? workspaceVersion : void 0,
4333
3774
  versionData: projectsVersionData,
4334
- dryRun: false,
4335
- verbose: chunkG3JMIIRF_cjs.isVerbose(config5.logLevel),
3775
+ dryRun,
3776
+ verbose: chunkEHPPIARR_cjs.isVerbose(config5.logLevel),
4336
3777
  to,
4337
3778
  from,
4338
- gitCommit: true,
4339
- gitCommitMessage: "release(monorepo): Publish workspace release updates"
3779
+ releaseGraph
4340
3780
  });
4341
- chunkG3JMIIRF_cjs.writeDebug("Tagging commit with git", config5);
4342
- if (options.skipPublish) {
4343
- chunkG3JMIIRF_cjs.writeWarning(
3781
+ chunkEHPPIARR_cjs.writeDebug("Tagging commit with git", config5);
3782
+ if (skipPublish) {
3783
+ chunkEHPPIARR_cjs.writeWarning(
4344
3784
  "Skipping publishing packages since `skipPublish` was provided as `true` in the release options.",
4345
3785
  config5
4346
3786
  );
@@ -4349,17 +3789,16 @@ var runRelease = async (config5, options) => {
4349
3789
  (key) => projectsVersionData[key]?.newVersion
4350
3790
  );
4351
3791
  if (changedProjects.length > 0) {
4352
- chunkG3JMIIRF_cjs.writeInfo(
3792
+ chunkEHPPIARR_cjs.writeInfo(
4353
3793
  `Publishing release for ${changedProjects.length} ${changedProjects.length === 1 ? "project" : "projects"}:
4354
3794
  ${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
4355
3795
  `,
4356
3796
  config5
4357
3797
  );
4358
3798
  await updatePackageManifests(projectsVersionData, config5);
4359
- const result = await releasePublish({
4360
- ...options,
4361
- dryRun: !!options.dryRun,
4362
- verbose: chunkG3JMIIRF_cjs.isVerbose(config5.logLevel)
3799
+ const result = await releaseClient.releasePublish({
3800
+ dryRun,
3801
+ verbose: chunkEHPPIARR_cjs.isVerbose(config5.logLevel)
4363
3802
  });
4364
3803
  const failedProjects = Object.keys(result).filter(
4365
3804
  (key) => result[key]?.code && result[key]?.code > 0
@@ -4374,10 +3813,10 @@ ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${res
4374
3813
  );
4375
3814
  }
4376
3815
  } else {
4377
- chunkG3JMIIRF_cjs.writeWarning("Skipped publishing packages.", config5);
3816
+ chunkEHPPIARR_cjs.writeWarning("Skipped publishing packages.", config5);
4378
3817
  }
4379
3818
  }
4380
- chunkG3JMIIRF_cjs.writeSuccess("Completed the Storm workspace release process!", config5);
3819
+ chunkEHPPIARR_cjs.writeSuccess("Completed the Storm workspace release process!", config5);
4381
3820
  };
4382
3821
  async function updatePackageManifests(projectsVersionData, config5) {
4383
3822
  let projectGraph;
@@ -4392,7 +3831,7 @@ async function updatePackageManifests(projectsVersionData, config5) {
4392
3831
  Object.keys(projectsVersionData).map(async (node) => {
4393
3832
  const projectNode = projectGraph.nodes[node];
4394
3833
  if (!projectNode?.data.root) {
4395
- chunkG3JMIIRF_cjs.writeWarning(
3834
+ chunkEHPPIARR_cjs.writeWarning(
4396
3835
  `Project node ${node} not found in the project graph. Skipping manifest update.`,
4397
3836
  config5
4398
3837
  );
@@ -4400,17 +3839,17 @@ async function updatePackageManifests(projectsVersionData, config5) {
4400
3839
  }
4401
3840
  const versionData = projectsVersionData[node];
4402
3841
  if (projectNode?.data.root && versionData && versionData.newVersion !== null) {
4403
- chunkG3JMIIRF_cjs.writeTrace(
3842
+ chunkEHPPIARR_cjs.writeTrace(
4404
3843
  `Writing version ${versionData.newVersion} update to manifest file for ${node}
4405
3844
  `,
4406
3845
  config5
4407
3846
  );
4408
- const projectRoot = chunkG3JMIIRF_cjs.joinPaths(
3847
+ const projectRoot = chunkEHPPIARR_cjs.joinPaths(
4409
3848
  config5.workspaceRoot,
4410
3849
  projectNode.data.root
4411
3850
  );
4412
- const packageJsonPath = chunkG3JMIIRF_cjs.joinPaths(projectRoot, "package.json");
4413
- const cargoTomlPath = chunkG3JMIIRF_cjs.joinPaths(projectRoot, "Cargo.toml");
3851
+ const packageJsonPath = chunkEHPPIARR_cjs.joinPaths(projectRoot, "package.json");
3852
+ const cargoTomlPath = chunkEHPPIARR_cjs.joinPaths(projectRoot, "Cargo.toml");
4414
3853
  if (fs$1.existsSync(packageJsonPath)) {
4415
3854
  const packageJsonContent = await fs.readFile(packageJsonPath, "utf8");
4416
3855
  const packageJson = JSON.parse(packageJsonContent);
@@ -4428,7 +3867,7 @@ async function updatePackageManifests(projectsVersionData, config5) {
4428
3867
  })
4429
3868
  );
4430
3869
  } else {
4431
- chunkG3JMIIRF_cjs.writeWarning("No project nodes found. Skipping manifest updates.", config5);
3870
+ chunkEHPPIARR_cjs.writeWarning("No project nodes found. Skipping manifest updates.", config5);
4432
3871
  }
4433
3872
  }
4434
3873
 
@@ -4436,8 +3875,8 @@ async function updatePackageManifests(projectsVersionData, config5) {
4436
3875
  var _config = {};
4437
3876
  function createProgram(config5) {
4438
3877
  _config = config5;
4439
- chunkG3JMIIRF_cjs.writeInfo("\u26A1 Running Storm Git Tools", config5);
4440
- const root = chunkG3JMIIRF_cjs.findWorkspaceRootSafe(process.cwd());
3878
+ chunkEHPPIARR_cjs.writeInfo("\u26A1 Running Storm Git Tools", config5);
3879
+ const root = chunkEHPPIARR_cjs.findWorkspaceRootSafe(process.cwd());
4441
3880
  process.env.STORM_WORKSPACE_ROOT ??= root;
4442
3881
  process.env.NX_WORKSPACE_ROOT_PATH ??= root;
4443
3882
  if (root) {
@@ -4477,12 +3916,12 @@ async function commitAction({
4477
3916
  dryRun = false
4478
3917
  }) {
4479
3918
  try {
4480
- chunkG3JMIIRF_cjs.writeInfo(
3919
+ chunkEHPPIARR_cjs.writeInfo(
4481
3920
  `\u26A1 Preparing to commit your changes. Please provide the requested details below...`,
4482
3921
  _config
4483
3922
  );
4484
3923
  await runCommit(config5, dryRun);
4485
- chunkG3JMIIRF_cjs.writeSuccess(
3924
+ chunkEHPPIARR_cjs.writeSuccess(
4486
3925
  `\u{1F389} Storm Commit processing completed successfully!
4487
3926
 
4488
3927
  Note: Please run "pnpm push" to upload these changes to the remote ${_config.name ? _config.name : _config.namespace ? _config.namespace : _config.organization ? _config.organization : "Storm-Software"} Git repository at ${_config.repository}
@@ -4490,7 +3929,7 @@ Note: Please run "pnpm push" to upload these changes to the remote ${_config.nam
4490
3929
  _config
4491
3930
  );
4492
3931
  } catch (error) {
4493
- chunkG3JMIIRF_cjs.writeFatal(
3932
+ chunkEHPPIARR_cjs.writeFatal(
4494
3933
  `A fatal error occurred while running commit action:
4495
3934
 
4496
3935
  ${error.message}${error.stack ? `
@@ -4505,14 +3944,14 @@ Please fix any errors and try committing again.`,
4505
3944
  }
4506
3945
  async function readmeAction(options) {
4507
3946
  try {
4508
- chunkG3JMIIRF_cjs.writeInfo("\u26A1 Formatting the workspace's README.md files", _config);
3947
+ chunkEHPPIARR_cjs.writeInfo("\u26A1 Formatting the workspace's README.md files", _config);
4509
3948
  await runReadme(options);
4510
- chunkG3JMIIRF_cjs.writeSuccess(
3949
+ chunkEHPPIARR_cjs.writeSuccess(
4511
3950
  "Formatting of the workspace's README.md files is complete\n",
4512
3951
  _config
4513
3952
  );
4514
3953
  } catch (error) {
4515
- chunkG3JMIIRF_cjs.writeFatal(
3954
+ chunkEHPPIARR_cjs.writeFatal(
4516
3955
  `A fatal error occurred while running README format action:
4517
3956
 
4518
3957
  ${error.message}`
@@ -4527,7 +3966,7 @@ async function releaseAction({
4527
3966
  dryRun
4528
3967
  }) {
4529
3968
  try {
4530
- chunkG3JMIIRF_cjs.writeInfo(
3969
+ chunkEHPPIARR_cjs.writeInfo(
4531
3970
  "\u26A1 Running the Storm Release and Publish process on the workspace",
4532
3971
  _config
4533
3972
  );
@@ -4537,9 +3976,9 @@ async function releaseAction({
4537
3976
  base,
4538
3977
  head
4539
3978
  });
4540
- chunkG3JMIIRF_cjs.writeSuccess("Release completed successfully!\n", _config);
3979
+ chunkEHPPIARR_cjs.writeSuccess("Release completed successfully!\n", _config);
4541
3980
  } catch (error) {
4542
- chunkG3JMIIRF_cjs.writeFatal(
3981
+ chunkEHPPIARR_cjs.writeFatal(
4543
3982
  `A fatal error occurred while running release action:
4544
3983
 
4545
3984
  ${error.message} ${error.stack ? `
@@ -4553,17 +3992,17 @@ Stacktrace: ${error.stack}` : ""}`,
4553
3992
  }
4554
3993
  async function commitLintAction(options) {
4555
3994
  try {
4556
- chunkG3JMIIRF_cjs.writeInfo(
3995
+ chunkEHPPIARR_cjs.writeInfo(
4557
3996
  `\u26A1 Linting the ${_config.repository ? _config.repository : _config.namespace ? _config.namespace : _config.name ? _config.name : typeof _config.organization === "string" ? _config.organization : _config.organization?.name ? _config.organization?.name : "Storm-Software"} repository's commit messages.`,
4558
3997
  _config
4559
3998
  );
4560
3999
  await runCommitLint(_config, options);
4561
- chunkG3JMIIRF_cjs.writeSuccess(
4000
+ chunkEHPPIARR_cjs.writeSuccess(
4562
4001
  "Linting the commit messages completed successfully!\n",
4563
4002
  _config
4564
4003
  );
4565
4004
  } catch (error) {
4566
- chunkG3JMIIRF_cjs.writeFatal(
4005
+ chunkEHPPIARR_cjs.writeFatal(
4567
4006
  `A fatal error occurred while linting the commit messages:
4568
4007
 
4569
4008
  ${error.message}`,
@@ -4575,18 +4014,20 @@ ${error.message}`,
4575
4014
 
4576
4015
  // bin/git.ts
4577
4016
  void (async () => {
4578
- const config5 = await chunkG3JMIIRF_cjs.getConfig();
4017
+ const config5 = await chunkEHPPIARR_cjs.getConfig();
4579
4018
  try {
4580
- chunkG3JMIIRF_cjs.handleProcess(config5);
4019
+ chunkEHPPIARR_cjs.handleProcess(config5);
4581
4020
  const program = createProgram(config5);
4582
4021
  await program.parseAsync(process.argv);
4583
- chunkG3JMIIRF_cjs.writeSuccess(
4022
+ chunkEHPPIARR_cjs.writeSuccess(
4584
4023
  `\u{1F389} Git ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
4585
4024
  config5
4586
4025
  );
4587
- chunkG3JMIIRF_cjs.exitWithSuccess(config5);
4026
+ chunkEHPPIARR_cjs.exitWithSuccess(config5);
4588
4027
  } catch (error) {
4589
- chunkG3JMIIRF_cjs.exitWithError(config5);
4028
+ chunkEHPPIARR_cjs.exitWithError(config5);
4590
4029
  process.exit(1);
4591
4030
  }
4592
4031
  })();
4032
+ //# sourceMappingURL=git.cjs.map
4033
+ //# sourceMappingURL=git.cjs.map