@storm-software/git-tools 2.115.16 → 2.116.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/bin/{chunk-XH6F7XTV.cjs → chunk-LD4V463J.cjs} +17 -0
  3. package/bin/{chunk-7TA5K5AW.js → chunk-VATYGW5F.js} +12 -0
  4. package/bin/git.cjs +402 -264
  5. package/bin/git.js +354 -217
  6. package/bin/post-checkout.cjs +9 -9
  7. package/bin/post-checkout.js +1 -1
  8. package/bin/post-commit.cjs +9 -9
  9. package/bin/post-commit.js +1 -1
  10. package/bin/post-merge.cjs +9 -9
  11. package/bin/post-merge.js +1 -1
  12. package/bin/pre-commit.cjs +9 -9
  13. package/bin/pre-commit.js +1 -1
  14. package/bin/pre-install.cjs +9 -9
  15. package/bin/pre-install.js +1 -1
  16. package/bin/pre-push.cjs +13 -13
  17. package/bin/pre-push.js +1 -1
  18. package/bin/prepare.cjs +7 -7
  19. package/bin/prepare.js +1 -1
  20. package/bin/version-warning.cjs +5 -5
  21. package/bin/version-warning.js +1 -1
  22. package/dist/{chunk-A4HFPO7F.js → chunk-5XXXTVPU.js} +87 -17
  23. package/dist/chunk-C4NLID2V.js +19 -0
  24. package/dist/chunk-KD6Y4AJS.cjs +19 -0
  25. package/dist/{chunk-R3RXM6UC.js → chunk-LSRFGWF5.js} +3 -3
  26. package/dist/{chunk-PGN2XOUF.cjs → chunk-NWZD3QTO.cjs} +3 -3
  27. package/dist/{chunk-MDOOV3KF.cjs → chunk-ZE542BCU.cjs} +84 -14
  28. package/dist/commit/minimal.cjs +18 -0
  29. package/dist/commit/minimal.d.cts +8 -0
  30. package/dist/commit/minimal.d.ts +8 -0
  31. package/dist/commit/minimal.js +18 -0
  32. package/dist/commit/monorepo.cjs +7 -0
  33. package/dist/commit/monorepo.d.cts +8 -0
  34. package/dist/commit/monorepo.d.ts +8 -0
  35. package/dist/commit/monorepo.js +7 -0
  36. package/dist/commitlint/minimal.cjs +22 -0
  37. package/dist/commitlint/{config.d.ts → minimal.d.cts} +6 -6
  38. package/dist/commitlint/{config.d.cts → minimal.d.ts} +6 -6
  39. package/dist/commitlint/minimal.js +22 -0
  40. package/dist/commitlint/monorepo.cjs +22 -0
  41. package/dist/commitlint/monorepo.d.cts +21 -0
  42. package/dist/commitlint/monorepo.d.ts +21 -0
  43. package/dist/commitlint/monorepo.js +22 -0
  44. package/dist/index.cjs +11 -4
  45. package/dist/index.d.cts +2 -2
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +19 -12
  48. package/dist/release/config.cjs +3 -3
  49. package/dist/release/config.d.cts +3 -2
  50. package/dist/release/config.d.ts +3 -2
  51. package/dist/release/config.js +2 -2
  52. package/dist/types.cjs +12 -2
  53. package/dist/types.d.cts +153 -16
  54. package/dist/types.d.ts +153 -16
  55. package/dist/types.js +17 -7
  56. package/package.json +4 -46
  57. package/dist/chunk-OZ5QCRGG.js +0 -18
  58. package/dist/chunk-SXO5R5AG.cjs +0 -18
  59. package/dist/commit/config.cjs +0 -7
  60. package/dist/commit/config.d.cts +0 -7
  61. package/dist/commit/config.d.ts +0 -7
  62. package/dist/commit/config.js +0 -7
  63. package/dist/commitlint/config.cjs +0 -46
  64. package/dist/commitlint/config.js +0 -46
package/bin/git.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { run } from './chunk-54Q5U5WW.js';
3
- import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, findWorkspaceRootSafe, writeFatal, joinPaths, writeDebug, defu, isVerbose, writeWarning, getWorkspaceConfig, writeTrace, __require, STORM_DEFAULT_RELEASE_BANNER } from './chunk-7TA5K5AW.js';
3
+ import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, findWorkspaceRootSafe, writeFatal, getWorkspaceConfig, joinPaths, writeDebug, defu, isVerbose, writeWarning, writeTrace, __require, STORM_DEFAULT_RELEASE_BANNER } from './chunk-VATYGW5F.js';
4
4
  import TOML from '@ltd/j-toml';
5
5
  import { Command, Option } from 'commander';
6
6
  import { select, confirm, input } from '@inquirer/prompts';
@@ -10,11 +10,12 @@ import fs, { readFile as readFile$1, writeFile } from 'node:fs/promises';
10
10
  import { existsSync } from 'fs';
11
11
  import { readFile } from 'fs/promises';
12
12
  import childProcess, { execSync } from 'node:child_process';
13
+ import { createJiti } from 'jiti';
14
+ import { existsSync as existsSync$1, rmSync, readdirSync, readFileSync, writeFileSync, statSync, promises } from 'node:fs';
13
15
  import defaultRules from '@commitlint/rules';
14
16
  import 'stream';
15
17
  import util from 'util';
16
18
  import { readCachedProjectGraph, createProjectGraphAsync as createProjectGraphAsync$1, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph$1 } from 'nx/src/project-graph/project-graph';
17
- import { existsSync as existsSync$1, rmSync, readdirSync, readFileSync, writeFileSync, statSync, promises } from 'node:fs';
18
19
  import wrap from 'word-wrap';
19
20
  import Path, { join as join$1, extname } from 'node:path';
20
21
  import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph.js';
@@ -204,7 +205,7 @@ var COMMIT_TYPES = {
204
205
  }
205
206
  }
206
207
  };
