@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.
- package/README.md +1 -1
- package/bin/{chunk-XH6F7XTV.cjs → chunk-LD4V463J.cjs} +17 -0
- package/bin/{chunk-7TA5K5AW.js → chunk-VATYGW5F.js} +12 -0
- package/bin/git.cjs +402 -264
- package/bin/git.js +354 -217
- package/bin/post-checkout.cjs +9 -9
- package/bin/post-checkout.js +1 -1
- package/bin/post-commit.cjs +9 -9
- package/bin/post-commit.js +1 -1
- package/bin/post-merge.cjs +9 -9
- package/bin/post-merge.js +1 -1
- package/bin/pre-commit.cjs +9 -9
- package/bin/pre-commit.js +1 -1
- package/bin/pre-install.cjs +9 -9
- package/bin/pre-install.js +1 -1
- package/bin/pre-push.cjs +13 -13
- package/bin/pre-push.js +1 -1
- package/bin/prepare.cjs +7 -7
- package/bin/prepare.js +1 -1
- package/bin/version-warning.cjs +5 -5
- package/bin/version-warning.js +1 -1
- package/dist/{chunk-A4HFPO7F.js → chunk-5XXXTVPU.js} +87 -17
- package/dist/chunk-C4NLID2V.js +19 -0
- package/dist/chunk-KD6Y4AJS.cjs +19 -0
- package/dist/{chunk-R3RXM6UC.js → chunk-LSRFGWF5.js} +3 -3
- package/dist/{chunk-PGN2XOUF.cjs → chunk-NWZD3QTO.cjs} +3 -3
- package/dist/{chunk-MDOOV3KF.cjs → chunk-ZE542BCU.cjs} +84 -14
- package/dist/commit/minimal.cjs +18 -0
- package/dist/commit/minimal.d.cts +8 -0
- package/dist/commit/minimal.d.ts +8 -0
- package/dist/commit/minimal.js +18 -0
- package/dist/commit/monorepo.cjs +7 -0
- package/dist/commit/monorepo.d.cts +8 -0
- package/dist/commit/monorepo.d.ts +8 -0
- package/dist/commit/monorepo.js +7 -0
- package/dist/commitlint/minimal.cjs +22 -0
- package/dist/commitlint/{config.d.ts → minimal.d.cts} +6 -6
- package/dist/commitlint/{config.d.cts → minimal.d.ts} +6 -6
- package/dist/commitlint/minimal.js +22 -0
- package/dist/commitlint/monorepo.cjs +22 -0
- package/dist/commitlint/monorepo.d.cts +21 -0
- package/dist/commitlint/monorepo.d.ts +21 -0
- package/dist/commitlint/monorepo.js +22 -0
- package/dist/index.cjs +11 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -12
- package/dist/release/config.cjs +3 -3
- package/dist/release/config.d.cts +3 -2
- package/dist/release/config.d.ts +3 -2
- package/dist/release/config.js +2 -2
- package/dist/types.cjs +12 -2
- package/dist/types.d.cts +153 -16
- package/dist/types.d.ts +153 -16
- package/dist/types.js +17 -7
- package/package.json +4 -46
- package/dist/chunk-OZ5QCRGG.js +0 -18
- package/dist/chunk-SXO5R5AG.cjs +0 -18
- package/dist/commit/config.cjs +0 -7
- package/dist/commit/config.d.cts +0 -7
- package/dist/commit/config.d.ts +0 -7
- package/dist/commit/config.js +0 -7
- package/dist/commitlint/config.cjs +0 -46
- package/dist/commitlint/config.js +0 -46
package/bin/git.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkCIJVSMK2_cjs = require('./chunk-CIJVSMK2.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkLD4V463J_cjs = require('./chunk-LD4V463J.cjs');
|
|
6
6
|
var TOML = require('@ltd/j-toml');
|
|
7
7
|
var commander = require('commander');
|
|
8
8
|
var prompts = require('@inquirer/prompts');
|
|
@@ -11,6 +11,7 @@ var chalkTemplate = require('chalk-template');
|
|
|
11
11
|
var fs = require('fs/promises');
|
|
12
12
|
var fs$1 = require('fs');
|
|
13
13
|
var childProcess = require('child_process');
|
|
14
|
+
var jiti$1 = require('jiti');
|
|
14
15
|
var defaultRules = require('@commitlint/rules');
|
|
15
16
|
require('stream');
|
|
16
17
|
var util = require('util');
|
|
@@ -28,7 +29,7 @@ var publish_js = require('nx/src/command-line/release/publish.js');
|
|
|
28
29
|
var version_js = require('nx/src/command-line/release/version.js');
|
|
29
30
|
var nxJson_js = require('nx/src/config/nx-json.js');
|
|
30
31
|
var enquirer = require('enquirer');
|
|
31
|
-
var config = require('nx/src/command-line/release/config/config');
|
|
32
|
+
var config$1 = require('nx/src/command-line/release/config/config');
|
|
32
33
|
var deepMergeJson = require('nx/src/command-line/release/config/deep-merge-json');
|
|
33
34
|
var filterReleaseGroups = require('nx/src/command-line/release/config/filter-release-groups');
|
|
34
35
|
var versionPlans = require('nx/src/command-line/release/config/version-plans');
|
|
@@ -56,6 +57,7 @@ var DefaultChangelogRenderer = require('nx/release/changelog-renderer');
|
|
|
56
57
|
var conventionalCommits = require('nx/src/command-line/release/config/conventional-commits');
|
|
57
58
|
var os = require('os');
|
|
58
59
|
|
|
60
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
59
61
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
60
62
|
|
|
61
63
|
var TOML__default = /*#__PURE__*/_interopDefault(TOML);
|
|
@@ -221,7 +223,7 @@ var COMMIT_TYPES = {
|
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
};
|
|
224
|
-
var
|
|
226
|
+
var DEFAULT_MINIMAL_COMMIT_QUESTIONS = {
|
|
225
227
|
type: {
|
|
226
228
|
type: "select",
|
|
227
229
|
title: "Commit Type",
|
|
@@ -236,15 +238,6 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
236
238
|
maxLength: 20,
|
|
237
239
|
minLength: 3
|
|
238
240
|
},
|
|
239
|
-
scope: {
|
|
240
|
-
type: "select",
|
|
241
|
-
title: "Commit Scope",
|
|
242
|
-
description: "Select the monorepo project that is primarily impacted by this change",
|
|
243
|
-
enum: {},
|
|
244
|
-
defaultValue: "monorepo",
|
|
245
|
-
maxLength: 50,
|
|
246
|
-
minLength: 1
|
|
247
|
-
},
|
|
248
241
|
subject: {
|
|
249
242
|
type: "input",
|
|
250
243
|
title: "Commit Subject",
|
|
@@ -287,6 +280,24 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
287
280
|
minLength: 3
|
|
288
281
|
}
|
|
289
282
|
};
|
|
283
|
+
var DEFAULT_MONOREPO_COMMIT_QUESTIONS = {
|
|
284
|
+
type: DEFAULT_MINIMAL_COMMIT_QUESTIONS.type,
|
|
285
|
+
scope: {
|
|
286
|
+
type: "select",
|
|
287
|
+
title: "Commit Scope",
|
|
288
|
+
description: "Select the project that's the most impacted by this change",
|
|
289
|
+
enum: {},
|
|
290
|
+
defaultValue: "monorepo",
|
|
291
|
+
maxLength: 50,
|
|
292
|
+
minLength: 1
|
|
293
|
+
},
|
|
294
|
+
subject: DEFAULT_MINIMAL_COMMIT_QUESTIONS.subject,
|
|
295
|
+
body: DEFAULT_MINIMAL_COMMIT_QUESTIONS.body,
|
|
296
|
+
isBreaking: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isBreaking,
|
|
297
|
+
breakingBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.breakingBody,
|
|
298
|
+
isIssueAffected: DEFAULT_MINIMAL_COMMIT_QUESTIONS.isIssueAffected,
|
|
299
|
+
issuesBody: DEFAULT_MINIMAL_COMMIT_QUESTIONS.issuesBody
|
|
300
|
+
};
|
|
290
301
|
var DEFAULT_COMMIT_PROMPT_MESSAGES = {
|
|
291
302
|
skip: "press enter to skip",
|
|
292
303
|
max: "must be %d chars at most",
|
|
@@ -296,17 +307,47 @@ var DEFAULT_COMMIT_PROMPT_MESSAGES = {
|
|
|
296
307
|
lowerLimitWarning: "%s is %d characters less than the lower limit",
|
|
297
308
|
closedIssueMessage: "Closes: "
|
|
298
309
|
};
|
|
299
|
-
var
|
|
300
|
-
var
|
|
310
|
+
var DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT = "{type}: {emoji}{subject}";
|
|
311
|
+
var DEFAULT_MINIMAL_COMMIT_SETTINGS = {
|
|
301
312
|
enableMultipleScopes: false,
|
|
302
313
|
disableEmoji: true,
|
|
303
314
|
breakingChangePrefix: "\u{1F4A3} ",
|
|
304
315
|
closedIssuePrefix: "\u2705 ",
|
|
305
|
-
format:
|
|
316
|
+
format: DEFAULT_MINIMAL_COMMIT_MESSAGE_FORMAT
|
|
306
317
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
318
|
+
var DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT = "{type}({scope}): {emoji}{subject}";
|
|
319
|
+
var DEFAULT_MONOREPO_COMMIT_SETTINGS = {
|
|
320
|
+
enableMultipleScopes: false,
|
|
321
|
+
disableEmoji: true,
|
|
322
|
+
breakingChangePrefix: "\u{1F4A3} ",
|
|
323
|
+
closedIssuePrefix: "\u2705 ",
|
|
324
|
+
format: DEFAULT_MONOREPO_COMMIT_MESSAGE_FORMAT
|
|
325
|
+
};
|
|
326
|
+
var DEFAULT_MINIMAL_COMMIT_RULES = {
|
|
327
|
+
"body-leading-blank": [1 /* Warning */, "always"],
|
|
328
|
+
"body-max-length": [2 /* Error */, "always", 600],
|
|
329
|
+
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
330
|
+
"footer-max-line-length": [2 /* Error */, "always", 150],
|
|
331
|
+
"header-max-length": [2 /* Error */, "always", 150],
|
|
332
|
+
"header-trim": [2 /* Error */, "always"],
|
|
333
|
+
"subject-case": [2 /* Error */, "always", ["sentence-case"]],
|
|
334
|
+
"subject-empty": [2 /* Error */, "never"],
|
|
335
|
+
"subject-full-stop": [2 /* Error */, "never", "."],
|
|
336
|
+
"subject-max-length": [2 /* Error */, "always", 150],
|
|
337
|
+
"subject-min-length": [2 /* Error */, "always", 3],
|
|
338
|
+
"type-case": [2 /* Error */, "always", "kebab-case"],
|
|
339
|
+
"type-empty": [2 /* Error */, "never"],
|
|
340
|
+
"type-enum": [
|
|
341
|
+
2 /* Error */,
|
|
342
|
+
"always",
|
|
343
|
+
Object.keys(COMMIT_TYPES)
|
|
344
|
+
],
|
|
345
|
+
"type-max-length": [2 /* Error */, "always", 20],
|
|
346
|
+
"type-min-length": [2 /* Error */, "always", 3],
|
|
347
|
+
"scope-case": 0 /* Disabled */,
|
|
348
|
+
"scope-empty": 0 /* Disabled */
|
|
349
|
+
};
|
|
350
|
+
var DEFAULT_MONOREPO_COMMIT_RULES = {
|
|
310
351
|
"body-leading-blank": [1 /* Warning */, "always"],
|
|
311
352
|
"body-max-length": [2 /* Error */, "always", 600],
|
|
312
353
|
"footer-leading-blank": [1 /* Warning */, "always"],
|
|
@@ -330,12 +371,30 @@ var DEFAULT_COMMIT_RULES = {
|
|
|
330
371
|
"scope-case": [2 /* Error */, "always", ["kebab-case"]],
|
|
331
372
|
"scope-empty": [2 /* Error */, "never"]
|
|
332
373
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
374
|
+
|
|
375
|
+
// src/commitlint/config/minimal.ts
|
|
376
|
+
var config = {
|
|
377
|
+
rules: DEFAULT_MINIMAL_COMMIT_RULES,
|
|
378
|
+
helpUrl: "https://developer.stormsoftware.com/commitlint/minimal",
|
|
379
|
+
parserOpts: {
|
|
380
|
+
headerPattern: /^(\w*): (.*)$/,
|
|
381
|
+
breakingHeaderPattern: /^(\w*): (.*)$/,
|
|
382
|
+
headerCorrespondence: ["type", "subject"],
|
|
383
|
+
noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
|
|
384
|
+
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
385
|
+
revertCorrespondence: ["header", "hash"],
|
|
386
|
+
issuePrefixes: ["#"]
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
var minimal_default = config;
|
|
390
|
+
|
|
391
|
+
// src/commitlint/config/monorepo.ts
|
|
392
|
+
var config2 = {
|
|
393
|
+
rules: DEFAULT_MONOREPO_COMMIT_RULES,
|
|
394
|
+
helpUrl: "https://developer.stormsoftware.com/commitlint/monorepo",
|
|
336
395
|
parserOpts: {
|
|
337
|
-
headerPattern: /^(\w*)(?:\((.*)\))
|
|
338
|
-
breakingHeaderPattern: /^(\w*)(?:\((.*)\))
|
|
396
|
+
headerPattern: /^(\w*)(?:\((.*)\))!?: (.*)$/,
|
|
397
|
+
breakingHeaderPattern: /^(\w*)(?:\((.*)\))!: (.*)$/,
|
|
339
398
|
headerCorrespondence: ["type", "scope", "subject"],
|
|
340
399
|
noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
|
|
341
400
|
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
@@ -343,6 +402,38 @@ var DEFAULT_COMMITLINT_CONFIG = {
|
|
|
343
402
|
issuePrefixes: ["#"]
|
|
344
403
|
}
|
|
345
404
|
};
|
|
405
|
+
var monorepo_default = config2;
|
|
406
|
+
|
|
407
|
+
// src/commitlint/helpers.ts
|
|
408
|
+
var jiti = jiti$1.createJiti(chunkLD4V463J_cjs.importMetaUrl, { importMeta: ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('git.cjs', document.baseURI).href)) }) });
|
|
409
|
+
async function resolveCommitlintConfig(workspaceConfig, configPath) {
|
|
410
|
+
if (configPath && configPath !== "@storm-software/git-tools/commitlint/minimal" && configPath !== "@storm-software/git-tools/commitlint/monorepo") {
|
|
411
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
412
|
+
`Using custom commitlint config file: ${configPath}`,
|
|
413
|
+
workspaceConfig
|
|
414
|
+
);
|
|
415
|
+
} else {
|
|
416
|
+
configPath = workspaceConfig?.variant === "minimal" ? "@storm-software/git-tools/commitlint/minimal" : "@storm-software/git-tools/commitlint/monorepo";
|
|
417
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
418
|
+
`Using standard commitlint config file: ${configPath}`,
|
|
419
|
+
workspaceConfig
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
let config5 = {};
|
|
423
|
+
if ((configPath.endsWith(".json") || configPath.endsWith(".jsonc")) && !fs$1.existsSync(jiti.esmResolve(configPath, workspaceConfig.workspaceRoot))) {
|
|
424
|
+
const configContent = await fs.readFile(
|
|
425
|
+
jiti.esmResolve(configPath, workspaceConfig.workspaceRoot),
|
|
426
|
+
"utf8"
|
|
427
|
+
);
|
|
428
|
+
config5 = JSON.parse(configContent);
|
|
429
|
+
} else {
|
|
430
|
+
config5 = await jiti.import(jiti.esmResolve(configPath), { default: true });
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
...workspaceConfig.variant === "minimal" ? minimal_default : monorepo_default,
|
|
434
|
+
...config5 ?? {}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
346
437
|
|
|
347
438
|
// ../../node_modules/.pnpm/conventional-commits-parser@6.2.0/node_modules/conventional-commits-parser/dist/regex.js
|
|
348
439
|
var nomatchRegex = /(?!.*)/;
|
|
@@ -759,11 +850,8 @@ ${body}` : message;
|
|
|
759
850
|
${footer}` : message;
|
|
760
851
|
return message || "";
|
|
761
852
|
};
|
|
762
|
-
async function lint(message,
|
|
763
|
-
const
|
|
764
|
-
const parser = new CommitParser(
|
|
765
|
-
rawOpts?.parserOpts ?? DEFAULT_COMMITLINT_CONFIG.parserOpts
|
|
766
|
-
);
|
|
853
|
+
async function lint(message, commitlintConfig) {
|
|
854
|
+
const parser = new CommitParser(commitlintConfig.parserOpts);
|
|
767
855
|
const parsed = parser.parse(message);
|
|
768
856
|
if (parsed.header === null && parsed.body === null && parsed.footer === null) {
|
|
769
857
|
return {
|
|
@@ -774,7 +862,7 @@ async function lint(message, rawRulesConfig, rawOpts) {
|
|
|
774
862
|
};
|
|
775
863
|
}
|
|
776
864
|
const allRules = new Map(Object.entries(defaultRules__default.default));
|
|
777
|
-
const missing = Object.keys(
|
|
865
|
+
const missing = Object.keys(commitlintConfig.rules).filter(
|
|
778
866
|
(name) => typeof allRules.get(name) !== "function"
|
|
779
867
|
);
|
|
780
868
|
if (missing.length > 0) {
|
|
@@ -786,19 +874,19 @@ async function lint(message, rawRulesConfig, rawOpts) {
|
|
|
786
874
|
].join("\n")
|
|
787
875
|
);
|
|
788
876
|
}
|
|
789
|
-
const invalid = Object.entries(
|
|
790
|
-
if (!Array.isArray(
|
|
877
|
+
const invalid = Object.entries(commitlintConfig.rules).map(([name, config5]) => {
|
|
878
|
+
if (!Array.isArray(config5)) {
|
|
791
879
|
return new Error(
|
|
792
880
|
`config for rule ${name} must be array, received ${util__default.default.inspect(
|
|
793
|
-
|
|
794
|
-
)} of type ${typeof
|
|
881
|
+
config5
|
|
882
|
+
)} of type ${typeof config5}`
|
|
795
883
|
);
|
|
796
884
|
}
|
|
797
|
-
const [level] =
|
|
798
|
-
if (level === 0 /* Disabled */ &&
|
|
885
|
+
const [level] = config5;
|
|
886
|
+
if (level === 0 /* Disabled */ && config5.length === 1) {
|
|
799
887
|
return null;
|
|
800
888
|
}
|
|
801
|
-
const [, when] =
|
|
889
|
+
const [, when] = config5;
|
|
802
890
|
if (typeof level !== "number" || isNaN(level)) {
|
|
803
891
|
return new Error(
|
|
804
892
|
`level for rule ${name} must be number, received ${util__default.default.inspect(
|
|
@@ -806,11 +894,11 @@ async function lint(message, rawRulesConfig, rawOpts) {
|
|
|
806
894
|
)} of type ${typeof level}`
|
|
807
895
|
);
|
|
808
896
|
}
|
|
809
|
-
if (
|
|
897
|
+
if (config5.length < 2 || config5.length > 3) {
|
|
810
898
|
return new Error(
|
|
811
899
|
`config for rule ${name} must be 2 or 3 items long, received ${util__default.default.inspect(
|
|
812
|
-
|
|
813
|
-
)} of length ${
|
|
900
|
+
config5
|
|
901
|
+
)} of length ${config5.length}`
|
|
814
902
|
);
|
|
815
903
|
}
|
|
816
904
|
if (level < 0 || level > 2) {
|
|
@@ -839,9 +927,11 @@ async function lint(message, rawRulesConfig, rawOpts) {
|
|
|
839
927
|
if (invalid.length > 0) {
|
|
840
928
|
throw new Error(invalid.map((i) => i.message).join("\n"));
|
|
841
929
|
}
|
|
842
|
-
const pendingResults = Object.entries(
|
|
843
|
-
|
|
844
|
-
|
|
930
|
+
const pendingResults = Object.entries(
|
|
931
|
+
commitlintConfig.rules
|
|
932
|
+
).filter(([, config5]) => !!config5 && config5.length && config5[0] > 0).map(async (entry) => {
|
|
933
|
+
const [name, config5] = entry;
|
|
934
|
+
const [level, when, value] = config5;
|
|
845
935
|
const rule = allRules.get(name);
|
|
846
936
|
if (!rule) {
|
|
847
937
|
throw new Error(`Could not find rule implementation for ${name}`);
|
|
@@ -914,18 +1004,18 @@ function getRuleFromScopeEnum(scopeEnum) {
|
|
|
914
1004
|
|
|
915
1005
|
// src/commitlint/run.ts
|
|
916
1006
|
var COMMIT_EDITMSG_PATH = ".git/COMMIT_EDITMSG";
|
|
917
|
-
|
|
918
|
-
|
|
1007
|
+
async function runCommitLint(workspaceConfig, options) {
|
|
1008
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
919
1009
|
"\u{1F4DD} Validating git commit message aligns with the Storm Software specification",
|
|
920
|
-
|
|
1010
|
+
workspaceConfig
|
|
921
1011
|
);
|
|
922
1012
|
let commitMessage;
|
|
923
|
-
if (
|
|
924
|
-
commitMessage =
|
|
1013
|
+
if (options.message && options.message !== COMMIT_EDITMSG_PATH) {
|
|
1014
|
+
commitMessage = options.message;
|
|
925
1015
|
} else {
|
|
926
|
-
const commitFile =
|
|
927
|
-
|
|
928
|
-
|
|
1016
|
+
const commitFile = chunkLD4V463J_cjs.joinPaths(
|
|
1017
|
+
workspaceConfig.workspaceRoot,
|
|
1018
|
+
options.file || options.message || COMMIT_EDITMSG_PATH
|
|
929
1019
|
);
|
|
930
1020
|
if (fs$1.existsSync(commitFile)) {
|
|
931
1021
|
commitMessage = (await fs.readFile(commitFile, "utf8"))?.trim();
|
|
@@ -935,61 +1025,75 @@ var runCommitLint = async (config, params) => {
|
|
|
935
1025
|
let gitLogCmd = "git log -1 --no-merges";
|
|
936
1026
|
const gitRemotes = childProcess__default.default.execSync("git remote -v").toString().trim().split("\n");
|
|
937
1027
|
const upstreamRemote = gitRemotes.find(
|
|
938
|
-
(remote) => remote.includes(`${
|
|
1028
|
+
(remote) => remote.includes(`${workspaceConfig.name}.git`)
|
|
939
1029
|
);
|
|
940
1030
|
if (upstreamRemote) {
|
|
941
1031
|
const upstreamRemoteIdentifier = upstreamRemote.split(" ")[0]?.trim();
|
|
942
1032
|
if (!upstreamRemoteIdentifier) {
|
|
943
|
-
|
|
944
|
-
`No upstream remote found for ${
|
|
945
|
-
|
|
1033
|
+
chunkLD4V463J_cjs.writeWarning(
|
|
1034
|
+
`No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison.`,
|
|
1035
|
+
workspaceConfig
|
|
946
1036
|
);
|
|
947
1037
|
return;
|
|
948
1038
|
}
|
|
949
|
-
|
|
1039
|
+
chunkLD4V463J_cjs.writeDebug(`Comparing against remote ${upstreamRemoteIdentifier}`);
|
|
950
1040
|
const currentBranch = childProcess__default.default.execSync("git branch --show-current").toString().trim();
|
|
951
1041
|
gitLogCmd = gitLogCmd + ` ${currentBranch} ^${upstreamRemoteIdentifier}/main`;
|
|
952
1042
|
} else {
|
|
953
|
-
|
|
954
|
-
`No upstream remote found for ${
|
|
955
|
-
|
|
1043
|
+
chunkLD4V463J_cjs.writeWarning(
|
|
1044
|
+
`No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison against upstream main.`,
|
|
1045
|
+
workspaceConfig
|
|
956
1046
|
);
|
|
957
1047
|
return;
|
|
958
1048
|
}
|
|
959
1049
|
commitMessage = childProcess__default.default.execSync(gitLogCmd).toString().trim();
|
|
960
1050
|
if (!commitMessage) {
|
|
961
|
-
|
|
1051
|
+
chunkLD4V463J_cjs.writeWarning(
|
|
962
1052
|
"No commits found. Skipping commit message validation.",
|
|
963
|
-
|
|
1053
|
+
workspaceConfig
|
|
964
1054
|
);
|
|
965
1055
|
return;
|
|
966
1056
|
}
|
|
967
1057
|
}
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
config
|
|
971
|
-
});
|
|
972
|
-
const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:-s])+)`;
|
|
973
|
-
const matchCommit = new RegExp(commitMsgRegex, "g").test(commitMessage);
|
|
974
|
-
const commitlintConfig = chunkXH6F7XTV_cjs.defu(
|
|
975
|
-
params.config ?? {},
|
|
976
|
-
{ rules: { "scope-enum": getRuleFromScopeEnum(allowedScopes) } },
|
|
977
|
-
DEFAULT_COMMITLINT_CONFIG
|
|
1058
|
+
const commitlintConfig = await resolveCommitlintConfig(
|
|
1059
|
+
workspaceConfig,
|
|
1060
|
+
options.config
|
|
978
1061
|
);
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1062
|
+
let commitlintRegex;
|
|
1063
|
+
const allowedTypes = commitlintConfig.rules["type-enum"] ?? COMMIT_TYPES;
|
|
1064
|
+
let allowedScopes = [];
|
|
1065
|
+
if (commitlintConfig.rules["scope-empty"] && commitlintConfig.rules["scope-empty"][0] !== 0 /* Disabled */) {
|
|
1066
|
+
allowedScopes = await getNxScopes({
|
|
1067
|
+
config: workspaceConfig
|
|
1068
|
+
});
|
|
1069
|
+
commitlintConfig.rules["scope-enum"] = getRuleFromScopeEnum(allowedScopes);
|
|
1070
|
+
commitlintRegex = new RegExp(
|
|
1071
|
+
`(${Object.keys(allowedTypes).join("|")})\\((${allowedScopes})\\)!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
1072
|
+
);
|
|
1073
|
+
} else {
|
|
1074
|
+
commitlintRegex = new RegExp(
|
|
1075
|
+
`(${Object.keys(allowedTypes).join("|")})!?:\\s([a-z0-9:\\-\\/\\s])+`
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
const report = await lint(commitMessage, commitlintConfig);
|
|
1079
|
+
if (!commitlintRegex.test(commitMessage) || report.errors.length || report.warnings.length) {
|
|
1080
|
+
chunkLD4V463J_cjs.writeSuccess(
|
|
1081
|
+
`Commit was processing completed successfully!`,
|
|
1082
|
+
workspaceConfig
|
|
1083
|
+
);
|
|
985
1084
|
} else {
|
|
986
|
-
let errorMessage = " Oh no! Your commit message: \n-------------------------------------------------------------------\n" + commitMessage +
|
|
987
|
-
|
|
1085
|
+
let errorMessage = " Oh no! Your commit message: \n-------------------------------------------------------------------\n" + commitMessage + `
|
|
1086
|
+
-------------------------------------------------------------------
|
|
1087
|
+
|
|
1088
|
+
Does not follow the ${workspaceConfig.variant} commit message convention specified by the ${(typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name) || "Storm Software"} team.`;
|
|
1089
|
+
errorMessage += allowedScopes.length ? "\ntype(scope): subject \n BLANK LINE \n body" : "\ntype: subject \n BLANK LINE \n body";
|
|
988
1090
|
errorMessage += "\n";
|
|
989
1091
|
errorMessage += `
|
|
990
1092
|
Possible types: ${allowedTypes}`;
|
|
991
|
-
|
|
1093
|
+
if (allowedScopes.length) {
|
|
1094
|
+
errorMessage += `
|
|
992
1095
|
Possible scopes: ${allowedScopes} (if unsure use "monorepo")`;
|
|
1096
|
+
}
|
|
993
1097
|
errorMessage += "\n\nEXAMPLE: \nfeat(my-lib): add an option to generate lazy-loadable modules\nfix(monorepo)!: breaking change should have exclamation mark\n";
|
|
994
1098
|
errorMessage += `
|
|
995
1099
|
|
|
@@ -1003,15 +1107,81 @@ More details about the Storm Software commit message specification can be found
|
|
|
1003
1107
|
throw new Error(errorMessage);
|
|
1004
1108
|
}
|
|
1005
1109
|
return report.input;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// src/commit/config/minimal.ts
|
|
1113
|
+
var config3 = {
|
|
1114
|
+
settings: DEFAULT_MINIMAL_COMMIT_SETTINGS,
|
|
1115
|
+
messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
|
|
1116
|
+
questions: DEFAULT_MINIMAL_COMMIT_QUESTIONS,
|
|
1117
|
+
types: COMMIT_TYPES
|
|
1006
1118
|
};
|
|
1119
|
+
var minimal_default2 = config3;
|
|
1007
1120
|
|
|
1008
|
-
// src/commit/config.ts
|
|
1009
|
-
var
|
|
1010
|
-
settings:
|
|
1121
|
+
// src/commit/config/monorepo.ts
|
|
1122
|
+
var config4 = {
|
|
1123
|
+
settings: DEFAULT_MONOREPO_COMMIT_SETTINGS,
|
|
1011
1124
|
messages: DEFAULT_COMMIT_PROMPT_MESSAGES,
|
|
1012
|
-
questions:
|
|
1125
|
+
questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
|
|
1013
1126
|
types: COMMIT_TYPES
|
|
1014
1127
|
};
|
|
1128
|
+
var monorepo_default2 = config4;
|
|
1129
|
+
|
|
1130
|
+
// src/commit/helpers.ts
|
|
1131
|
+
function resolveMinimalCommitOptions(config5 = minimal_default2) {
|
|
1132
|
+
return {
|
|
1133
|
+
parserPreset: "conventional-changelog-conventionalcommits",
|
|
1134
|
+
prompt: {
|
|
1135
|
+
settings: config5.settings,
|
|
1136
|
+
messages: config5.messages,
|
|
1137
|
+
questions: config5.questions
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
function resolveMonorepoCommitOptions(workspaceConfig, config5 = monorepo_default2) {
|
|
1142
|
+
return {
|
|
1143
|
+
utils: { getScopeEnum: getScopeEnumUtil({ config: workspaceConfig }) },
|
|
1144
|
+
parserPreset: "conventional-changelog-conventionalcommits",
|
|
1145
|
+
prompt: {
|
|
1146
|
+
settings: config5.settings,
|
|
1147
|
+
messages: config5.messages,
|
|
1148
|
+
questions: config5.questions
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
var jiti2 = jiti$1.createJiti(chunkLD4V463J_cjs.importMetaUrl, { importMeta: ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('git.cjs', document.baseURI).href)) }) });
|
|
1153
|
+
async function resolveCommitConfig(workspaceConfig, configPath) {
|
|
1154
|
+
if (configPath && configPath !== "@storm-software/git-tools/commit/minimal" && configPath !== "@storm-software/git-tools/commit/monorepo") {
|
|
1155
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
1156
|
+
`Using custom commit config file: ${configPath}`,
|
|
1157
|
+
workspaceConfig
|
|
1158
|
+
);
|
|
1159
|
+
} else {
|
|
1160
|
+
configPath = workspaceConfig?.variant === "minimal" ? "@storm-software/git-tools/commit/minimal" : "@storm-software/git-tools/commit/monorepo";
|
|
1161
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
1162
|
+
`Using standard commit config file: ${configPath}`,
|
|
1163
|
+
workspaceConfig
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
let config5 = {};
|
|
1167
|
+
if ((configPath.endsWith(".json") || configPath.endsWith(".jsonc")) && !fs$1.existsSync(jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot))) {
|
|
1168
|
+
const configContent = await fs.readFile(
|
|
1169
|
+
jiti2.esmResolve(configPath, workspaceConfig.workspaceRoot),
|
|
1170
|
+
"utf8"
|
|
1171
|
+
);
|
|
1172
|
+
config5 = JSON.parse(configContent);
|
|
1173
|
+
} else {
|
|
1174
|
+
config5 = await jiti2.import(jiti2.esmResolve(configPath), { default: true });
|
|
1175
|
+
}
|
|
1176
|
+
const mergedConfig = {
|
|
1177
|
+
...config5 ?? {},
|
|
1178
|
+
...workspaceConfig.variant === "minimal" ? minimal_default2 : monorepo_default2
|
|
1179
|
+
};
|
|
1180
|
+
return workspaceConfig.variant === "minimal" ? resolveMinimalCommitOptions(mergedConfig) : resolveMonorepoCommitOptions(
|
|
1181
|
+
workspaceConfig,
|
|
1182
|
+
mergedConfig
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1015
1185
|
|
|
1016
1186
|
// src/commit/commit-state.ts
|
|
1017
1187
|
function getGitDir() {
|
|
@@ -1024,49 +1194,19 @@ function getGitRootDir() {
|
|
|
1024
1194
|
const dir = childProcess.execSync(`git rev-parse --show-toplevel 2>${devNull}`).toString().trim();
|
|
1025
1195
|
return dir;
|
|
1026
1196
|
}
|
|
1027
|
-
async function
|
|
1028
|
-
return {
|
|
1029
|
-
utils: { getScopeEnum: getScopeEnumUtil({ config: workspaceConfig }) },
|
|
1030
|
-
parserPreset: "conventional-changelog-conventionalcommits",
|
|
1031
|
-
prompt: {
|
|
1032
|
-
settings: config.settings,
|
|
1033
|
-
messages: config.messages,
|
|
1034
|
-
questions: config.questions
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
async function resolveDefaultCommitOptions(config) {
|
|
1039
|
-
return resolveCommitOptions(DEFAULT_COMMIT_CONFIG, config);
|
|
1040
|
-
}
|
|
1041
|
-
async function createState(config, commitizenFile = "@storm-software/git-tools/commit/config") {
|
|
1197
|
+
async function createState(workspaceConfig, configPath) {
|
|
1042
1198
|
let root;
|
|
1043
1199
|
try {
|
|
1044
1200
|
root = getGitRootDir();
|
|
1045
1201
|
} catch (_2) {
|
|
1046
1202
|
throw new Error("Could not find Git root folder.");
|
|
1047
1203
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
};
|
|
1055
|
-
} else {
|
|
1056
|
-
chunkXH6F7XTV_cjs.writeInfo(`Using custom commit config file: ${commitizenFile}`, config);
|
|
1057
|
-
let commitizenConfig = await import(commitizenFile);
|
|
1058
|
-
if (commitizenConfig?.default) {
|
|
1059
|
-
commitizenConfig = commitizenConfig?.default;
|
|
1060
|
-
}
|
|
1061
|
-
state = {
|
|
1062
|
-
config: await resolveCommitOptions(
|
|
1063
|
-
chunkXH6F7XTV_cjs.defu(commitizenConfig ?? {}, DEFAULT_COMMIT_CONFIG),
|
|
1064
|
-
config
|
|
1065
|
-
),
|
|
1066
|
-
root,
|
|
1067
|
-
answers: {}
|
|
1068
|
-
};
|
|
1069
|
-
}
|
|
1204
|
+
const state = {
|
|
1205
|
+
variant: workspaceConfig.variant,
|
|
1206
|
+
config: await resolveCommitConfig(workspaceConfig, configPath),
|
|
1207
|
+
root,
|
|
1208
|
+
answers: {}
|
|
1209
|
+
};
|
|
1070
1210
|
if (state.config.prompt.questions.type && state.config.prompt.questions.type.enum) {
|
|
1071
1211
|
state.config.prompt.questions.type.enum = Object.keys(state.config.prompt.questions.type.enum).reduce(
|
|
1072
1212
|
(ret, key) => {
|
|
@@ -1082,9 +1222,11 @@ async function createState(config, commitizenFile = "@storm-software/git-tools/c
|
|
|
1082
1222
|
{}
|
|
1083
1223
|
);
|
|
1084
1224
|
}
|
|
1085
|
-
if (!state.config.prompt.questions
|
|
1225
|
+
if (workspaceConfig.variant === "monorepo" && (!state.config.prompt.questions?.scope || !state.config.prompt.questions?.scope.enum || Object.keys(
|
|
1226
|
+
state.config.prompt.questions?.scope.enum
|
|
1227
|
+
).length === 0)) {
|
|
1086
1228
|
const scopes = await getScopeEnum({
|
|
1087
|
-
config
|
|
1229
|
+
config: workspaceConfig
|
|
1088
1230
|
});
|
|
1089
1231
|
for (const scope of scopes) {
|
|
1090
1232
|
if (scope === "monorepo") {
|
|
@@ -1116,7 +1258,7 @@ async function createState(config, commitizenFile = "@storm-software/git-tools/c
|
|
|
1116
1258
|
const project = projectConfigurations.projects[scope];
|
|
1117
1259
|
if (project) {
|
|
1118
1260
|
let description = `${project.name} - ${project.root}`;
|
|
1119
|
-
const packageJsonPath =
|
|
1261
|
+
const packageJsonPath = chunkLD4V463J_cjs.joinPaths(project.root, "package.json");
|
|
1120
1262
|
if (fs$1.existsSync(packageJsonPath)) {
|
|
1121
1263
|
const packageJsonFile = await fs.readFile(packageJsonPath, "utf8");
|
|
1122
1264
|
const packageJson = JSON.parse(packageJsonFile);
|
|
@@ -1143,7 +1285,7 @@ async function createState(config, commitizenFile = "@storm-software/git-tools/c
|
|
|
1143
1285
|
}
|
|
1144
1286
|
var MAX_LINE_WIDTH = 72;
|
|
1145
1287
|
var formatCommitMessage = (state) => {
|
|
1146
|
-
const { config, answers } = state;
|
|
1288
|
+
const { config: config5, answers } = state;
|
|
1147
1289
|
const wrapOptions = {
|
|
1148
1290
|
indent: "",
|
|
1149
1291
|
trim: true,
|
|
@@ -1162,13 +1304,13 @@ var formatCommitMessage = (state) => {
|
|
|
1162
1304
|
const scope = answers.scope ? answers.scope.trim() : "";
|
|
1163
1305
|
const subject = answers.subject?.trim();
|
|
1164
1306
|
const type = answers.type;
|
|
1165
|
-
const format2 =
|
|
1307
|
+
const format2 = config5.prompt.settings.format || "{type}({scope}): {emoji}{subject}";
|
|
1166
1308
|
const body = answers.body && typeof answers.body === "string" ? wrap__default.default(answers.body || "", wrapOptions) : "";
|
|
1167
1309
|
const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap__default.default(answers.breakingBody || "", wrapOptions) : "";
|
|
1168
1310
|
const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap__default.default(answers.issuesBody || "", wrapOptions) : "";
|
|
1169
1311
|
const head = format2.replace(
|
|
1170
1312
|
/\{emoji\}/g,
|
|
1171
|
-
|
|
1313
|
+
config5.prompt.settings.disableEmoji ? "" : `${emoji} `
|
|
1172
1314
|
).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
|
|
1173
1315
|
let msg = head;
|
|
1174
1316
|
if (body) {
|
|
@@ -1177,26 +1319,26 @@ var formatCommitMessage = (state) => {
|
|
|
1177
1319
|
${body}`;
|
|
1178
1320
|
}
|
|
1179
1321
|
if (breaking) {
|
|
1180
|
-
const breakingEmoji =
|
|
1322
|
+
const breakingEmoji = config5.prompt.settings.disableEmoji ? "" : config5.prompt.settings.breakingChangePrefix;
|
|
1181
1323
|
msg += `
|
|
1182
1324
|
|
|
1183
1325
|
BREAKING CHANGE: ${breakingEmoji}${breaking}`;
|
|
1184
1326
|
}
|
|
1185
1327
|
if (issues) {
|
|
1186
|
-
const closedIssueEmoji =
|
|
1328
|
+
const closedIssueEmoji = config5.prompt.settings.disableEmoji ? "" : config5.prompt.settings.closedIssuePrefix;
|
|
1187
1329
|
msg += `
|
|
1188
1330
|
|
|
1189
|
-
${closedIssueEmoji}${
|
|
1331
|
+
${closedIssueEmoji}${config5.prompt.settings.closedIssueMessage}${issues}`;
|
|
1190
1332
|
}
|
|
1191
1333
|
return msg;
|
|
1192
1334
|
};
|
|
1193
1335
|
|
|
1194
1336
|
// src/commit/run.ts
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
const state = await createState(
|
|
1337
|
+
async function runCommit(commitizenFile, dryRun = false) {
|
|
1338
|
+
const workspaceConfig = await chunkLD4V463J_cjs.getWorkspaceConfig();
|
|
1339
|
+
const state = await createState(workspaceConfig, commitizenFile);
|
|
1198
1340
|
if (dryRun) {
|
|
1199
|
-
|
|
1341
|
+
chunkLD4V463J_cjs.writeInfo("Running in dry mode.", workspaceConfig);
|
|
1200
1342
|
}
|
|
1201
1343
|
console.log(chalkTemplate__default.default`
|
|
1202
1344
|
{bold.#999999 ----------------------------------------}
|
|
@@ -1206,7 +1348,7 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1206
1348
|
`);
|
|
1207
1349
|
state.answers = await askQuestions(state);
|
|
1208
1350
|
const message = formatCommitMessage(state);
|
|
1209
|
-
const commitMsgFile =
|
|
1351
|
+
const commitMsgFile = chunkLD4V463J_cjs.joinPaths(getGitDir(), "COMMIT_EDITMSG");
|
|
1210
1352
|
console.log(chalkTemplate__default.default`
|
|
1211
1353
|
{bold.#999999 ----------------------------------------}
|
|
1212
1354
|
|
|
@@ -1214,22 +1356,22 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1214
1356
|
{bold.#FFFFFF Git-Commit File} - {#DDDDDD ${commitMsgFile}}
|
|
1215
1357
|
|
|
1216
1358
|
`);
|
|
1217
|
-
await runCommitLint(
|
|
1359
|
+
await runCommitLint(workspaceConfig, { message });
|
|
1218
1360
|
const commandItems = ["git", "commit", "-S"];
|
|
1219
1361
|
commandItems.push(...["--file", commitMsgFile]);
|
|
1220
1362
|
const command = shellescape__default.default(commandItems);
|
|
1221
1363
|
if (dryRun) {
|
|
1222
|
-
|
|
1364
|
+
chunkLD4V463J_cjs.writeDebug(
|
|
1223
1365
|
`Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
|
|
1224
|
-
|
|
1366
|
+
workspaceConfig
|
|
1225
1367
|
);
|
|
1226
|
-
|
|
1368
|
+
chunkLD4V463J_cjs.writeDebug(`Message [dry-run]: ${message}`, workspaceConfig);
|
|
1227
1369
|
} else {
|
|
1228
1370
|
await fs__default.default.writeFile(commitMsgFile, message);
|
|
1229
|
-
chunkCIJVSMK2_cjs.run(
|
|
1371
|
+
chunkCIJVSMK2_cjs.run(workspaceConfig, command);
|
|
1230
1372
|
}
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1373
|
+
}
|
|
1374
|
+
async function askQuestions(state) {
|
|
1233
1375
|
let index = 0;
|
|
1234
1376
|
for (const key of Object.keys(state.config.prompt.questions)) {
|
|
1235
1377
|
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))) {
|
|
@@ -1241,8 +1383,8 @@ var askQuestions = async (state) => {
|
|
|
1241
1383
|
}
|
|
1242
1384
|
}
|
|
1243
1385
|
return state.answers;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1386
|
+
}
|
|
1387
|
+
async function askQuestion(index, question) {
|
|
1246
1388
|
const message = chalkTemplate__default.default`{bold ${index + 1}. ${question.title}} - ${question.description}
|
|
1247
1389
|
`;
|
|
1248
1390
|
if (question.type === "select" && question.enum && Object.keys(question.enum).length > 1) {
|
|
@@ -1280,7 +1422,7 @@ var askQuestion = (index, question) => {
|
|
|
1280
1422
|
validate
|
|
1281
1423
|
});
|
|
1282
1424
|
}
|
|
1283
|
-
}
|
|
1425
|
+
}
|
|
1284
1426
|
function findFileName(filePath) {
|
|
1285
1427
|
return filePath?.split(
|
|
1286
1428
|
filePath?.includes(Path__default.default.sep) ? Path__default.default.sep : filePath?.includes("/") ? "/" : "\\"
|
|
@@ -2255,7 +2397,7 @@ async function generateChangelogContent(releaseVersion, filepath, newContent, cu
|
|
|
2255
2397
|
const header = await prettier.format(
|
|
2256
2398
|
` : void 0 : workspaceConfig?.release.banner.alt) || "Branded release banner image"}](${bannerUrl || chunkLD4V463J_cjs.STORM_DEFAULT_RELEASE_BANNER})
|
|
2259
2401
|
|
|
2260
2402
|
# Changelog ${project || workspaceConfig?.name ? "for" : ""}${workspaceConfig?.name ? ` ${titleCase(workspaceConfig.name)}` : ""}${project ? `${workspaceConfig?.name ? " -" : ""} ${titleCase(project)}` : ""}
|
|
2261
2403
|
|
|
@@ -2486,15 +2628,15 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
|
|
|
2486
2628
|
*
|
|
2487
2629
|
* @param config - The configuration object for the ChangelogRenderer
|
|
2488
2630
|
*/
|
|
2489
|
-
constructor(
|
|
2490
|
-
super(
|
|
2631
|
+
constructor(config5) {
|
|
2632
|
+
super(config5);
|
|
2491
2633
|
this.config = {
|
|
2492
|
-
...
|
|
2493
|
-
repoData:
|
|
2634
|
+
...config5,
|
|
2635
|
+
repoData: config5.remoteReleaseClient.getRemoteRepoData()
|
|
2494
2636
|
};
|
|
2495
2637
|
}
|
|
2496
2638
|
async render() {
|
|
2497
|
-
this.workspaceConfig = await
|
|
2639
|
+
this.workspaceConfig = await chunkLD4V463J_cjs.getWorkspaceConfig();
|
|
2498
2640
|
return await super.render();
|
|
2499
2641
|
}
|
|
2500
2642
|
preprocessChanges() {
|
|
@@ -2805,7 +2947,7 @@ async function createOrUpdateGithubReleaseInternal(githubRequestConfig, release,
|
|
|
2805
2947
|
if (!shouldContinueInGitHub) {
|
|
2806
2948
|
return;
|
|
2807
2949
|
}
|
|
2808
|
-
const open =
|
|
2950
|
+
const open = chunkLD4V463J_cjs.__require("open");
|
|
2809
2951
|
await open(result.url).then(() => {
|
|
2810
2952
|
console.info(
|
|
2811
2953
|
`
|
|
@@ -2918,7 +3060,7 @@ async function resolveTokenData(hostname) {
|
|
|
2918
3060
|
);
|
|
2919
3061
|
if (fs$1.existsSync(ghCLIPath)) {
|
|
2920
3062
|
const yamlContents = await fs$1.promises.readFile(ghCLIPath, "utf8");
|
|
2921
|
-
const { load } =
|
|
3063
|
+
const { load } = chunkLD4V463J_cjs.__require("@zkochan/js-yaml");
|
|
2922
3064
|
const ghCLIConfig = load(yamlContents);
|
|
2923
3065
|
if (ghCLIConfig[hostname]) {
|
|
2924
3066
|
if (ghCLIConfig[hostname].oauth_token) {
|
|
@@ -2943,37 +3085,37 @@ async function resolveTokenData(hostname) {
|
|
|
2943
3085
|
`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).`
|
|
2944
3086
|
);
|
|
2945
3087
|
}
|
|
2946
|
-
async function getGithubReleaseByTag(
|
|
3088
|
+
async function getGithubReleaseByTag(config5, tag) {
|
|
2947
3089
|
return (await makeGithubRequest(
|
|
2948
|
-
|
|
2949
|
-
`/repos/${
|
|
3090
|
+
config5,
|
|
3091
|
+
`/repos/${config5.repo}/releases/tags/${tag}`,
|
|
2950
3092
|
{}
|
|
2951
3093
|
)).data;
|
|
2952
3094
|
}
|
|
2953
|
-
async function makeGithubRequest(
|
|
3095
|
+
async function makeGithubRequest(config5, url, opts = {}) {
|
|
2954
3096
|
return await axios__default.default(url, {
|
|
2955
3097
|
...opts,
|
|
2956
|
-
baseURL:
|
|
3098
|
+
baseURL: config5.apiBaseUrl,
|
|
2957
3099
|
headers: {
|
|
2958
3100
|
...opts.headers,
|
|
2959
|
-
Authorization:
|
|
3101
|
+
Authorization: config5.token ? `Bearer ${config5.token}` : void 0
|
|
2960
3102
|
}
|
|
2961
3103
|
});
|
|
2962
3104
|
}
|
|
2963
|
-
async function createGithubRelease(
|
|
2964
|
-
return (await makeGithubRequest(
|
|
3105
|
+
async function createGithubRelease(config5, body) {
|
|
3106
|
+
return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases`, {
|
|
2965
3107
|
method: "POST",
|
|
2966
3108
|
data: body
|
|
2967
3109
|
})).data;
|
|
2968
3110
|
}
|
|
2969
|
-
async function updateGithubRelease(
|
|
2970
|
-
return (await makeGithubRequest(
|
|
3111
|
+
async function updateGithubRelease(config5, id, body) {
|
|
3112
|
+
return (await makeGithubRequest(config5, `/repos/${config5.repo}/releases/${id}`, {
|
|
2971
3113
|
method: "PATCH",
|
|
2972
3114
|
data: body
|
|
2973
3115
|
})).data;
|
|
2974
3116
|
}
|
|
2975
|
-
function githubNewReleaseURL(
|
|
2976
|
-
let url = `https://${
|
|
3117
|
+
function githubNewReleaseURL(config5, release) {
|
|
3118
|
+
let url = `https://${config5.hostname}/${config5.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
|
|
2977
3119
|
if (release.prerelease) {
|
|
2978
3120
|
url += "&prerelease=true";
|
|
2979
3121
|
}
|
|
@@ -2996,7 +3138,7 @@ async function createGithubRemoteReleaseClient(remoteName = "origin") {
|
|
|
2996
3138
|
await resolveTokenData(repoData.hostname)
|
|
2997
3139
|
);
|
|
2998
3140
|
}
|
|
2999
|
-
async function isUserAnOrganizationMember(userId,
|
|
3141
|
+
async function isUserAnOrganizationMember(userId, config5, remoteName = "origin") {
|
|
3000
3142
|
try {
|
|
3001
3143
|
const repoData = getGitHubRepoData(remoteName, "github");
|
|
3002
3144
|
if (!repoData) {
|
|
@@ -3017,7 +3159,7 @@ async function isUserAnOrganizationMember(userId, config, remoteName = "origin")
|
|
|
3017
3159
|
apiBaseUrl: repoData.apiBaseUrl,
|
|
3018
3160
|
token: tokenData?.token || null
|
|
3019
3161
|
},
|
|
3020
|
-
`/orgs/${typeof
|
|
3162
|
+
`/orgs/${typeof config5.organization === "string" ? config5.organization : config5.organization?.name}/members/${userId}`,
|
|
3021
3163
|
{}
|
|
3022
3164
|
);
|
|
3023
3165
|
if (result.status !== 204) {
|
|
@@ -3032,20 +3174,20 @@ async function isUserAnOrganizationMember(userId, config, remoteName = "origin")
|
|
|
3032
3174
|
// src/release/changelog.ts
|
|
3033
3175
|
function createAPI(overrideReleaseConfig) {
|
|
3034
3176
|
return async function releaseChangelog(args) {
|
|
3035
|
-
const workspaceConfig = await
|
|
3177
|
+
const workspaceConfig = await chunkLD4V463J_cjs.getWorkspaceConfig();
|
|
3036
3178
|
const projectGraph$1 = await projectGraph.createProjectGraphAsync({ exitOnError: true });
|
|
3037
3179
|
const nxJson$1 = nxJson.readNxJson();
|
|
3038
3180
|
const userProvidedReleaseConfig = deepMergeJson.deepMergeJson(
|
|
3039
3181
|
nxJson$1.release ?? {},
|
|
3040
3182
|
overrideReleaseConfig ?? {}
|
|
3041
3183
|
);
|
|
3042
|
-
const { error: configError, nxReleaseConfig } = await config.createNxReleaseConfig(
|
|
3184
|
+
const { error: configError, nxReleaseConfig } = await config$1.createNxReleaseConfig(
|
|
3043
3185
|
projectGraph$1,
|
|
3044
3186
|
await fileMapUtils.createProjectFileMapUsingProjectGraph(projectGraph$1),
|
|
3045
3187
|
userProvidedReleaseConfig
|
|
3046
3188
|
);
|
|
3047
3189
|
if (configError) {
|
|
3048
|
-
return await config.handleNxReleaseConfigError(configError, false);
|
|
3190
|
+
return await config$1.handleNxReleaseConfigError(configError, false);
|
|
3049
3191
|
}
|
|
3050
3192
|
if (args.printConfig) {
|
|
3051
3193
|
return printConfig.printConfigAndExit({
|
|
@@ -3303,8 +3445,8 @@ ${contents}`);
|
|
|
3303
3445
|
}
|
|
3304
3446
|
const allProjectChangelogs = {};
|
|
3305
3447
|
for (const releaseGroup of releaseGroups) {
|
|
3306
|
-
const
|
|
3307
|
-
if (
|
|
3448
|
+
const config5 = releaseGroup.changelog;
|
|
3449
|
+
if (config5 === false) {
|
|
3308
3450
|
continue;
|
|
3309
3451
|
}
|
|
3310
3452
|
const projects = args.projects?.length ? (
|
|
@@ -3693,7 +3835,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
3693
3835
|
});
|
|
3694
3836
|
latestCommit = await git.getCommitHash("HEAD");
|
|
3695
3837
|
} else if ((args.stageChanges ?? nxReleaseConfig.changelog?.git.stageChanges) && changes.length) {
|
|
3696
|
-
|
|
3838
|
+
chunkLD4V463J_cjs.writeDebug(`Staging changed files with git`);
|
|
3697
3839
|
await git.gitAdd({
|
|
3698
3840
|
changedFiles,
|
|
3699
3841
|
deletedFiles,
|
|
@@ -3702,7 +3844,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
3702
3844
|
});
|
|
3703
3845
|
}
|
|
3704
3846
|
if (args.gitTag ?? nxReleaseConfig.changelog?.git.tag) {
|
|
3705
|
-
|
|
3847
|
+
chunkLD4V463J_cjs.writeDebug(`Tagging commit with git`);
|
|
3706
3848
|
for (const tag of gitTagValues) {
|
|
3707
3849
|
await gitTag({
|
|
3708
3850
|
tag,
|
|
@@ -3714,7 +3856,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
3714
3856
|
}
|
|
3715
3857
|
}
|
|
3716
3858
|
if (args.gitPush ?? nxReleaseConfig.changelog?.git.push) {
|
|
3717
|
-
|
|
3859
|
+
chunkLD4V463J_cjs.writeDebug(`Pushing to git remote "${args.gitRemote}"`);
|
|
3718
3860
|
await git.gitPush({
|
|
3719
3861
|
gitRemote: args.gitRemote,
|
|
3720
3862
|
dryRun: args.dryRun,
|
|
@@ -3733,20 +3875,20 @@ async function generateChangelogForWorkspace({
|
|
|
3733
3875
|
workspaceChangelogVersion,
|
|
3734
3876
|
changes
|
|
3735
3877
|
}) {
|
|
3736
|
-
const workspaceConfig = await
|
|
3878
|
+
const workspaceConfig = await chunkLD4V463J_cjs.getWorkspaceConfig();
|
|
3737
3879
|
if (!workspaceConfig) {
|
|
3738
3880
|
throw new Error(
|
|
3739
3881
|
`Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
|
|
3740
3882
|
);
|
|
3741
3883
|
}
|
|
3742
|
-
const
|
|
3743
|
-
if (
|
|
3884
|
+
const config5 = nxReleaseConfig.changelog?.workspaceChangelog;
|
|
3885
|
+
if (config5 === false) {
|
|
3744
3886
|
return;
|
|
3745
3887
|
}
|
|
3746
3888
|
if (workspaceChangelogVersion === null) {
|
|
3747
3889
|
return;
|
|
3748
3890
|
}
|
|
3749
|
-
if (!
|
|
3891
|
+
if (!config5) {
|
|
3750
3892
|
throw new Error(
|
|
3751
3893
|
`Workspace changelog is enabled but no configuration was provided. Please provide a workspaceChangelog object in your nx.json`
|
|
3752
3894
|
);
|
|
@@ -3774,7 +3916,7 @@ async function generateChangelogForWorkspace({
|
|
|
3774
3916
|
const interactive = args.interactive === "all" || args.interactive === "workspace";
|
|
3775
3917
|
const dryRun = !!args.dryRun;
|
|
3776
3918
|
const gitRemote = args.gitRemote;
|
|
3777
|
-
let interpolatedTreePath =
|
|
3919
|
+
let interpolatedTreePath = config5.file || "";
|
|
3778
3920
|
if (interpolatedTreePath) {
|
|
3779
3921
|
interpolatedTreePath = utils.interpolate(interpolatedTreePath, {
|
|
3780
3922
|
projectName: "",
|
|
@@ -3801,8 +3943,8 @@ async function generateChangelogForWorkspace({
|
|
|
3801
3943
|
changelogEntryVersion: releaseVersion.rawVersion,
|
|
3802
3944
|
project: null,
|
|
3803
3945
|
isVersionPlans: false,
|
|
3804
|
-
entryWhenNoChanges:
|
|
3805
|
-
changelogRenderOptions:
|
|
3946
|
+
entryWhenNoChanges: config5.entryWhenNoChanges,
|
|
3947
|
+
changelogRenderOptions: config5.renderOptions,
|
|
3806
3948
|
conventionalCommitsConfig: nxReleaseConfig.conventionalCommits,
|
|
3807
3949
|
remoteReleaseClient
|
|
3808
3950
|
});
|
|
@@ -3847,14 +3989,14 @@ async function generateChangelogForProjects({
|
|
|
3847
3989
|
nxReleaseConfig,
|
|
3848
3990
|
projectToAdditionalDependencyBumps
|
|
3849
3991
|
}) {
|
|
3850
|
-
const workspaceConfig = await
|
|
3992
|
+
const workspaceConfig = await chunkLD4V463J_cjs.getWorkspaceConfig();
|
|
3851
3993
|
if (!workspaceConfig) {
|
|
3852
3994
|
throw new Error(
|
|
3853
3995
|
`Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
|
|
3854
3996
|
);
|
|
3855
3997
|
}
|
|
3856
|
-
const
|
|
3857
|
-
if (
|
|
3998
|
+
const config5 = releaseGroup.changelog;
|
|
3999
|
+
if (config5 === false) {
|
|
3858
4000
|
return;
|
|
3859
4001
|
}
|
|
3860
4002
|
const interactive = args.interactive === "all" || args.interactive === "projects";
|
|
@@ -3862,7 +4004,7 @@ async function generateChangelogForProjects({
|
|
|
3862
4004
|
const gitRemote = args.gitRemote;
|
|
3863
4005
|
const projectChangelogs = {};
|
|
3864
4006
|
for (const project of projects) {
|
|
3865
|
-
let interpolatedTreePath =
|
|
4007
|
+
let interpolatedTreePath = config5.file || "";
|
|
3866
4008
|
if (interpolatedTreePath) {
|
|
3867
4009
|
interpolatedTreePath = utils.interpolate(interpolatedTreePath, {
|
|
3868
4010
|
projectName: project.name,
|
|
@@ -3889,12 +4031,12 @@ async function generateChangelogForProjects({
|
|
|
3889
4031
|
changes,
|
|
3890
4032
|
changelogEntryVersion: releaseVersion.rawVersion,
|
|
3891
4033
|
project: project.name,
|
|
3892
|
-
entryWhenNoChanges: typeof
|
|
4034
|
+
entryWhenNoChanges: typeof config5.entryWhenNoChanges === "string" ? utils.interpolate(config5.entryWhenNoChanges, {
|
|
3893
4035
|
projectName: project.name,
|
|
3894
4036
|
projectRoot: project.data.root,
|
|
3895
4037
|
workspaceRoot: ""
|
|
3896
4038
|
}) : false,
|
|
3897
|
-
changelogRenderOptions:
|
|
4039
|
+
changelogRenderOptions: config5.renderOptions,
|
|
3898
4040
|
isVersionPlans: !!releaseGroup.versionPlans,
|
|
3899
4041
|
conventionalCommitsConfig: releaseGroup.versionPlans ? null : nxReleaseConfig.conventionalCommits,
|
|
3900
4042
|
dependencyBumps: projectToAdditionalDependencyBumps.get(project.name),
|
|
@@ -4083,7 +4225,7 @@ ${workspaceConfig.release.footer}
|
|
|
4083
4225
|
|
|
4084
4226
|
// src/release/config.ts
|
|
4085
4227
|
var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
|
|
4086
|
-
questions:
|
|
4228
|
+
questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
|
|
4087
4229
|
types: COMMIT_TYPES
|
|
4088
4230
|
};
|
|
4089
4231
|
var DEFAULT_RELEASE_GROUP_CONFIG = {
|
|
@@ -4147,21 +4289,21 @@ var DEFAULT_RELEASE_CONFIG = {
|
|
|
4147
4289
|
};
|
|
4148
4290
|
|
|
4149
4291
|
// src/release/run.ts
|
|
4150
|
-
var runRelease = async (
|
|
4292
|
+
var runRelease = async (config5, options) => {
|
|
4151
4293
|
if (!process.env.GITHUB_ACTOR) {
|
|
4152
4294
|
throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
|
|
4153
4295
|
}
|
|
4154
|
-
if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR,
|
|
4155
|
-
|
|
4296
|
+
if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config5)) {
|
|
4297
|
+
chunkLD4V463J_cjs.writeFatal(
|
|
4156
4298
|
"You must be a member of the Storm Software organization to run the release process.",
|
|
4157
|
-
|
|
4299
|
+
config5
|
|
4158
4300
|
);
|
|
4159
4301
|
throw new Error(
|
|
4160
|
-
`The GitHub actor "${process.env.GITHUB_ACTOR}" is not a member of the organization "${typeof
|
|
4302
|
+
`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.`
|
|
4161
4303
|
);
|
|
4162
4304
|
}
|
|
4163
|
-
const name =
|
|
4164
|
-
const email =
|
|
4305
|
+
const name = config5.bot.name;
|
|
4306
|
+
const email = config5.bot.email ? config5.bot.email : config5.bot.name ? `${config5.bot.name}@users.noreply.github.com` : "bot@stormsoftware.com";
|
|
4165
4307
|
process.env.GIT_AUTHOR_NAME = name;
|
|
4166
4308
|
process.env.GIT_AUTHOR_EMAIL = email;
|
|
4167
4309
|
process.env.GIT_COMMITTER_NAME = name;
|
|
@@ -4169,45 +4311,45 @@ var runRelease = async (config, options) => {
|
|
|
4169
4311
|
process.env.NODE_AUTH_TOKEN = process.env.NPM_TOKEN;
|
|
4170
4312
|
process.env.NPM_AUTH_TOKEN = process.env.NPM_TOKEN;
|
|
4171
4313
|
process.env.NPM_CONFIG_PROVENANCE = "true";
|
|
4172
|
-
|
|
4314
|
+
chunkLD4V463J_cjs.writeDebug("Creating workspace Project Graph data...", config5);
|
|
4173
4315
|
const nxJson = nxJson_js.readNxJson();
|
|
4174
|
-
|
|
4316
|
+
chunkLD4V463J_cjs.writeDebug("Reading in the workspaces release configuration", config5);
|
|
4175
4317
|
const to = options.head || process.env.NX_HEAD;
|
|
4176
4318
|
const from = options.base || process.env.NX_BASE;
|
|
4177
|
-
|
|
4319
|
+
chunkLD4V463J_cjs.writeDebug(
|
|
4178
4320
|
`Using the following Git SHAs to determine the release content:
|
|
4179
4321
|
- From: ${from}
|
|
4180
4322
|
- To: ${to}
|
|
4181
4323
|
`,
|
|
4182
|
-
|
|
4324
|
+
config5
|
|
4183
4325
|
);
|
|
4184
4326
|
if (nxJson.release?.groups) {
|
|
4185
4327
|
nxJson.release.groups = Object.keys(nxJson.release.groups).reduce(
|
|
4186
4328
|
(ret, groupName) => {
|
|
4187
4329
|
const groupConfig = nxJson.release?.groups?.[groupName];
|
|
4188
|
-
ret[groupName] =
|
|
4330
|
+
ret[groupName] = chunkLD4V463J_cjs.defu(groupConfig, DEFAULT_RELEASE_GROUP_CONFIG);
|
|
4189
4331
|
return ret;
|
|
4190
4332
|
},
|
|
4191
4333
|
{}
|
|
4192
4334
|
);
|
|
4193
4335
|
}
|
|
4194
|
-
const nxReleaseConfig =
|
|
4336
|
+
const nxReleaseConfig = chunkLD4V463J_cjs.defu(
|
|
4195
4337
|
nxJson.release,
|
|
4196
4338
|
DEFAULT_RELEASE_CONFIG
|
|
4197
4339
|
);
|
|
4198
|
-
|
|
4340
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
4199
4341
|
"Using the following `nx.json` release configuration values",
|
|
4200
|
-
|
|
4342
|
+
config5
|
|
4201
4343
|
);
|
|
4202
|
-
|
|
4344
|
+
chunkLD4V463J_cjs.writeInfo(nxReleaseConfig, config5);
|
|
4203
4345
|
const releaseVersion = version_js.createAPI(nxReleaseConfig);
|
|
4204
4346
|
const releaseChangelog = createAPI(nxReleaseConfig);
|
|
4205
4347
|
const releasePublish = publish_js.createAPI(nxReleaseConfig);
|
|
4206
|
-
|
|
4348
|
+
chunkLD4V463J_cjs.writeDebug("Determining the current release versions...", config5);
|
|
4207
4349
|
const { workspaceVersion, projectsVersionData } = await releaseVersion({
|
|
4208
4350
|
dryRun: false,
|
|
4209
|
-
verbose:
|
|
4210
|
-
preid:
|
|
4351
|
+
verbose: chunkLD4V463J_cjs.isVerbose(config5.logLevel),
|
|
4352
|
+
preid: config5.preid,
|
|
4211
4353
|
deleteVersionPlans: false,
|
|
4212
4354
|
stageChanges: true,
|
|
4213
4355
|
gitCommit: false
|
|
@@ -4217,34 +4359,34 @@ var runRelease = async (config, options) => {
|
|
|
4217
4359
|
version: nxReleaseConfig?.projectsRelationship !== "fixed" ? void 0 : workspaceVersion,
|
|
4218
4360
|
versionData: projectsVersionData,
|
|
4219
4361
|
dryRun: false,
|
|
4220
|
-
verbose:
|
|
4362
|
+
verbose: chunkLD4V463J_cjs.isVerbose(config5.logLevel),
|
|
4221
4363
|
to,
|
|
4222
4364
|
from,
|
|
4223
4365
|
gitCommit: true,
|
|
4224
4366
|
gitCommitMessage: "release(monorepo): Publish workspace release updates"
|
|
4225
4367
|
});
|
|
4226
|
-
|
|
4368
|
+
chunkLD4V463J_cjs.writeDebug("Tagging commit with git", config5);
|
|
4227
4369
|
if (options.skipPublish) {
|
|
4228
|
-
|
|
4370
|
+
chunkLD4V463J_cjs.writeWarning(
|
|
4229
4371
|
"Skipping publishing packages since `skipPublish` was provided as `true` in the release options.",
|
|
4230
|
-
|
|
4372
|
+
config5
|
|
4231
4373
|
);
|
|
4232
4374
|
} else {
|
|
4233
4375
|
const changedProjects = Object.keys(projectsVersionData).filter(
|
|
4234
4376
|
(key) => projectsVersionData[key]?.newVersion
|
|
4235
4377
|
);
|
|
4236
4378
|
if (changedProjects.length > 0) {
|
|
4237
|
-
|
|
4379
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
4238
4380
|
`Publishing release for ${changedProjects.length} ${changedProjects.length === 1 ? "project" : "projects"}:
|
|
4239
4381
|
${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
|
|
4240
4382
|
`,
|
|
4241
|
-
|
|
4383
|
+
config5
|
|
4242
4384
|
);
|
|
4243
|
-
await updatePackageManifests(projectsVersionData,
|
|
4385
|
+
await updatePackageManifests(projectsVersionData, config5);
|
|
4244
4386
|
const result = await releasePublish({
|
|
4245
4387
|
...options,
|
|
4246
4388
|
dryRun: !!options.dryRun,
|
|
4247
|
-
verbose:
|
|
4389
|
+
verbose: chunkLD4V463J_cjs.isVerbose(config5.logLevel)
|
|
4248
4390
|
});
|
|
4249
4391
|
const failedProjects = Object.keys(result).filter(
|
|
4250
4392
|
(key) => result[key]?.code && result[key]?.code > 0
|
|
@@ -4259,12 +4401,12 @@ ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${res
|
|
|
4259
4401
|
);
|
|
4260
4402
|
}
|
|
4261
4403
|
} else {
|
|
4262
|
-
|
|
4404
|
+
chunkLD4V463J_cjs.writeWarning("Skipped publishing packages.", config5);
|
|
4263
4405
|
}
|
|
4264
4406
|
}
|
|
4265
|
-
|
|
4407
|
+
chunkLD4V463J_cjs.writeSuccess("Completed the Storm workspace release process!", config5);
|
|
4266
4408
|
};
|
|
4267
|
-
async function updatePackageManifests(projectsVersionData,
|
|
4409
|
+
async function updatePackageManifests(projectsVersionData, config5) {
|
|
4268
4410
|
let projectGraph;
|
|
4269
4411
|
try {
|
|
4270
4412
|
projectGraph = devkit.readCachedProjectGraph();
|
|
@@ -4277,25 +4419,25 @@ async function updatePackageManifests(projectsVersionData, config) {
|
|
|
4277
4419
|
Object.keys(projectsVersionData).map(async (node) => {
|
|
4278
4420
|
const projectNode = projectGraph.nodes[node];
|
|
4279
4421
|
if (!projectNode?.data.root) {
|
|
4280
|
-
|
|
4422
|
+
chunkLD4V463J_cjs.writeWarning(
|
|
4281
4423
|
`Project node ${node} not found in the project graph. Skipping manifest update.`,
|
|
4282
|
-
|
|
4424
|
+
config5
|
|
4283
4425
|
);
|
|
4284
4426
|
return;
|
|
4285
4427
|
}
|
|
4286
4428
|
const versionData = projectsVersionData[node];
|
|
4287
4429
|
if (projectNode?.data.root && versionData && versionData.newVersion !== null) {
|
|
4288
|
-
|
|
4430
|
+
chunkLD4V463J_cjs.writeTrace(
|
|
4289
4431
|
`Writing version ${versionData.newVersion} update to manifest file for ${node}
|
|
4290
4432
|
`,
|
|
4291
|
-
|
|
4433
|
+
config5
|
|
4292
4434
|
);
|
|
4293
|
-
const projectRoot =
|
|
4294
|
-
|
|
4435
|
+
const projectRoot = chunkLD4V463J_cjs.joinPaths(
|
|
4436
|
+
config5.workspaceRoot,
|
|
4295
4437
|
projectNode.data.root
|
|
4296
4438
|
);
|
|
4297
|
-
const packageJsonPath =
|
|
4298
|
-
const cargoTomlPath =
|
|
4439
|
+
const packageJsonPath = chunkLD4V463J_cjs.joinPaths(projectRoot, "package.json");
|
|
4440
|
+
const cargoTomlPath = chunkLD4V463J_cjs.joinPaths(projectRoot, "Cargo.toml");
|
|
4299
4441
|
if (fs$1.existsSync(packageJsonPath)) {
|
|
4300
4442
|
const packageJsonContent = await fs.readFile(packageJsonPath, "utf8");
|
|
4301
4443
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -4313,16 +4455,16 @@ async function updatePackageManifests(projectsVersionData, config) {
|
|
|
4313
4455
|
})
|
|
4314
4456
|
);
|
|
4315
4457
|
} else {
|
|
4316
|
-
|
|
4458
|
+
chunkLD4V463J_cjs.writeWarning("No project nodes found. Skipping manifest updates.", config5);
|
|
4317
4459
|
}
|
|
4318
4460
|
}
|
|
4319
4461
|
|
|
4320
4462
|
// src/cli/index.ts
|
|
4321
4463
|
var _config = {};
|
|
4322
|
-
function createProgram(
|
|
4323
|
-
_config =
|
|
4324
|
-
|
|
4325
|
-
const root =
|
|
4464
|
+
function createProgram(config5) {
|
|
4465
|
+
_config = config5;
|
|
4466
|
+
chunkLD4V463J_cjs.writeInfo("\u26A1 Running Storm Git Tools", config5);
|
|
4467
|
+
const root = chunkLD4V463J_cjs.findWorkspaceRootSafe(process.cwd());
|
|
4326
4468
|
process.env.STORM_WORKSPACE_ROOT ??= root;
|
|
4327
4469
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root;
|
|
4328
4470
|
if (root) {
|
|
@@ -4333,7 +4475,7 @@ function createProgram(config) {
|
|
|
4333
4475
|
const commitConfig = new commander.Option(
|
|
4334
4476
|
"--config <file>",
|
|
4335
4477
|
"The Commitizen config file path"
|
|
4336
|
-
).
|
|
4478
|
+
).makeOptionMandatory(false);
|
|
4337
4479
|
const commitDryRun = new commander.Option(
|
|
4338
4480
|
"--dry-run",
|
|
4339
4481
|
"Should the commit be run in dry-run mode (no updates are made)"
|
|
@@ -4379,20 +4521,24 @@ function createProgram(config) {
|
|
|
4379
4521
|
"--file <commit-file>",
|
|
4380
4522
|
"The commit message to lint"
|
|
4381
4523
|
).makeOptionMandatory(false);
|
|
4382
|
-
|
|
4524
|
+
const commitlintConfig = new commander.Option(
|
|
4525
|
+
"--config <file>",
|
|
4526
|
+
"The CommitLint config file path"
|
|
4527
|
+
).makeOptionMandatory(false);
|
|
4528
|
+
program.command("commitlint").description("Run commitlint for the workspace's commit message.").addOption(commitlintConfig).addOption(commitMessage).addOption(commitFile).action(commitLintAction);
|
|
4383
4529
|
return program;
|
|
4384
4530
|
}
|
|
4385
4531
|
async function commitAction({
|
|
4386
|
-
config
|
|
4532
|
+
config: config5,
|
|
4387
4533
|
dryRun = false
|
|
4388
4534
|
}) {
|
|
4389
4535
|
try {
|
|
4390
|
-
|
|
4536
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
4391
4537
|
`\u26A1 Preparing to commit your changes. Please provide the requested details below...`,
|
|
4392
4538
|
_config
|
|
4393
4539
|
);
|
|
4394
|
-
await runCommit(
|
|
4395
|
-
|
|
4540
|
+
await runCommit(config5, dryRun);
|
|
4541
|
+
chunkLD4V463J_cjs.writeSuccess(
|
|
4396
4542
|
`\u{1F389} Storm Commit processing completed successfully!
|
|
4397
4543
|
|
|
4398
4544
|
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}
|
|
@@ -4400,7 +4546,7 @@ Note: Please run "pnpm push" to upload these changes to the remote ${_config.nam
|
|
|
4400
4546
|
_config
|
|
4401
4547
|
);
|
|
4402
4548
|
} catch (error) {
|
|
4403
|
-
|
|
4549
|
+
chunkLD4V463J_cjs.writeFatal(
|
|
4404
4550
|
`A fatal error occurred while running commit action:
|
|
4405
4551
|
|
|
4406
4552
|
${error.message}`,
|
|
@@ -4411,14 +4557,14 @@ ${error.message}`,
|
|
|
4411
4557
|
}
|
|
4412
4558
|
async function readmeAction(options) {
|
|
4413
4559
|
try {
|
|
4414
|
-
|
|
4560
|
+
chunkLD4V463J_cjs.writeInfo("\u26A1 Formatting the workspace's README.md files", _config);
|
|
4415
4561
|
await runReadme(options);
|
|
4416
|
-
|
|
4562
|
+
chunkLD4V463J_cjs.writeSuccess(
|
|
4417
4563
|
"Formatting of the workspace's README.md files is complete\n",
|
|
4418
4564
|
_config
|
|
4419
4565
|
);
|
|
4420
4566
|
} catch (error) {
|
|
4421
|
-
|
|
4567
|
+
chunkLD4V463J_cjs.writeFatal(
|
|
4422
4568
|
`A fatal error occurred while running README format action:
|
|
4423
4569
|
|
|
4424
4570
|
${error.message}`
|
|
@@ -4433,7 +4579,7 @@ async function releaseAction({
|
|
|
4433
4579
|
dryRun
|
|
4434
4580
|
}) {
|
|
4435
4581
|
try {
|
|
4436
|
-
|
|
4582
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
4437
4583
|
"\u26A1 Running the Storm Release and Publish process on the workspace",
|
|
4438
4584
|
_config
|
|
4439
4585
|
);
|
|
@@ -4443,9 +4589,9 @@ async function releaseAction({
|
|
|
4443
4589
|
base,
|
|
4444
4590
|
head
|
|
4445
4591
|
});
|
|
4446
|
-
|
|
4592
|
+
chunkLD4V463J_cjs.writeSuccess("Release completed successfully!\n", _config);
|
|
4447
4593
|
} catch (error) {
|
|
4448
|
-
|
|
4594
|
+
chunkLD4V463J_cjs.writeFatal(
|
|
4449
4595
|
`A fatal error occurred while running release action:
|
|
4450
4596
|
|
|
4451
4597
|
${error.message} ${error.stack ? `
|
|
@@ -4457,27 +4603,19 @@ Stacktrace: ${error.stack}` : ""}`,
|
|
|
4457
4603
|
throw new Error(error.message, { cause: error });
|
|
4458
4604
|
}
|
|
4459
4605
|
}
|
|
4460
|
-
async function commitLintAction({
|
|
4461
|
-
config,
|
|
4462
|
-
message,
|
|
4463
|
-
file
|
|
4464
|
-
}) {
|
|
4606
|
+
async function commitLintAction(options) {
|
|
4465
4607
|
try {
|
|
4466
|
-
|
|
4608
|
+
chunkLD4V463J_cjs.writeInfo(
|
|
4467
4609
|
`\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.`,
|
|
4468
4610
|
_config
|
|
4469
4611
|
);
|
|
4470
|
-
await runCommitLint(_config,
|
|
4471
|
-
|
|
4472
|
-
message,
|
|
4473
|
-
file
|
|
4474
|
-
});
|
|
4475
|
-
chunkXH6F7XTV_cjs.writeSuccess(
|
|
4612
|
+
await runCommitLint(_config, options);
|
|
4613
|
+
chunkLD4V463J_cjs.writeSuccess(
|
|
4476
4614
|
"Linting the commit messages completed successfully!\n",
|
|
4477
4615
|
_config
|
|
4478
4616
|
);
|
|
4479
4617
|
} catch (error) {
|
|
4480
|
-
|
|
4618
|
+
chunkLD4V463J_cjs.writeFatal(
|
|
4481
4619
|
`A fatal error occurred while linting the commit messages:
|
|
4482
4620
|
|
|
4483
4621
|
${error.message}`,
|
|
@@ -4489,18 +4627,18 @@ ${error.message}`,
|
|
|
4489
4627
|
|
|
4490
4628
|
// bin/git.ts
|
|
4491
4629
|
void (async () => {
|
|
4492
|
-
const
|
|
4630
|
+
const config5 = await chunkLD4V463J_cjs.getConfig();
|
|
4493
4631
|
try {
|
|
4494
|
-
|
|
4495
|
-
const program = createProgram(
|
|
4632
|
+
chunkLD4V463J_cjs.handleProcess(config5);
|
|
4633
|
+
const program = createProgram(config5);
|
|
4496
4634
|
await program.parseAsync(process.argv);
|
|
4497
|
-
|
|
4635
|
+
chunkLD4V463J_cjs.writeSuccess(
|
|
4498
4636
|
`\u{1F389} Git ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
|
|
4499
|
-
|
|
4637
|
+
config5
|
|
4500
4638
|
);
|
|
4501
|
-
|
|
4639
|
+
chunkLD4V463J_cjs.exitWithSuccess(config5);
|
|
4502
4640
|
} catch (error) {
|
|
4503
|
-
|
|
4641
|
+
chunkLD4V463J_cjs.exitWithError(config5);
|
|
4504
4642
|
process.exit(1);
|
|
4505
4643
|
}
|
|
4506
4644
|
})();
|