207
- var DEFAULT_COMMIT_QUESTIONS = {
208
+ var DEFAULT_MINIMAL_COMMIT_QUESTIONS = {
208
209
  type: {
209
210
  type: "select",
210
211
  title: "Commit Type",
@@ -219,15 +220,6 @@ var DEFAULT_COMMIT_QUESTIONS = {
219
220
  maxLength: 20,
220
221
  minLength: 3
221
222
  },
222
- scope: {
223
- type: "select",
224
- title: "Commit Scope",
225
- description: "Select the monorepo project that is primarily impacted by this change",
226
- enum: {},
227
- defaultValue: "monorepo",
228
- maxLength: 50,
229
- minLength: 1
230
- },
231
223
  subject: {
232
224
  type: "input",
233
225
  title: "Commit Subject",
@@ -270,6 +262,24 @@ var DEFAULT_COMMIT_QUESTIONS = {
270
262
  minLength: 3
271
263
  }
272
264
  };
265
+ var DEFAULT_MONOREPO_COMMIT_QUESTIONS = {
266
+ type: DEFAULT_MINIMAL_COMMIT_QUESTIONS.type,
267
+ scope: {
268
+ type: "select",
269
+ title: "Commit Scope",
270
+ description: "Select the project that's the most impacted by this change",
271
+ enum: {},
272
+ defaultValue: "monorepo",
273
+ maxLength: 50,
274
+ minLength: 1
275
+ },
276
+ subject: DEFAULT_MINIMAL_COMMIT_QUESTIONS.subject,
277
+ body: DEFAULT_MINIMAL_COMMIT_QUESTIONS.body,
278
+ isBreaking: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isBreaking,
279
+ breakingBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.breakingBody,
280
+ isIssueAffected: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isIssueAffected,
281
+ issuesBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.issuesBody
282
+ };
273
283
  var DEFAULT_COMMIT_PROMPT_MESSAGES = {
274
284
  skip: "press enter to skip",
275
285
  max: "must be %d chars at most",
@@ -279,17 +289,47 @@ var DEFAULT_COMMIT_PROMPT_MESSAGES = {
279
289
  lowerLimitWarning: "%s is %d characters less than the lower limit",
280
290
  closedIssueMessage: "Closes: "
281
291
  };
282
- var DEFAULT_COMMIT_MESSAGE_FORMAT = "{type}({scope}): {emoji}{subject}";
283
- var DEFAULT_COMMIT_SETTINGS = {
292
+ var DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT = "{type}: {emoji}{subject}";
293
+ var DEFAULT_MINIMAL_COMMIT_SETTINGS = {
284
294
  enableMultipleScopes: false,
285
295
  disableEmoji: true,
286
296
  breakingChangePrefix: "\u{1F4A3} ",
287
297
  closedIssuePrefix: "\u2705 ",
288
- format: DEFAULT_COMMIT_MESSAGE_FORMAT
298
+ format: DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT
289
299
  };
290
-
291
- // src/commitlint/config.ts
292
- var DEFAULT_COMMIT_RULES = {
300
+ var DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT = "{type}({scope}): {emoji}{subject}";
301
+ var DEFAULT_MONOREPO_COMMIT_SETTINGS = {
302
+ enableMultipleScopes: false,
303
+ disableEmoji: true,
304
+ breakingChangePrefix: "\u{1F4A3} ",
305
+ closedIssuePrefix: "\u2705 ",
306
+ format: DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT
307
+ };
308
+ var DEFAULT_MINIMAL_COMMIT_RULES = {
309
+ "body-leading-blank": [1 /* Warning */, "always"],
310
+ "body-max-length": [2 /* Error */, "always", 600],
311
+ "footer-leading-blank": [1 /* Warning */, "always"],
312
+ "footer-max-line-length": [2 /* Error */, "always", 150],
313
+ "header-max-length": [2 /* Error */, "always", 150],
314
+ "header-trim": [2 /* Error */, "always"],
315
+ "subject-case": [2 /* Error */, "always", ["sentence-case"]],
316
+ "subject-empty": [2 /* Error */, "never"],
317
+ "subject-full-stop": [2 /* Error */, "never", "."],
318
+ "subject-max-length": [2 /* Error */, "always", 150],
319
+ "subject-min-length": [2 /* Error */, "always", 3],
320
+ "type-case": [2 /* Error */, "always", "kebab-case"],
321
+ "type-empty": [2 /* Error */, "never"],
322
+ "type-enum": [
323
+ 2 /* Error */,
324
+ "always",
325
+ Object.keys(COMMIT_TYPES)
326
+ ],
327
+ "type-max-length": [2 /* Error */, "always", 20],
328
+ "type-min-length": [2 /* Error */, "always", 3],
329
+ "scope-case": 0 /* Disabled */,
330
+ "scope-empty": 0 /* Disabled */
331
+ };
332
+ var DEFAULT_MONOREPO_COMMIT_RULES = {
293
333
  "body-leading-blank": [1 /* Warning */, "always"],
294
334
  "body-max-length": [2 /* Error */, "always", 600],
295
335
  "footer-leading-blank": [1 /* Warning */, "always"],
@@ -313,12 +353,30 @@ var DEFAULT_COMMIT_RULES = {
313
353
  "scope-case": [2 /* Error */, "always", ["kebab-case"]],
314
354
  "scope-empty": [2 /* Error */, "never"]
315
355
  };
316
- var DEFAULT_COMMITLINT_CONFIG = {
317
- rules: DEFAULT_COMMIT_RULES,
318
- helpUrl: "https://developer.stormsoftware.com/commitlint",
356
+
357
+ // src/commitlint/config/minimal.ts
358
+ var config = {
359
+ rules: DEFAULT_MINIMAL_COMMIT_RULES,
360
+ helpUrl: "https://developer.stormsoftware.com/commitlint/minimal",
319
361
  parserOpts: {
320
- headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
321
- breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
362
+ headerPattern: /^(\w*): (.*)$/,
363
+ breakingHeaderPattern: /^(\w*): (.*)$/,
364
+ headerCorrespondence: ["type", "subject"],
365
+ noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
366
+ revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
367
+ revertCorrespondence: ["header", "hash"],
368
+ issuePrefixes: ["#"]
369
+ }
370
+ };
371
+ var minimal_default = config;
372
+
373
+ // src/commitlint/config/monorepo.ts
374
+ var config2 = {
375
+ rules: DEFAULT_MONOREPO_COMMIT_RULES,
376
+ helpUrl: "https://developer.stormsoftware.com/commitlint/monorepo",
377
+ parserOpts: {
378
+ headerPattern: /^(\w*)(?:\((.*)\))!?: (.*)$/,
379
+ breakingHeaderPattern: /^(\w*)(?:\((.*)\))!: (.*)$/,
322
380
  headerCorrespondence: ["type", "scope", "subject"],
323
381
  noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
324
382
  revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
@@ -326,6 +384,38 @@ var DEFAULT_COMMITLINT_CONFIG = {
326
384
  issuePrefixes: ["#"]
327
385
  }
328
386
  };
387
+ var monorepo_default = config2;
388
+
389
+ // src/commitlint/helpers.ts
390
+ var jiti = createJiti(import.meta.url, { importMeta: import.meta });
391
+ async function resolveCommitlintConfig(workspaceConfig, configPath) {
392
+ if (configPath && configPath !== "@storm-software/git-tools/commitlint/minimal" && configPath !== "@storm-software/git-tools/commitlint/monorepo") {
393
+ writeInfo(
394
+ `Using custom commitlint config file: ${configPath}`,
395
+ workspaceConfig
396
+ );
397
+ } else {
398
+ configPath = workspaceConfig?.variant === "minimal" ? "@storm-software/git-tools/commitlint/minimal" : "@storm-software/git-tools/commitlint/monorepo";
399
+ writeInfo(
400
+ `Using standard commitlint config file: ${configPath}`,
401
+ workspaceConfig
402
+ );
403
+ }
404
+ let config5 = {};
405
+ if ((configPath.endsWith(".json") || configPath.endsWith(".jsonc")) && !existsSync$1(jiti.esmResolve(configPath, workspaceConfig.workspaceRoot))) {
406
+ const configContent = await readFile$1(
407
+ jiti.esmResolve(configPath, workspaceConfig.workspaceRoot),
408
+ "utf8"
409
+ );
410
+ config5 = JSON.parse(configContent);
411
+ } else {
412
+ config5 = await jiti.import(jiti.esmResolve(configPath), { default: true });
413
+ }
414
+ return {
415
+ ...workspaceConfig.variant === "minimal" ? minimal_default : monorepo_default,
416
+ ...config5 ?? {}
417
+ };
418
+ }
329
419
 
330
420
  // ../../node_modules/.pnpm/conventional-commits-parser@6.2.0/node_modules/conventional-commits-parser/dist/regex.js
331
421
  var nomatchRegex = /(?!.*)/;
@@ -742,11 +832,8 @@ ${body}` : message;
742
832
  ${footer}` : message;
743
833
  return message || "";
744
834
  };
745
- async function lint(message, rawRulesConfig, rawOpts) {
746
- const rulesConfig = rawRulesConfig || {};
747
- const parser = new CommitParser(
748
- rawOpts?.parserOpts ?? DEFAULT_COMMITLINT_CONFIG.parserOpts
749
- );
835
+ async function lint(message, commitlintConfig) {
836
+ const parser = new CommitParser(commitlintConfig.parserOpts);
750
837
  const parsed = parser.parse(message);
751
838
  if (parsed.header === null && parsed.body === null && parsed.footer === null) {
752
839
  return {
@@ -757,7 +844,7 @@ async function lint(message, rawRulesConfig, rawOpts) {
757
844
  };
758
845
  }
759
846
  const allRules = new Map(Object.entries(defaultRules));
760
- const missing = Object.keys(rulesConfig).filter(
847
+ const missing = Object.keys(commitlintConfig.rules).filter(
761
848
  (name) => typeof allRules.get(name) !== "function"
762
849
  );
763
850
  if (missing.length > 0) {
@@ -769,19 +856,19 @@ async function lint(message, rawRulesConfig, rawOpts) {
769
856
  ].join("\n")
770
857
  );
771
858
  }
772
- const invalid = Object.entries(rulesConfig).map(([name, config]) => {
773
- if (!Array.isArray(config)) {
859
+ const invalid = Object.entries(commitlintConfig.rules).map(([name, config5]) => {
860
+ if (!Array.isArray(config5)) {
774
861
  return new Error(
775
862
  `config for rule ${name} must be array, received ${util.inspect(
776
- config
777
- )} of type ${typeof config}`
863
+ config5
864
+ )} of type ${typeof config5}`
778
865
  );
779
866
  }
780
- const [level] = config;
781
- if (level === 0 /* Disabled */ && config.length === 1) {
867
+ const [level] = config5;
868
+ if (level === 0 /* Disabled */ && config5.length === 1) {
782
869
  return null;
783
870
  }
784
- const [, when] = config;
871
+ const [, when] = config5;
785
872
  if (typeof level !== "number" || isNaN(level)) {
786
873
  return new Error(
787
874
  `level for rule ${name} must be number, received ${util.inspect(
@@ -789,11 +876,11 @@ async function lint(message, rawRulesConfig, rawOpts) {
789
876
  )} of type ${typeof level}`
790
877
  );
791
878
  }
792
- if (config.length < 2 || config.length > 3) {
879
+ if (config5.length < 2 || config5.length > 3) {
793
880
  return new Error(
794
881
  `config for rule ${name} must be 2 or 3 items long, received ${util.inspect(
795
- config
796
- )} of length ${config.length}`
882
+ config5
883
+ )} of length ${config5.length}`
797
884
  );
798
885
  }
799
886
  if (level < 0 || level > 2) {
@@ -822,9 +909,11 @@ async function lint(message, rawRulesConfig, rawOpts) {
822
909
  if (invalid.length > 0) {
823
910
  throw new Error(invalid.map((i) => i.message).join("\n"));
824
911
  }
825
- const pendingResults = Object.entries(rulesConfig).filter(([, config]) => !!config && config.length && config[0] > 0).map(async (entry) => {
826
- const [name, config] = entry;
827
- const [level, when, value] = config;
912
+ const pendingResults = Object.entries(
913
+ commitlintConfig.rules
914
+ ).filter(([, config5]) => !!config5 && config5.length && config5[0] > 0).map(async (entry) => {
915
+ const [name, config5] = entry;
916
+ const [level, when, value] = config5;
828
917
  const rule = allRules.get(name);
829
918
  if (!rule) {
830
919
  throw new Error(`Could not find rule implementation for ${name}`);
@@ -897,18 +986,18 @@ function getRuleFromScopeEnum(scopeEnum) {
897
986
 
898
987
  // src/commitlint/run.ts
899
988
  var COMMIT_EDITMSG_PATH = ".git/COMMIT_EDITMSG";
900
- var runCommitLint = async (config, params) => {
989
+ async function runCommitLint(workspaceConfig, options) {
901
990
  writeInfo(
902
991
  "\u{1F4DD} Validating git commit message aligns with the Storm Software specification",
903
- config
992
+ workspaceConfig
904
993
  );
905
994
  let commitMessage;
906
- if (params.message && params.message !== COMMIT_EDITMSG_PATH) {
907
- commitMessage = params.message;
995
+ if (options.message && options.message !== COMMIT_EDITMSG_PATH) {
996
+ commitMessage = options.message;
908
997
  } else {
909
998
  const commitFile = joinPaths(
910
- config.workspaceRoot,
911
- params.file || params.message || COMMIT_EDITMSG_PATH
999
+ workspaceConfig.workspaceRoot,
1000
+ options.file || options.message || COMMIT_EDITMSG_PATH
912
1001
  );
913
1002
  if (existsSync(commitFile)) {
914
1003
  commitMessage = (await readFile(commitFile, "utf8"))?.trim();
@@ -918,14 +1007,14 @@ var runCommitLint = async (config, params) => {
918
1007
  let gitLogCmd = "git log -1 --no-merges";
919
1008
  const gitRemotes = childProcess.execSync("git remote -v").toString().trim().split("\n");
920
1009
  const upstreamRemote = gitRemotes.find(
921
- (remote) => remote.includes(`${config.name}.git`)
1010
+ (remote) => remote.includes(`${workspaceConfig.name}.git`)
922
1011
  );
923
1012
  if (upstreamRemote) {
924
1013
  const upstreamRemoteIdentifier = upstreamRemote.split(" ")[0]?.trim();
925
1014
  if (!upstreamRemoteIdentifier) {
926
1015
  writeWarning(
927
- `No upstream remote found for ${config.name}.git. Skipping comparison.`,
928
- config
1016
+ `No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison.`,
1017
+ workspaceConfig
929
1018
  );
930
1019
  return;
931
1020
  }
@@ -934,8 +1023,8 @@ var runCommitLint = async (config, params) => {
934
1023
  gitLogCmd = gitLogCmd + ` ${currentBranch} ^${upstreamRemoteIdentifier}/main`;
935
1024
  } else {
936
1025
  writeWarning(
937
- `No upstream remote found for ${config.name}.git. Skipping comparison against upstream main.`,
938
- config
1026
+ `No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison against upstream main.`,
1027
+ workspaceConfig
939
1028
  );
940
1029
  return;
941
1030
  }
@@ -943,36 +1032,50 @@ var runCommitLint = async (config, params) => {
943
1032
  if (!commitMessage) {
944
1033
  writeWarning(
945
1034
  "No commits found. Skipping commit message validation.",
946
- config
1035
+ workspaceConfig
947
1036
  );
948
1037
  return;
949
1038
  }
950
1039
  }
951
- const allowedTypes = Object.keys(COMMIT_TYPES).join("|");
952
- const allowedScopes = await getNxScopes({
953
- config
954
- });
955
- const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:-s])+)`;
956
- const matchCommit = new RegExp(commitMsgRegex, "g").test(commitMessage);
957
- const commitlintConfig = defu(
958
- params.config ?? {},
959
- { rules: { "scope-enum": getRuleFromScopeEnum(allowedScopes) } },
960
- DEFAULT_COMMITLINT_CONFIG
1040
+ const commitlintConfig = await resolveCommitlintConfig(
1041
+ workspaceConfig,
1042
+ options.config
961
1043
  );
962
- const report = await lint(commitMessage, commitlintConfig.rules, {
963
- parserOpts: commitlintConfig.parserOpts,
964
- helpUrl: commitlintConfig.helpUrl
965
- });
966
- if (!matchCommit || report.errors.length || report.warnings.length) {
967
- writeSuccess(`Commit was processing completed successfully!`, config);
1044
+ let commitlintRegex;
1045
+ const allowedTypes = commitlintConfig.rules["type-enum"] ?? COMMIT_TYPES;
1046
+ let allowedScopes = [];
1047
+ if (commitlintConfig.rules["scope-empty"] && commitlintConfig.rules["scope-empty"][0] !== 0 /* Disabled */) {
1048
+ allowedScopes = await getNxScopes({
1049
+ config: workspaceConfig
1050
+ });
1051
+ commitlintConfig.rules["scope-enum"] = getRuleFromScopeEnum(allowedScopes);
1052
+ commitlintRegex = new RegExp(
1053
+ `(${Object.keys(allowedTypes).join("|")})\\((${allowedScopes})\\)!?:\\s([a-z0-9:\\-\\/\\s])+`
1054
+ );
1055
+ } else {
1056
+ commitlintRegex = new RegExp(
1057
+ `(${Object.keys(allowedTypes).join("|")})!?:\\s([a-z0-9:\\-\\/\\s])+`
1058
+ );
1059
+ }
1060
+ const report = await lint(commitMessage, commitlintConfig);
1061
+ if (!commitlintRegex.test(commitMessage) || report.errors.length || report.warnings.length) {
1062
+ writeSuccess(
1063
+ `Commit was processing completed successfully!`,
1064
+ workspaceConfig
1065
+ );
968
1066
  } else {
969
- let errorMessage = " Oh no! Your commit message: \n-------------------------------------------------------------------\n" + commitMessage + "\n-------------------------------------------------------------------\n\n Does not follow the commit message convention specified by Storm Software.";
970
- errorMessage += "\ntype(scope): subject \n BLANK LINE \n body";
1067
+ let errorMessage = " Oh no! Your commit message: \n-------------------------------------------------------------------\n" + commitMessage + `
1068
+ -------------------------------------------------------------------
1069
+
1070
+ Does not follow the ${workspaceConfig.variant} commit message convention specified by the ${(typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name) || "Storm Software"} team.`;
1071
+ errorMessage += allowedScopes.length ? "\ntype(scope): subject \n BLANK LINE \n body" : "\ntype: subject \n BLANK LINE \n body";
971
1072
  errorMessage += "\n";
972
1073
  errorMessage += `
973
1074
  Possible types: ${allowedTypes}`;
974
- errorMessage += `
1075
+ if (allowedScopes.length) {
1076
+ errorMessage += `
975
1077
  Possible scopes: ${allowedScopes} (if unsure use "monorepo")`;
1078
+ }
976
1079
  errorMessage += "\n\nEXAMPLE: \nfeat(my-lib): add an option to generate lazy-loadable modules\nfix(monorepo)!: breaking change should have exclamation mark\n";
977
1080
  errorMessage += `
978
1081
 
@@ -986,15 +1089,81 @@ More details about the Storm Software commit message specification can be found
986
1089
  throw new Error(errorMessage);
987
1090
  }
988
1091
  return report.input;
1092
+ }
1093
+
1094
+ // src/commit/config/minimal.ts
1095
+ var config3 = {
1096
+ settings: DEFAULT_MINIMAL_COMMIT_SETTINGS,
1097
+ messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
1098
+ questions: DEFAULT_MINIMAL_COMMIT_QUESTIONS,
1099
+ types: COMMIT_TYPES
989
1100
  };
1101
+ var minimal_default2 = config3;
990
1102
 
991
- // src/commit/config.ts
992
- var DEFAULT_COMMIT_CONFIG = {
993
- settings: DEFAULT_COMMIT_SETTINGS,
1103
+ // src/commit/config/monorepo.ts
1104
+ var config4 = {
1105
+ settings: DEFAULT_MONOREPO_COMMIT_SETTINGS,
994
1106
  messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
995
- questions: DEFAULT_COMMIT_QUESTIONS,
1107
+ questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
996
1108
  types: COMMIT_TYPES
997
1109
  };
1110
+ var monorepo_default2 = config4;
1111
+
1112
+ // src/commit/helpers.ts
1113
+ function resolveMinimalCommitOptions(config5 = minimal_default2) {
1114
+ return {
1115
+ parserPreset: "conventional-changelog-conventionalcommits",
1116
+ prompt: {
1117
+ settings: config5.settings,
1118
+ messages: config5.messages,
1119
+ questions: config5.questions
1120
+ }
1121
+ };
1122
+ }
1123
+ function resolveMonorepoCommitOptions(workspaceConfig, config5 = monorepo_default2) {
1124
+ return {
1125
+ utils: { getScopeEnum: getScopeEnumUtil({ config: workspaceConfig }) },
1126
+ parserPreset: "conventional-changelog-conventionalcommits",
1127
+ prompt: {
1128
+ settings: config5.settings,
1129
+ messages: config5.messages,
1130
+ questions: config5.questions
1131
+ }
1132
+ };
1133
+ }
1134
+ var jiti2 = createJiti(import.meta.url, { importMeta: import.meta });
1135
+ async function resolveCommitConfig(workspaceConfig, configPath) {
1136
+ if (configPath && configPath !== "@storm-software/git-tools/commit/minimal" && configPath !== "@storm-software/git-tools/commit/monorepo") {
1137
+ writeInfo(
1138
+ `Using custom commit config file: ${configPath}`,
1139
+ workspaceConfig
1140
+ );
1141
+ } else {
1142
+ configPath = workspaceConfig?.variant === "minimal" ? "@storm-software/git-tools/commit/minimal" : "@storm-software/git-tools/commit/monorepo";
1143
+ writeInfo(
1144
+ `Using standard commit config file: ${configPath}`,
1145
+ workspaceConfig
1146
+ );
1147
+ }
1148
+ let config5 = {};
1149
+ if ((configPath.endsWith(".json") || configPath.endsWith(".jsonc")) && !existsSync$1(jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot))) {
1150
+ const configContent = await readFile$1(
1151
+ jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot),
1152
+ "utf8"
1153
+ );
1154
+ config5 = JSON.parse(configContent);
1155
+ } else {
1156
+ config5 = await jiti2.import(jiti2.esmResolve(configPath), { default: true });
1157
+ }
1158
+ const mergedConfig = {
1159
+ ...config5 ?? {},
1160
+ ...workspaceConfig.variant === "minimal" ? minimal_default2 : monorepo_default2
1161
+ };
1162
+ return workspaceConfig.variant === "minimal" ? resolveMinimalCommitOptions(mergedConfig) : resolveMonorepoCommitOptions(
1163
+ workspaceConfig,
1164
+ mergedConfig
1165
+ );
1166
+ }
998
1167
 
999
1168
  // src/commit/commit-state.ts
1000
1169
  function getGitDir() {
@@ -1007,49 +1176,19 @@ function getGitRootDir() {
1007
1176
  const dir = execSync(`git rev-parse --show-toplevel 2>${devNull}`).toString().trim();
1008
1177
  return dir;
1009
1178
  }
1010
- async function resolveCommitOptions(config, workspaceConfig) {
1011
- return {
1012
- utils: { getScopeEnum: getScopeEnumUtil({ config: workspaceConfig }) },
1013
- parserPreset: "conventional-changelog-conventionalcommits",
1014
- prompt: {
1015
- settings: config.settings,
1016
- messages: config.messages,
1017
- questions: config.questions
1018
- }
1019
- };
1020
- }
1021
- async function resolveDefaultCommitOptions(config) {
1022
- return resolveCommitOptions(DEFAULT_COMMIT_CONFIG, config);
1023
- }
1024
- async function createState(config, commitizenFile = "@storm-software/git-tools/commit/config") {
1179
+ async function createState(workspaceConfig, configPath) {
1025
1180
  let root;
1026
1181
  try {
1027
1182
  root = getGitRootDir();
1028
1183
  } catch (_2) {
1029
1184
  throw new Error("Could not find Git root folder.");
1030
1185
  }
1031
- let state;
1032
- if (commitizenFile === "@storm-software/git-tools/commit/config") {
1033
- state = {
1034
- config: await resolveDefaultCommitOptions(config),
1035
- root,
1036
- answers: {}
1037
- };
1038
- } else {
1039
- writeInfo(`Using custom commit config file: ${commitizenFile}`, config);
1040
- let commitizenConfig = await import(commitizenFile);
1041
- if (commitizenConfig?.default) {
1042
- commitizenConfig = commitizenConfig?.default;
1043
- }
1044
- state = {
1045
- config: await resolveCommitOptions(
1046
- defu(commitizenConfig ?? {}, DEFAULT_COMMIT_CONFIG),
1047
- config
1048
- ),
1049
- root,
1050
- answers: {}
1051
- };
1052
- }
1186
+ const state = {
1187
+ variant: workspaceConfig.variant,
1188
+ config: await resolveCommitConfig(workspaceConfig, configPath),
1189
+ root,
1190
+ answers: {}
1191
+ };
1053
1192
  if (state.config.prompt.questions.type && state.config.prompt.questions.type.enum) {
1054
1193
  state.config.prompt.questions.type.enum = Object.keys(state.config.prompt.questions.type.enum).reduce(
1055
1194
  (ret, key) => {
@@ -1065,9 +1204,11 @@ async function createState(config, commitizenFile = "@storm-software/git-tools/c
1065
1204
  {}
1066
1205
  );
1067
1206
  }
1068
- if (!state.config.prompt.questions.scope || !state.config.prompt.questions.scope.enum || Object.keys(state.config.prompt.questions.scope.enum).length === 0) {
1207
+ if (workspaceConfig.variant === "monorepo" && (!state.config.prompt.questions?.scope || !state.config.prompt.questions?.scope.enum || Object.keys(
1208
+ state.config.prompt.questions?.scope.enum
1209
+ ).length === 0)) {
1069
1210
  const scopes = await getScopeEnum({
1070
- config
1211
+ config: workspaceConfig
1071
1212
  });
1072
1213
  for (const scope of scopes) {
1073
1214
  if (scope === "monorepo") {
@@ -1126,7 +1267,7 @@ async function createState(config, commitizenFile = "@storm-software/git-tools/c
1126
1267
  }
1127
1268
  var MAX_LINE_WIDTH = 72;
1128
1269
  var formatCommitMessage = (state) => {
1129
- const { config, answers } = state;
1270
+ const { config: config5, answers } = state;
1130
1271
  const wrapOptions = {
1131
1272
  indent: "",
1132
1273
  trim: true,
@@ -1145,13 +1286,13 @@ var formatCommitMessage = (state) => {
1145
1286
  const scope = answers.scope ? answers.scope.trim() : "";
1146
1287
  const subject = answers.subject?.trim();
1147
1288
  const type = answers.type;
1148
- const format2 = config.prompt.settings.format || "{type}({scope}): {emoji}{subject}";
1289
+ const format2 = config5.prompt.settings.format || "{type}({scope}): {emoji}{subject}";
1149
1290
  const body = answers.body && typeof answers.body === "string" ? wrap(answers.body || "", wrapOptions) : "";
1150
1291
  const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap(answers.breakingBody || "", wrapOptions) : "";
1151
1292
  const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap(answers.issuesBody || "", wrapOptions) : "";
1152
1293
  const head = format2.replace(
1153
1294
  /\{emoji\}/g,
1154
- config.prompt.settings.disableEmoji ? "" : `${emoji} `
1295
+ config5.prompt.settings.disableEmoji ? "" : `${emoji} `
1155
1296
  ).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
1156
1297
  let msg = head;
1157
1298
  if (body) {
@@ -1160,26 +1301,26 @@ var formatCommitMessage = (state) => {
1160
1301
  ${body}`;
1161
1302
  }
1162
1303
  if (breaking) {
1163
- const breakingEmoji = config.prompt.settings.disableEmoji ? "" : config.prompt.settings.breakingChangePrefix;
1304
+ const breakingEmoji = config5.prompt.settings.disableEmoji ? "" : config5.prompt.settings.breakingChangePrefix;
1164
1305
  msg += `
1165
1306
 
1166
1307
  BREAKING CHANGE: ${breakingEmoji}${breaking}`;
1167
1308
  }
1168
1309
  if (issues) {
1169
- const closedIssueEmoji = config.prompt.settings.disableEmoji ? "" : config.prompt.settings.closedIssuePrefix;
1310
+ const closedIssueEmoji = config5.prompt.settings.disableEmoji ? "" : config5.prompt.settings.closedIssuePrefix;
1170
1311
  msg += `
1171
1312
 
1172
- ${closedIssueEmoji}${config.prompt.settings.closedIssueMessage}${issues}`;
1313
+ ${closedIssueEmoji}${config5.prompt.settings.closedIssueMessage}${issues}`;
1173
1314
  }
1174
1315
  return msg;
1175
1316
  };
1176
1317
 
1177
1318
  // src/commit/run.ts
1178
- var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config", dryRun = false) => {
1179
- const config = await getConfig();
1180
- const state = await createState(config, commitizenFile);
1319
+ async function runCommit(commitizenFile, dryRun = false) {
1320
+ const workspaceConfig = await getWorkspaceConfig();
1321
+ const state = await createState(workspaceConfig, commitizenFile);
1181
1322
  if (dryRun) {
1182
- writeInfo("Running in dry mode.", config);
1323
+ writeInfo("Running in dry mode.", workspaceConfig);
1183
1324
  }
1184
1325
  console.log(chalkTemplate`
1185
1326
  {bold.#999999 ----------------------------------------}
@@ -1197,22 +1338,22 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
1197
1338
  {bold.#FFFFFF Git-Commit File} - {#DDDDDD ${commitMsgFile}}
1198
1339
 
1199
1340
  `);
1200
- await runCommitLint(config, { message });
1341
+ await runCommitLint(workspaceConfig, { message });
1201
1342
  const commandItems = ["git", "commit", "-S"];
1202
1343
  commandItems.push(...["--file", commitMsgFile]);
1203
1344
  const command = shellescape(commandItems);
1204
1345
  if (dryRun) {
1205
1346
  writeDebug(
1206
1347
  `Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
1207
- config
1348
+ workspaceConfig
1208
1349
  );
1209
- writeDebug(`Message [dry-run]: ${message}`, config);
1350
+ writeDebug(`Message [dry-run]: ${message}`, workspaceConfig);
1210
1351
  } else {
1211
1352
  await fs.writeFile(commitMsgFile, message);
1212
- run(config, command);
1353
+ run(workspaceConfig, command);
1213
1354
  }
1214
- };
1215
- var askQuestions = async (state) => {
1355
+ }
1356
+ async function askQuestions(state) {
1216
1357
  let index = 0;
1217
1358
  for (const key of Object.keys(state.config.prompt.questions)) {
1218
1359
  if (state.config.prompt.questions[key] && !state.config.prompt.questions[key].hidden && (!state.config.prompt.questions[key].when || state.config.prompt.questions[key].when(state.answers))) {
@@ -1224,8 +1365,8 @@ var askQuestions = async (state) => {
1224
1365
  }
1225
1366
  }
1226
1367
  return state.answers;
1227
- };
1228
- var askQuestion = (index, question) => {
1368
+ }
1369
+ async function askQuestion(index, question) {
1229
1370
  const message = chalkTemplate`{bold ${index + 1}. ${question.title}} - ${question.description}
1230
1371
  `;
1231
1372
  if (question.type === "select" && question.enum && Object.keys(question.enum).length > 1) {
@@ -1263,7 +1404,7 @@ var askQuestion = (index, question) => {
1263
1404
  validate
1264
1405
  });
1265
1406
  }
1266
- };
1407
+ }
1267
1408
  function findFileName(filePath) {
1268
1409
  return filePath?.split(
1269
1410
  filePath?.includes(Path.sep) ? Path.sep : filePath?.includes("/") ? "/" : "\\"
@@ -2469,11 +2610,11 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer {
2469
2610
  *
2470
2611
  * @param config - The configuration object for the ChangelogRenderer
2471
2612
  */
2472
- constructor(config) {
2473
- super(config);
2613
+ constructor(config5) {
2614
+ super(config5);
2474
2615
  this.config = {
2475
- ...config,
2476
- repoData: config.remoteReleaseClient.getRemoteRepoData()
2616
+ ...config5,
2617
+ repoData: config5.remoteReleaseClient.getRemoteRepoData()
2477
2618
  };
2478
2619
  }
2479
2620
  async render() {
@@ -2926,37 +3067,37 @@ async function resolveTokenData(hostname) {
2926
3067
  `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).`
2927
3068
  );
2928
3069
  }
2929
- async function getGithubReleaseByTag(config, tag) {
3070
+ async function getGithubReleaseByTag(config5, tag) {
2930
3071
  return (await makeGithubRequest(
2931
- config,
2932
- `/repos/${config.repo}/releases/tags/${tag}`,
3072
+ config5,
3073
+ `/repos/${config5.repo}/releases/tags/${tag}`,
2933
3074
  {}
2934
3075
  )).data;
2935
3076
  }
2936
- async function makeGithubRequest(config, url, opts = {}) {
3077
+ async function makeGithubRequest(config5, url, opts = {}) {
2937
3078
  return await axios(url, {
2938
3079
  ...opts,
2939
- baseURL: config.apiBaseUrl,
3080
+ baseURL: config5.apiBaseUrl,
2940
3081
  headers: {
2941
3082
  ...opts.headers,
2942
- Authorization: config.token ? `Bearer ${config.token}` : void 0
3083
+ Authorization: config5.token ? `Bearer ${config5.token}` : void 0
2943
3084
  }
2944
3085
  });
2945
3086
  }
2946
- async function createGithubRelease(config, body) {
2947
- return (await makeGithubRequest(config, `/repos/${config.repo}/releases`, {
3087
+ async function createGithubRelease(config5, body) {
3088
+ return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases`, {
2948
3089
  method: "POST",
2949
3090
  data: body
2950
3091
  })).data;
2951
3092
  }
2952
- async function updateGithubRelease(config, id, body) {
2953
- return (await makeGithubRequest(config, `/repos/${config.repo}/releases/${id}`, {
3093
+ async function updateGithubRelease(config5, id, body) {
3094
+ return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases/${id}`, {
2954
3095
  method: "PATCH",
2955
3096
  data: body
2956
3097
  })).data;
2957
3098
  }
2958
- function githubNewReleaseURL(config, release) {
2959
- let url = `https://${config.hostname}/${config.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
3099
+ function githubNewReleaseURL(config5, release) {
3100
+ let url = `https://${config5.hostname}/${config5.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
2960
3101
  if (release.prerelease) {
2961
3102
  url += "&prerelease=true";
2962
3103
  }
@@ -2979,7 +3120,7 @@ async function createGithubRemoteReleaseClient(remoteName = "origin") {
2979
3120
  await resolveTokenData(repoData.hostname)
2980
3121
  );
2981
3122
  }
2982
- async function isUserAnOrganizationMember(userId, config, remoteName = "origin") {
3123
+ async function isUserAnOrganizationMember(userId, config5, remoteName = "origin") {
2983
3124
  try {
2984
3125
  const repoData = getGitHubRepoData(remoteName, "github");
2985
3126
  if (!repoData) {
@@ -3000,7 +3141,7 @@ async function isUserAnOrganizationMember(userId, config, remoteName = "origin")
3000
3141
  apiBaseUrl: repoData.apiBaseUrl,
3001
3142
  token: tokenData?.token || null
3002
3143
  },
3003
- `/orgs/${typeof config.organization === "string" ? config.organization : config.organization?.name}/members/${userId}`,
3144
+ `/orgs/${typeof config5.organization === "string" ? config5.organization : config5.organization?.name}/members/${userId}`,
3004
3145
  {}
3005
3146
  );
3006
3147
  if (result.status !== 204) {
@@ -3286,8 +3427,8 @@ ${contents}`);
3286
3427
  }
3287
3428
  const allProjectChangelogs = {};
3288
3429
  for (const releaseGroup of releaseGroups) {
3289
- const config = releaseGroup.changelog;
3290
- if (config === false) {
3430
+ const config5 = releaseGroup.changelog;
3431
+ if (config5 === false) {
3291
3432
  continue;
3292
3433
  }
3293
3434
  const projects = args.projects?.length ? (
@@ -3722,14 +3863,14 @@ async function generateChangelogForWorkspace({
3722
3863
  `Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
3723
3864
  );
3724
3865
  }
3725
- const config = nxReleaseConfig.changelog?.workspaceChangelog;
3726
- if (config === false) {
3866
+ const config5 = nxReleaseConfig.changelog?.workspaceChangelog;
3867
+ if (config5 === false) {
3727
3868
  return;
3728
3869
  }
3729
3870
  if (workspaceChangelogVersion === null) {
3730
3871
  return;
3731
3872
  }
3732
- if (!config) {
3873
+ if (!config5) {
3733
3874
  throw new Error(
3734
3875
  `Workspace changelog is enabled but no configuration was provided. Please provide a workspaceChangelog object in your nx.json`
3735
3876
  );
@@ -3757,7 +3898,7 @@ async function generateChangelogForWorkspace({
3757
3898
  const interactive = args.interactive === "all" || args.interactive === "workspace";
3758
3899
  const dryRun = !!args.dryRun;
3759
3900
  const gitRemote = args.gitRemote;
3760
- let interpolatedTreePath = config.file || "";
3901
+ let interpolatedTreePath = config5.file || "";
3761
3902
  if (interpolatedTreePath) {
3762
3903
  interpolatedTreePath = interpolate(interpolatedTreePath, {
3763
3904
  projectName: "",
@@ -3784,8 +3925,8 @@ async function generateChangelogForWorkspace({
3784
3925
  changelogEntryVersion: releaseVersion.rawVersion,
3785
3926
  project: null,
3786
3927
  isVersionPlans: false,
3787
- entryWhenNoChanges: config.entryWhenNoChanges,
3788
- changelogRenderOptions: config.renderOptions,
3928
+ entryWhenNoChanges: config5.entryWhenNoChanges,
3929
+ changelogRenderOptions: config5.renderOptions,
3789
3930
  conventionalCommitsConfig: nxReleaseConfig.conventionalCommits,
3790
3931
  remoteReleaseClient
3791
3932
  });
@@ -3836,8 +3977,8 @@ async function generateChangelogForProjects({
3836
3977
  `Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
3837
3978
  );
3838
3979
  }
3839
- const config = releaseGroup.changelog;
3840
- if (config === false) {
3980
+ const config5 = releaseGroup.changelog;
3981
+ if (config5 === false) {
3841
3982
  return;
3842
3983
  }
3843
3984
  const interactive = args.interactive === "all" || args.interactive === "projects";
@@ -3845,7 +3986,7 @@ async function generateChangelogForProjects({
3845
3986
  const gitRemote = args.gitRemote;
3846
3987
  const projectChangelogs = {};
3847
3988
  for (const project of projects) {
3848
- let interpolatedTreePath = config.file || "";
3989
+ let interpolatedTreePath = config5.file || "";
3849
3990
  if (interpolatedTreePath) {
3850
3991
  interpolatedTreePath = interpolate(interpolatedTreePath, {
3851
3992
  projectName: project.name,
@@ -3872,12 +4013,12 @@ async function generateChangelogForProjects({
3872
4013
  changes,
3873
4014
  changelogEntryVersion: releaseVersion.rawVersion,
3874
4015
  project: project.name,
3875
- entryWhenNoChanges: typeof config.entryWhenNoChanges === "string" ? interpolate(config.entryWhenNoChanges, {
4016
+ entryWhenNoChanges: typeof config5.entryWhenNoChanges === "string" ? interpolate(config5.entryWhenNoChanges, {
3876
4017
  projectName: project.name,
3877
4018
  projectRoot: project.data.root,
3878
4019
  workspaceRoot: ""
3879
4020
  }) : false,
3880
- changelogRenderOptions: config.renderOptions,
4021
+ changelogRenderOptions: config5.renderOptions,
3881
4022
  isVersionPlans: !!releaseGroup.versionPlans,
3882
4023
  conventionalCommitsConfig: releaseGroup.versionPlans ? null : nxReleaseConfig.conventionalCommits,
3883
4024
  dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
@@ -4066,7 +4207,7 @@ ${workspaceConfig.release.footer}
4066
4207
 
4067
4208
  // src/release/config.ts
4068
4209
  var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
4069
- questions: DEFAULT_COMMIT_QUESTIONS,
4210
+ questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
4070
4211
  types: COMMIT_TYPES
4071
4212
  };
4072
4213
  var DEFAULT_RELEASE_GROUP_CONFIG = {
@@ -4130,21 +4271,21 @@ var DEFAULT_RELEASE_CONFIG = {
4130
4271
  };
4131
4272
 
4132
4273
  // src/release/run.ts
4133
- var runRelease = async (config, options) => {
4274
+ var runRelease = async (config5, options) => {
4134
4275
  if (!process.env.GITHUB_ACTOR) {
4135
4276
  throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
4136
4277
  }
4137
- if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config)) {
4278
+ if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config5)) {
4138
4279
  writeFatal(
4139
4280
  "You must be a member of the Storm Software organization to run the release process.",
4140
- config
4281
+ config5
4141
4282
  );
4142
4283
  throw new Error(
4143
- `The GitHub actor "${process.env.GITHUB_ACTOR}" is not a member of the organization "${typeof config.organization === "string" ? config.organization : config.organization?.name}". Only members of the organization can initiate releases.`
4284
+ `The GitHub actor "${process.env.GITHUB_ACTOR}" is not a member of the organization "${typeof config5.organization === "string" ? config5.organization : config5.organization?.name}". Only members of the organization can initiate releases.`
4144
4285
  );
4145
4286
  }
4146
- const name = config.bot.name;
4147
- const email = config.bot.email ? config.bot.email : config.bot.name ? `${config.bot.name}@users.noreply.github.com` : "bot@stormsoftware.com";
4287
+ const name = config5.bot.name;
4288
+ const email = config5.bot.email ? config5.bot.email : config5.bot.name ? `${config5.bot.name}@users.noreply.github.com` : "bot@stormsoftware.com";
4148
4289
  process.env.GIT_AUTHOR_NAME = name;
4149
4290
  process.env.GIT_AUTHOR_EMAIL = email;
4150
4291
  process.env.GIT_COMMITTER_NAME = name;
@@ -4152,9 +4293,9 @@ var runRelease = async (config, options) => {
4152
4293
  process.env.NODE_AUTH_TOKEN = process.env.NPM_TOKEN;
4153
4294
  process.env.NPM_AUTH_TOKEN = process.env.NPM_TOKEN;
4154
4295
  process.env.NPM_CONFIG_PROVENANCE = "true";
4155
- writeDebug("Creating workspace Project Graph data...", config);
4296
+ writeDebug("Creating workspace Project Graph data...", config5);
4156
4297
  const nxJson = readNxJson();
4157
- writeDebug("Reading in the workspaces release configuration", config);
4298
+ writeDebug("Reading in the workspaces release configuration", config5);
4158
4299
  const to = options.head || process.env.NX_HEAD;
4159
4300
  const from = options.base || process.env.NX_BASE;
4160
4301
  writeDebug(
@@ -4162,7 +4303,7 @@ var runRelease = async (config, options) => {
4162
4303
  - From: ${from}
4163
4304
  - To: ${to}
4164
4305
  `,
4165
- config
4306
+ config5
4166
4307
  );
4167
4308
  if (nxJson.release?.groups) {
4168
4309
  nxJson.release.groups = Object.keys(nxJson.release.groups).reduce(
@@ -4180,17 +4321,17 @@ var runRelease = async (config, options) => {
4180
4321
  );
4181
4322
  writeInfo(
4182
4323
  "Using the following `nx.json` release configuration values",
4183
- config
4324
+ config5
4184
4325
  );
4185
- writeInfo(nxReleaseConfig, config);
4326
+ writeInfo(nxReleaseConfig, config5);
4186
4327
  const releaseVersion = createAPI$1(nxReleaseConfig);
4187
4328
  const releaseChangelog = createAPI(nxReleaseConfig);
4188
4329
  const releasePublish = createAPI$2(nxReleaseConfig);
4189
- writeDebug("Determining the current release versions...", config);
4330
+ writeDebug("Determining the current release versions...", config5);
4190
4331
  const { workspaceVersion, projectsVersionData } = await releaseVersion({
4191
4332
  dryRun: false,
4192
- verbose: isVerbose(config.logLevel),
4193
- preid: config.preid,
4333
+ verbose: isVerbose(config5.logLevel),
4334
+ preid: config5.preid,
4194
4335
  deleteVersionPlans: false,
4195
4336
  stageChanges: true,
4196
4337
  gitCommit: false
@@ -4200,17 +4341,17 @@ var runRelease = async (config, options) => {
4200
4341
  version: nxReleaseConfig?.projectsRelationship !== "fixed" ? void 0 : workspaceVersion,
4201
4342
  versionData: projectsVersionData,
4202
4343
  dryRun: false,
4203
- verbose: isVerbose(config.logLevel),
4344
+ verbose: isVerbose(config5.logLevel),
4204
4345
  to,
4205
4346
  from,
4206
4347
  gitCommit: true,
4207
4348
  gitCommitMessage: "release(monorepo): Publish workspace release updates"
4208
4349
  });
4209
- writeDebug("Tagging commit with git", config);
4350
+ writeDebug("Tagging commit with git", config5);
4210
4351
  if (options.skipPublish) {
4211
4352
  writeWarning(
4212
4353
  "Skipping publishing packages since `skipPublish` was provided as `true` in the release options.",
4213
- config
4354
+ config5
4214
4355
  );
4215
4356
  } else {
4216
4357
  const changedProjects = Object.keys(projectsVersionData).filter(
@@ -4221,13 +4362,13 @@ var runRelease = async (config, options) => {
4221
4362
  `Publishing release for ${changedProjects.length} ${changedProjects.length === 1 ? "project" : "projects"}:
4222
4363
  ${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
4223
4364
  `,
4224
- config
4365
+ config5
4225
4366
  );
4226
- await updatePackageManifests(projectsVersionData, config);
4367
+ await updatePackageManifests(projectsVersionData, config5);
4227
4368
  const result = await releasePublish({
4228
4369
  ...options,
4229
4370
  dryRun: !!options.dryRun,
4230
- verbose: isVerbose(config.logLevel)
4371
+ verbose: isVerbose(config5.logLevel)
4231
4372
  });
4232
4373
  const failedProjects = Object.keys(result).filter(
4233
4374
  (key) => result[key]?.code && result[key]?.code > 0
@@ -4242,12 +4383,12 @@ ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${res
4242
4383
  );
4243
4384
  }
4244
4385
  } else {
4245
- writeWarning("Skipped publishing packages.", config);
4386
+ writeWarning("Skipped publishing packages.", config5);
4246
4387
  }
4247
4388
  }
4248
- writeSuccess("Completed the Storm workspace release process!", config);
4389
+ writeSuccess("Completed the Storm workspace release process!", config5);
4249
4390
  };
4250
- async function updatePackageManifests(projectsVersionData, config) {
4391
+ async function updatePackageManifests(projectsVersionData, config5) {
4251
4392
  let projectGraph;
4252
4393
  try {
4253
4394
  projectGraph = readCachedProjectGraph$1();
@@ -4262,7 +4403,7 @@ async function updatePackageManifests(projectsVersionData, config) {
4262
4403
  if (!projectNode?.data.root) {
4263
4404
  writeWarning(
4264
4405
  `Project node ${node} not found in the project graph. Skipping manifest update.`,
4265
- config
4406
+ config5
4266
4407
  );
4267
4408
  return;
4268
4409
  }
@@ -4271,10 +4412,10 @@ async function updatePackageManifests(projectsVersionData, config) {
4271
4412
  writeTrace(
4272
4413
  `Writing version ${versionData.newVersion} update to manifest file for ${node}
4273
4414
  `,
4274
- config
4415
+ config5
4275
4416
  );
4276
4417
  const projectRoot = joinPaths(
4277
- config.workspaceRoot,
4418
+ config5.workspaceRoot,
4278
4419
  projectNode.data.root
4279
4420
  );
4280
4421
  const packageJsonPath = joinPaths(projectRoot, "package.json");
@@ -4296,15 +4437,15 @@ async function updatePackageManifests(projectsVersionData, config) {
4296
4437
  })
4297
4438
  );
4298
4439
  } else {
4299
- writeWarning("No project nodes found. Skipping manifest updates.", config);
4440
+ writeWarning("No project nodes found. Skipping manifest updates.", config5);
4300
4441
  }
4301
4442
  }
4302
4443
 
4303
4444
  // src/cli/index.ts
4304
4445
  var _config = {};
4305
- function createProgram(config) {
4306
- _config = config;
4307
- writeInfo("\u26A1 Running Storm Git Tools", config);
4446
+ function createProgram(config5) {
4447
+ _config = config5;
4448
+ writeInfo("\u26A1 Running Storm Git Tools", config5);
4308
4449
  const root = findWorkspaceRootSafe(process.cwd());
4309
4450
  process.env.STORM_WORKSPACE_ROOT ??= root;
4310
4451
  process.env.NX_WORKSPACE_ROOT_PATH ??= root;
@@ -4316,7 +4457,7 @@ function createProgram(config) {
4316
4457
  const commitConfig = new Option(
4317
4458
  "--config <file>",
4318
4459
  "The Commitizen config file path"
4319
- ).default("@storm-software/git-tools/commit/config");
4460
+ ).makeOptionMandatory(false);
4320
4461
  const commitDryRun = new Option(
4321
4462
  "--dry-run",
4322
4463
  "Should the commit be run in dry-run mode (no updates are made)"
@@ -4362,11 +4503,15 @@ function createProgram(config) {
4362
4503
  "--file <commit-file>",
4363
4504
  "The commit message to lint"
4364
4505
  ).makeOptionMandatory(false);
4365
- program.command("commitlint").description("Run commitlint for the workspace's commit message.").addOption(commitConfig).addOption(commitMessage).addOption(commitFile).action(commitLintAction);
4506
+ const commitlintConfig = new Option(
4507
+ "--config <file>",
4508
+ "The CommitLint config file path"
4509
+ ).makeOptionMandatory(false);
4510
+ program.command("commitlint").description("Run commitlint for the workspace's commit message.").addOption(commitlintConfig).addOption(commitMessage).addOption(commitFile).action(commitLintAction);
4366
4511
  return program;
4367
4512
  }
4368
4513
  async function commitAction({
4369
- config = "@storm-software/git-tools/commit/config.js",
4514
+ config: config5,
4370
4515
  dryRun = false
4371
4516
  }) {
4372
4517
  try {
@@ -4374,7 +4519,7 @@ async function commitAction({
4374
4519
  `\u26A1 Preparing to commit your changes. Please provide the requested details below...`,
4375
4520
  _config
4376
4521
  );
4377
- await runCommit(config, dryRun);
4522
+ await runCommit(config5, dryRun);
4378
4523
  writeSuccess(
4379
4524
  `\u{1F389} Storm Commit processing completed successfully!
4380
4525
 
@@ -4440,21 +4585,13 @@ Stacktrace: ${error.stack}` : ""}`,
4440
4585
  throw new Error(error.message, { cause: error });
4441
4586
  }
4442
4587
  }
4443
- async function commitLintAction({
4444
- config,
4445
- message,
4446
- file
4447
- }) {
4588
+ async function commitLintAction(options) {
4448
4589
  try {
4449
4590
  writeInfo(
4450
4591
  `\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.`,
4451
4592
  _config
4452
4593
  );
4453
- await runCommitLint(_config, {
4454
- config,
4455
- message,
4456
- file
4457
- });
4594
+ await runCommitLint(_config, options);
4458
4595
  writeSuccess(
4459
4596
  "Linting the commit messages completed successfully!\n",
4460
4597
  _config
@@ -4472,18 +4609,18 @@ ${error.message}`,
4472
4609
 
4473
4610
  // bin/git.ts
4474
4611
  void (async () => {
4475
- const config = await getConfig();
4612
+ const config5 = await getConfig();
4476
4613
  try {
4477
- handleProcess(config);
4478
- const program = createProgram(config);
4614
+ handleProcess(config5);
4615
+ const program = createProgram(config5);
4479
4616
  await program.parseAsync(process.argv);
4480
4617
  writeSuccess(
4481
4618
  `\u{1F389} Git ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
4482
- config
4619
+ config5
4483
4620
  );
4484
- exitWithSuccess(config);
4621
+ exitWithSuccess(config5);
4485
4622
  } catch (error) {
4486
- exitWithError(config);
4623
+ exitWithError(config5);
4487
4624
  process.exit(1);
4488
4625
  }
4489
4626
  })();