@storm-software/git-tools 2.113.17 → 2.113.19
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/git.cjs +32 -564
- package/bin/git.js +32 -545
- package/package.json +15 -26
package/bin/git.cjs
CHANGED
|
@@ -11,9 +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
|
|
15
|
-
var message9 = require('@commitlint/message');
|
|
16
|
-
var toLines2 = require('@commitlint/to-lines');
|
|
14
|
+
var defaultRules = require('@commitlint/rules');
|
|
17
15
|
require('stream');
|
|
18
16
|
var util = require('util');
|
|
19
17
|
var projectGraph = require('nx/src/project-graph/project-graph');
|
|
@@ -60,32 +58,12 @@ var os = require('os');
|
|
|
60
58
|
|
|
61
59
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
62
60
|
|
|
63
|
-
function _interopNamespace(e) {
|
|
64
|
-
if (e && e.__esModule) return e;
|
|
65
|
-
var n = Object.create(null);
|
|
66
|
-
if (e) {
|
|
67
|
-
Object.keys(e).forEach(function (k) {
|
|
68
|
-
if (k !== 'default') {
|
|
69
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
70
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
get: function () { return e[k]; }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
n.default = e;
|
|
78
|
-
return Object.freeze(n);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
61
|
var TOML__default = /*#__PURE__*/_interopDefault(TOML);
|
|
82
62
|
var shellescape__default = /*#__PURE__*/_interopDefault(shellescape);
|
|
83
63
|
var chalkTemplate__default = /*#__PURE__*/_interopDefault(chalkTemplate);
|
|
84
64
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
85
65
|
var childProcess__default = /*#__PURE__*/_interopDefault(childProcess);
|
|
86
|
-
var
|
|
87
|
-
var message9__default = /*#__PURE__*/_interopDefault(message9);
|
|
88
|
-
var toLines2__default = /*#__PURE__*/_interopDefault(toLines2);
|
|
66
|
+
var defaultRules__default = /*#__PURE__*/_interopDefault(defaultRules);
|
|
89
67
|
var util__default = /*#__PURE__*/_interopDefault(util);
|
|
90
68
|
var wrap__default = /*#__PURE__*/_interopDefault(wrap);
|
|
91
69
|
var Path__default = /*#__PURE__*/_interopDefault(Path);
|
|
@@ -365,516 +343,6 @@ var DEFAULT_COMMITLINT_CONFIG = {
|
|
|
365
343
|
issuePrefixes: ["#"]
|
|
366
344
|
}
|
|
367
345
|
};
|
|
368
|
-
var negated = (when) => when === "never";
|
|
369
|
-
var bodyCase = (parsed, when = "always", value = []) => {
|
|
370
|
-
const { body } = parsed;
|
|
371
|
-
if (!body) {
|
|
372
|
-
return [true];
|
|
373
|
-
}
|
|
374
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
375
|
-
if (typeof check === "string") {
|
|
376
|
-
return {
|
|
377
|
-
when: "always",
|
|
378
|
-
case: check
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
return check;
|
|
382
|
-
});
|
|
383
|
-
const result = checks.some((check) => {
|
|
384
|
-
const r = ensure.case(body, check.case);
|
|
385
|
-
return negated(check.when) ? !r : r;
|
|
386
|
-
});
|
|
387
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
388
|
-
return [
|
|
389
|
-
negated(when) ? !result : result,
|
|
390
|
-
message9__default.default([`body must`, negated(when) ? `not` : null, `be ${list}`])
|
|
391
|
-
];
|
|
392
|
-
};
|
|
393
|
-
var bodyEmpty = (parsed, when = "always") => {
|
|
394
|
-
const negated6 = when === "never";
|
|
395
|
-
const notEmpty6 = ensure__namespace.notEmpty(parsed.body || "");
|
|
396
|
-
return [
|
|
397
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
398
|
-
message9__default.default(["body", negated6 ? "may not" : "must", "be empty"])
|
|
399
|
-
];
|
|
400
|
-
};
|
|
401
|
-
var bodyFullStop = (parsed, when = "always", value = ".") => {
|
|
402
|
-
const input2 = parsed.body;
|
|
403
|
-
if (!input2) {
|
|
404
|
-
return [true];
|
|
405
|
-
}
|
|
406
|
-
const negated6 = when === "never";
|
|
407
|
-
const hasStop = input2[input2.length - 1] === value;
|
|
408
|
-
return [
|
|
409
|
-
negated6 ? !hasStop : hasStop,
|
|
410
|
-
message9__default.default(["body", negated6 ? "may not" : "must", "end with full stop"])
|
|
411
|
-
];
|
|
412
|
-
};
|
|
413
|
-
var bodyLeadingBlank = (parsed, when) => {
|
|
414
|
-
if (!parsed.body) {
|
|
415
|
-
return [true];
|
|
416
|
-
}
|
|
417
|
-
const negated6 = when === "never";
|
|
418
|
-
const [leading] = toLines2__default.default(parsed.raw).slice(1);
|
|
419
|
-
const succeeds = leading === "";
|
|
420
|
-
return [
|
|
421
|
-
negated6 ? !succeeds : succeeds,
|
|
422
|
-
message9__default.default(["body", negated6 ? "may not" : "must", "have leading blank line"])
|
|
423
|
-
];
|
|
424
|
-
};
|
|
425
|
-
var bodyMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
426
|
-
const input2 = parsed.body;
|
|
427
|
-
if (!input2) {
|
|
428
|
-
return [true];
|
|
429
|
-
}
|
|
430
|
-
return [
|
|
431
|
-
ensure.maxLength(input2, value),
|
|
432
|
-
`body must not be longer than ${value} characters`
|
|
433
|
-
];
|
|
434
|
-
};
|
|
435
|
-
var bodyMaxLineLength = (parsed, _when = void 0, value = 0) => {
|
|
436
|
-
const input2 = parsed.body;
|
|
437
|
-
if (!input2) {
|
|
438
|
-
return [true];
|
|
439
|
-
}
|
|
440
|
-
return [
|
|
441
|
-
ensure.maxLineLength(input2, value),
|
|
442
|
-
`body's lines must not be longer than ${value} characters`
|
|
443
|
-
];
|
|
444
|
-
};
|
|
445
|
-
var bodyMinLength = (parsed, _when = void 0, value = 0) => {
|
|
446
|
-
if (!parsed.body) {
|
|
447
|
-
return [true];
|
|
448
|
-
}
|
|
449
|
-
return [
|
|
450
|
-
ensure.minLength(parsed.body, value),
|
|
451
|
-
`body must not be shorter than ${value} characters`
|
|
452
|
-
];
|
|
453
|
-
};
|
|
454
|
-
var footerEmpty = (parsed, when = "always") => {
|
|
455
|
-
const negated6 = when === "never";
|
|
456
|
-
const notEmpty6 = ensure__namespace.notEmpty(parsed.footer || "");
|
|
457
|
-
return [
|
|
458
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
459
|
-
message9__default.default(["footer", negated6 ? "may not" : "must", "be empty"])
|
|
460
|
-
];
|
|
461
|
-
};
|
|
462
|
-
var footerLeadingBlank = (parsed, when = "always") => {
|
|
463
|
-
if (!parsed.footer) {
|
|
464
|
-
return [true];
|
|
465
|
-
}
|
|
466
|
-
const negated6 = when === "never";
|
|
467
|
-
const rawLines = toLines2__default.default(parsed.raw);
|
|
468
|
-
const footerLines = toLines2__default.default(parsed.footer);
|
|
469
|
-
const footerOffset = rawLines.indexOf(footerLines[0]);
|
|
470
|
-
const [leading] = rawLines.slice(footerOffset - 1);
|
|
471
|
-
const succeeds = leading === "";
|
|
472
|
-
return [
|
|
473
|
-
negated6 ? !succeeds : succeeds,
|
|
474
|
-
message9__default.default([
|
|
475
|
-
"footer",
|
|
476
|
-
negated6 ? "may not" : "must",
|
|
477
|
-
"have leading blank line"
|
|
478
|
-
])
|
|
479
|
-
];
|
|
480
|
-
};
|
|
481
|
-
var footerMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
482
|
-
const input2 = parsed.footer;
|
|
483
|
-
if (!input2) {
|
|
484
|
-
return [true];
|
|
485
|
-
}
|
|
486
|
-
return [
|
|
487
|
-
ensure.maxLength(input2, value),
|
|
488
|
-
`footer must not be longer than ${value} characters`
|
|
489
|
-
];
|
|
490
|
-
};
|
|
491
|
-
var footerMaxLineLength = (parsed, _when = void 0, value = 0) => {
|
|
492
|
-
const input2 = parsed.footer;
|
|
493
|
-
if (!input2) {
|
|
494
|
-
return [true];
|
|
495
|
-
}
|
|
496
|
-
return [
|
|
497
|
-
ensure.maxLineLength(input2, value),
|
|
498
|
-
`footer's lines must not be longer than ${value} characters`
|
|
499
|
-
];
|
|
500
|
-
};
|
|
501
|
-
var footerMinLength = (parsed, _when = void 0, value = 0) => {
|
|
502
|
-
if (!parsed.footer) {
|
|
503
|
-
return [true];
|
|
504
|
-
}
|
|
505
|
-
return [
|
|
506
|
-
ensure.minLength(parsed.footer, value),
|
|
507
|
-
`footer must not be shorter than ${value} characters`
|
|
508
|
-
];
|
|
509
|
-
};
|
|
510
|
-
var negated2 = (when) => when === "never";
|
|
511
|
-
var headerCase = (parsed, when = "always", value = []) => {
|
|
512
|
-
const { header } = parsed;
|
|
513
|
-
if (typeof header !== "string" || !header.match(/^[a-z]/i)) {
|
|
514
|
-
return [true];
|
|
515
|
-
}
|
|
516
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
517
|
-
if (typeof check === "string") {
|
|
518
|
-
return {
|
|
519
|
-
when: "always",
|
|
520
|
-
case: check
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
return check;
|
|
524
|
-
});
|
|
525
|
-
const result = checks.some((check) => {
|
|
526
|
-
const r = ensure.case(header, check.case);
|
|
527
|
-
return negated2(check.when) ? !r : r;
|
|
528
|
-
});
|
|
529
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
530
|
-
return [
|
|
531
|
-
negated2(when) ? !result : result,
|
|
532
|
-
message9__default.default([`header must`, negated2(when) ? `not` : null, `be ${list}`])
|
|
533
|
-
];
|
|
534
|
-
};
|
|
535
|
-
var headerFullStop = (parsed, when = "always", value = ".") => {
|
|
536
|
-
const { header } = parsed;
|
|
537
|
-
const negated6 = when === "never";
|
|
538
|
-
const hasStop = header?.[header.length - 1] === value;
|
|
539
|
-
return [
|
|
540
|
-
negated6 ? !hasStop : hasStop,
|
|
541
|
-
message9__default.default(["header", negated6 ? "may not" : "must", "end with full stop"])
|
|
542
|
-
];
|
|
543
|
-
};
|
|
544
|
-
var headerMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
545
|
-
return [
|
|
546
|
-
ensure.maxLength(parsed.header, value),
|
|
547
|
-
`header must not be longer than ${value} characters, current length is ${parsed.header?.length}`
|
|
548
|
-
];
|
|
549
|
-
};
|
|
550
|
-
var headerMinLength = (parsed, _when = void 0, value = 0) => {
|
|
551
|
-
return [
|
|
552
|
-
ensure.minLength(parsed.header, value),
|
|
553
|
-
`header must not be shorter than ${value} characters, current length is ${parsed.header?.length}`
|
|
554
|
-
];
|
|
555
|
-
};
|
|
556
|
-
var headerTrim = (parsed) => {
|
|
557
|
-
const { header } = parsed;
|
|
558
|
-
if (!header)
|
|
559
|
-
return [true];
|
|
560
|
-
const startsWithWhiteSpace = header.length > header.trimStart().length;
|
|
561
|
-
const endsWithWhiteSpace = header.length > header.trimEnd().length;
|
|
562
|
-
if (startsWithWhiteSpace && endsWithWhiteSpace)
|
|
563
|
-
return [false, message9__default.default(["header", "must not be surrounded by whitespace"])];
|
|
564
|
-
if (startsWithWhiteSpace)
|
|
565
|
-
return [false, message9__default.default(["header", "must not start with whitespace"])];
|
|
566
|
-
if (endsWithWhiteSpace)
|
|
567
|
-
return [false, message9__default.default(["header", "must not end with whitespace"])];
|
|
568
|
-
return [true];
|
|
569
|
-
};
|
|
570
|
-
var referencesEmpty = (parsed, when = "never") => {
|
|
571
|
-
const negated6 = when === "always";
|
|
572
|
-
const notEmpty6 = parsed.references.length > 0;
|
|
573
|
-
return [
|
|
574
|
-
negated6 ? !notEmpty6 : notEmpty6,
|
|
575
|
-
message9__default.default(["references", negated6 ? "must" : "may not", "be empty"])
|
|
576
|
-
];
|
|
577
|
-
};
|
|
578
|
-
var negated3 = (when) => when === "never";
|
|
579
|
-
var scopeCase = (parsed, when = "always", value = []) => {
|
|
580
|
-
const { scope } = parsed;
|
|
581
|
-
if (!scope) {
|
|
582
|
-
return [true];
|
|
583
|
-
}
|
|
584
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
585
|
-
if (typeof check === "string") {
|
|
586
|
-
return {
|
|
587
|
-
when: "always",
|
|
588
|
-
case: check
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
return check;
|
|
592
|
-
});
|
|
593
|
-
const delimiters = /\/|\\|, ?/g;
|
|
594
|
-
const scopeSegments = scope.split(delimiters);
|
|
595
|
-
const result = checks.some((check) => {
|
|
596
|
-
const r = scopeSegments.every((segment) => delimiters.test(segment) || ensure.case(segment, check.case));
|
|
597
|
-
return negated3(check.when) ? !r : r;
|
|
598
|
-
});
|
|
599
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
600
|
-
return [
|
|
601
|
-
negated3(when) ? !result : result,
|
|
602
|
-
message9__default.default([`scope must`, negated3(when) ? `not` : null, `be ${list}`])
|
|
603
|
-
];
|
|
604
|
-
};
|
|
605
|
-
var scopeEmpty = (parsed, when = "never") => {
|
|
606
|
-
const negated6 = when === "always";
|
|
607
|
-
const notEmpty6 = ensure__namespace.notEmpty(parsed.scope || "");
|
|
608
|
-
return [
|
|
609
|
-
negated6 ? !notEmpty6 : notEmpty6,
|
|
610
|
-
message9__default.default(["scope", negated6 ? "must" : "may not", "be empty"])
|
|
611
|
-
];
|
|
612
|
-
};
|
|
613
|
-
var scopeEnum = ({ scope }, when = "always", value = []) => {
|
|
614
|
-
if (!scope || !value.length) {
|
|
615
|
-
return [true, ""];
|
|
616
|
-
}
|
|
617
|
-
const delimiters = /\/|\\|, ?/g;
|
|
618
|
-
const messageScopes = scope.split(delimiters);
|
|
619
|
-
const errorMessage = ["scope must", `be one of [${value.join(", ")}]`];
|
|
620
|
-
const isScopeInEnum = (scope2) => ensure__namespace.enum(scope2, value);
|
|
621
|
-
let isValid;
|
|
622
|
-
if (when === "never") {
|
|
623
|
-
isValid = !messageScopes.some(isScopeInEnum) && !isScopeInEnum(scope);
|
|
624
|
-
errorMessage.splice(1, 0, "not");
|
|
625
|
-
} else {
|
|
626
|
-
isValid = messageScopes.every(isScopeInEnum) || isScopeInEnum(scope);
|
|
627
|
-
}
|
|
628
|
-
return [isValid, message9__default.default(errorMessage)];
|
|
629
|
-
};
|
|
630
|
-
var scopeMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
631
|
-
const input2 = parsed.scope;
|
|
632
|
-
if (!input2) {
|
|
633
|
-
return [true];
|
|
634
|
-
}
|
|
635
|
-
return [
|
|
636
|
-
ensure.maxLength(input2, value),
|
|
637
|
-
`scope must not be longer than ${value} characters`
|
|
638
|
-
];
|
|
639
|
-
};
|
|
640
|
-
var scopeMinLength = (parsed, _when = void 0, value = 0) => {
|
|
641
|
-
const input2 = parsed.scope;
|
|
642
|
-
if (!input2) {
|
|
643
|
-
return [true];
|
|
644
|
-
}
|
|
645
|
-
return [
|
|
646
|
-
ensure.minLength(input2, value),
|
|
647
|
-
`scope must not be shorter than ${value} characters`
|
|
648
|
-
];
|
|
649
|
-
};
|
|
650
|
-
var signedOffBy = (parsed, when = "always", value = "") => {
|
|
651
|
-
const lines = toLines2__default.default(parsed.raw).filter((ln) => (
|
|
652
|
-
// skip comments
|
|
653
|
-
!ln.startsWith("#") && // ignore empty lines
|
|
654
|
-
Boolean(ln)
|
|
655
|
-
));
|
|
656
|
-
const last = lines[lines.length - 1];
|
|
657
|
-
const negated6 = when === "never";
|
|
658
|
-
const hasSignedOffBy = (
|
|
659
|
-
// empty commit message
|
|
660
|
-
last ? last.startsWith(value) : false
|
|
661
|
-
);
|
|
662
|
-
return [
|
|
663
|
-
negated6 ? !hasSignedOffBy : hasSignedOffBy,
|
|
664
|
-
message9__default.default(["message", negated6 ? "must not" : "must", "be signed off"])
|
|
665
|
-
];
|
|
666
|
-
};
|
|
667
|
-
var startsWithLetterRegex = /^[\p{Ll}\p{Lu}\p{Lt}]/iu;
|
|
668
|
-
var negated4 = (when) => when === "never";
|
|
669
|
-
var subjectCase = (parsed, when = "always", value = []) => {
|
|
670
|
-
const { subject } = parsed;
|
|
671
|
-
if (typeof subject !== "string" || !subject.match(startsWithLetterRegex)) {
|
|
672
|
-
return [true];
|
|
673
|
-
}
|
|
674
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
675
|
-
if (typeof check === "string") {
|
|
676
|
-
return {
|
|
677
|
-
when: "always",
|
|
678
|
-
case: check
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
return check;
|
|
682
|
-
});
|
|
683
|
-
const result = checks.some((check) => {
|
|
684
|
-
const r = ensure.case(subject, check.case);
|
|
685
|
-
return negated4(check.when) ? !r : r;
|
|
686
|
-
});
|
|
687
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
688
|
-
return [
|
|
689
|
-
negated4(when) ? !result : result,
|
|
690
|
-
message9__default.default([`subject must`, negated4(when) ? `not` : null, `be ${list}`])
|
|
691
|
-
];
|
|
692
|
-
};
|
|
693
|
-
var subjectEmpty = (parsed, when = "always") => {
|
|
694
|
-
const negated6 = when === "never";
|
|
695
|
-
const notEmpty6 = ensure__namespace.notEmpty(parsed.subject || "");
|
|
696
|
-
return [
|
|
697
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
698
|
-
message9__default.default(["subject", negated6 ? "may not" : "must", "be empty"])
|
|
699
|
-
];
|
|
700
|
-
};
|
|
701
|
-
var subjectFullStop = (parsed, when = "always", value = ".") => {
|
|
702
|
-
const colonIndex = parsed.header?.indexOf(":") || 0;
|
|
703
|
-
if (colonIndex > 0 && colonIndex === parsed.header.length - 1) {
|
|
704
|
-
return [true];
|
|
705
|
-
}
|
|
706
|
-
const input2 = parsed.header;
|
|
707
|
-
const negated6 = when === "never";
|
|
708
|
-
let hasStop = input2?.[input2.length - 1] === value;
|
|
709
|
-
if (input2?.slice(-3) === "...") {
|
|
710
|
-
hasStop = false;
|
|
711
|
-
}
|
|
712
|
-
return [
|
|
713
|
-
negated6 ? !hasStop : hasStop,
|
|
714
|
-
message9__default.default(["subject", negated6 ? "may not" : "must", "end with full stop"])
|
|
715
|
-
];
|
|
716
|
-
};
|
|
717
|
-
var subjectMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
718
|
-
const input2 = parsed.subject;
|
|
719
|
-
if (!input2) {
|
|
720
|
-
return [true];
|
|
721
|
-
}
|
|
722
|
-
return [
|
|
723
|
-
ensure.maxLength(input2, value),
|
|
724
|
-
`subject must not be longer than ${value} characters`
|
|
725
|
-
];
|
|
726
|
-
};
|
|
727
|
-
var subjectMinLength = (parsed, _when = void 0, value = 0) => {
|
|
728
|
-
const input2 = parsed.subject;
|
|
729
|
-
if (!input2) {
|
|
730
|
-
return [true];
|
|
731
|
-
}
|
|
732
|
-
return [
|
|
733
|
-
ensure.minLength(input2, value),
|
|
734
|
-
`subject must not be shorter than ${value} characters`
|
|
735
|
-
];
|
|
736
|
-
};
|
|
737
|
-
var subjectExclamationMark = (parsed, when = "always") => {
|
|
738
|
-
const input2 = parsed.header;
|
|
739
|
-
if (!input2) {
|
|
740
|
-
return [true, ""];
|
|
741
|
-
}
|
|
742
|
-
const negated6 = when === "never";
|
|
743
|
-
const hasExclamationMark = /!:/.test(input2);
|
|
744
|
-
return [
|
|
745
|
-
negated6 ? !hasExclamationMark : hasExclamationMark,
|
|
746
|
-
message9__default.default([
|
|
747
|
-
"subject",
|
|
748
|
-
negated6 ? "must not" : "must",
|
|
749
|
-
"have an exclamation mark in the subject to identify a breaking change"
|
|
750
|
-
])
|
|
751
|
-
];
|
|
752
|
-
};
|
|
753
|
-
var trailerExists = (parsed, when = "always", value = "") => {
|
|
754
|
-
const trailers = childProcess.spawnSync("git", ["interpret-trailers", "--parse"], {
|
|
755
|
-
input: parsed.raw || ""
|
|
756
|
-
}).stdout;
|
|
757
|
-
const matches = toLines2__default.default(trailers.toString()).filter((ln) => ln.startsWith(value)).length;
|
|
758
|
-
const negated6 = when === "never";
|
|
759
|
-
const hasTrailer = matches > 0;
|
|
760
|
-
return [
|
|
761
|
-
negated6 ? !hasTrailer : hasTrailer,
|
|
762
|
-
message9__default.default([
|
|
763
|
-
"message",
|
|
764
|
-
negated6 ? "must not" : "must",
|
|
765
|
-
"have `" + value + "` trailer"
|
|
766
|
-
])
|
|
767
|
-
];
|
|
768
|
-
};
|
|
769
|
-
var negated5 = (when) => when === "never";
|
|
770
|
-
var typeCase = (parsed, when = "always", value = []) => {
|
|
771
|
-
const { type } = parsed;
|
|
772
|
-
if (!type) {
|
|
773
|
-
return [true];
|
|
774
|
-
}
|
|
775
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
776
|
-
if (typeof check === "string") {
|
|
777
|
-
return {
|
|
778
|
-
when: "always",
|
|
779
|
-
case: check
|
|
780
|
-
};
|
|
781
|
-
}
|
|
782
|
-
return check;
|
|
783
|
-
});
|
|
784
|
-
const result = checks.some((check) => {
|
|
785
|
-
const r = ensure.case(type, check.case);
|
|
786
|
-
return negated5(check.when) ? !r : r;
|
|
787
|
-
});
|
|
788
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
789
|
-
return [
|
|
790
|
-
negated5(when) ? !result : result,
|
|
791
|
-
message9__default.default([`type must`, negated5(when) ? `not` : null, `be ${list}`])
|
|
792
|
-
];
|
|
793
|
-
};
|
|
794
|
-
var typeEmpty = (parsed, when = "always") => {
|
|
795
|
-
const negated6 = when === "never";
|
|
796
|
-
const notEmpty6 = ensure__namespace.notEmpty(parsed.type || "");
|
|
797
|
-
return [
|
|
798
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
799
|
-
message9__default.default(["type", negated6 ? "may not" : "must", "be empty"])
|
|
800
|
-
];
|
|
801
|
-
};
|
|
802
|
-
var typeEnum = (parsed, when = "always", value = []) => {
|
|
803
|
-
const { type: input2 } = parsed;
|
|
804
|
-
if (!input2) {
|
|
805
|
-
return [true];
|
|
806
|
-
}
|
|
807
|
-
const negated6 = when === "never";
|
|
808
|
-
const result = ensure__namespace.enum(input2, value);
|
|
809
|
-
return [
|
|
810
|
-
negated6 ? !result : result,
|
|
811
|
-
message9__default.default([
|
|
812
|
-
`type must`,
|
|
813
|
-
negated6 ? `not` : null,
|
|
814
|
-
`be one of [${value.join(", ")}]`
|
|
815
|
-
])
|
|
816
|
-
];
|
|
817
|
-
};
|
|
818
|
-
var typeMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
819
|
-
const input2 = parsed.type;
|
|
820
|
-
if (!input2) {
|
|
821
|
-
return [true];
|
|
822
|
-
}
|
|
823
|
-
return [
|
|
824
|
-
ensure.maxLength(input2, value),
|
|
825
|
-
`type must not be longer than ${value} characters`
|
|
826
|
-
];
|
|
827
|
-
};
|
|
828
|
-
var typeMinLength = (parsed, _when = void 0, value = 0) => {
|
|
829
|
-
const input2 = parsed.type;
|
|
830
|
-
if (!input2) {
|
|
831
|
-
return [true];
|
|
832
|
-
}
|
|
833
|
-
return [
|
|
834
|
-
ensure.minLength(input2, value),
|
|
835
|
-
`type must not be shorter than ${value} characters`
|
|
836
|
-
];
|
|
837
|
-
};
|
|
838
|
-
|
|
839
|
-
// ../../node_modules/.pnpm/@commitlint+rules@19.8.1/node_modules/@commitlint/rules/lib/index.js
|
|
840
|
-
var lib_default = {
|
|
841
|
-
"body-case": bodyCase,
|
|
842
|
-
"body-empty": bodyEmpty,
|
|
843
|
-
"body-full-stop": bodyFullStop,
|
|
844
|
-
"body-leading-blank": bodyLeadingBlank,
|
|
845
|
-
"body-max-length": bodyMaxLength,
|
|
846
|
-
"body-max-line-length": bodyMaxLineLength,
|
|
847
|
-
"body-min-length": bodyMinLength,
|
|
848
|
-
"footer-empty": footerEmpty,
|
|
849
|
-
"footer-leading-blank": footerLeadingBlank,
|
|
850
|
-
"footer-max-length": footerMaxLength,
|
|
851
|
-
"footer-max-line-length": footerMaxLineLength,
|
|
852
|
-
"footer-min-length": footerMinLength,
|
|
853
|
-
"header-case": headerCase,
|
|
854
|
-
"header-full-stop": headerFullStop,
|
|
855
|
-
"header-max-length": headerMaxLength,
|
|
856
|
-
"header-min-length": headerMinLength,
|
|
857
|
-
"header-trim": headerTrim,
|
|
858
|
-
"references-empty": referencesEmpty,
|
|
859
|
-
"scope-case": scopeCase,
|
|
860
|
-
"scope-empty": scopeEmpty,
|
|
861
|
-
"scope-enum": scopeEnum,
|
|
862
|
-
"scope-max-length": scopeMaxLength,
|
|
863
|
-
"scope-min-length": scopeMinLength,
|
|
864
|
-
"signed-off-by": signedOffBy,
|
|
865
|
-
"subject-case": subjectCase,
|
|
866
|
-
"subject-empty": subjectEmpty,
|
|
867
|
-
"subject-full-stop": subjectFullStop,
|
|
868
|
-
"subject-max-length": subjectMaxLength,
|
|
869
|
-
"subject-min-length": subjectMinLength,
|
|
870
|
-
"subject-exclamation-mark": subjectExclamationMark,
|
|
871
|
-
"trailer-exists": trailerExists,
|
|
872
|
-
"type-case": typeCase,
|
|
873
|
-
"type-empty": typeEmpty,
|
|
874
|
-
"type-enum": typeEnum,
|
|
875
|
-
"type-max-length": typeMaxLength,
|
|
876
|
-
"type-min-length": typeMinLength
|
|
877
|
-
};
|
|
878
346
|
|
|
879
347
|
// ../../node_modules/.pnpm/conventional-commits-parser@6.2.0/node_modules/conventional-commits-parser/dist/regex.js
|
|
880
348
|
var nomatchRegex = /(?!.*)/;
|
|
@@ -1282,30 +750,30 @@ var buildCommitMessage = ({
|
|
|
1282
750
|
body,
|
|
1283
751
|
footer
|
|
1284
752
|
}) => {
|
|
1285
|
-
let
|
|
1286
|
-
|
|
753
|
+
let message = header;
|
|
754
|
+
message = body ? `${message}
|
|
1287
755
|
|
|
1288
|
-
${body}` :
|
|
1289
|
-
|
|
756
|
+
${body}` : message;
|
|
757
|
+
message = footer ? `${message}
|
|
1290
758
|
|
|
1291
|
-
${footer}` :
|
|
1292
|
-
return
|
|
759
|
+
${footer}` : message;
|
|
760
|
+
return message || "";
|
|
1293
761
|
};
|
|
1294
|
-
async function lint(
|
|
762
|
+
async function lint(message, rawRulesConfig, rawOpts) {
|
|
1295
763
|
const rulesConfig = rawRulesConfig || {};
|
|
1296
764
|
const parser = new CommitParser(
|
|
1297
765
|
rawOpts?.parserOpts ?? DEFAULT_COMMITLINT_CONFIG.parserOpts
|
|
1298
766
|
);
|
|
1299
|
-
const parsed = parser.parse(
|
|
767
|
+
const parsed = parser.parse(message);
|
|
1300
768
|
if (parsed.header === null && parsed.body === null && parsed.footer === null) {
|
|
1301
769
|
return {
|
|
1302
770
|
valid: true,
|
|
1303
771
|
errors: [],
|
|
1304
772
|
warnings: [],
|
|
1305
|
-
input:
|
|
773
|
+
input: message
|
|
1306
774
|
};
|
|
1307
775
|
}
|
|
1308
|
-
const allRules = new Map(Object.entries(
|
|
776
|
+
const allRules = new Map(Object.entries(defaultRules__default.default));
|
|
1309
777
|
const missing = Object.keys(rulesConfig).filter(
|
|
1310
778
|
(name) => typeof allRules.get(name) !== "function"
|
|
1311
779
|
);
|
|
@@ -1379,12 +847,12 @@ async function lint(message23, rawRulesConfig, rawOpts) {
|
|
|
1379
847
|
throw new Error(`Could not find rule implementation for ${name}`);
|
|
1380
848
|
}
|
|
1381
849
|
const executableRule = rule;
|
|
1382
|
-
const [valid3,
|
|
850
|
+
const [valid3, message2] = await executableRule(parsed, when, value);
|
|
1383
851
|
return {
|
|
1384
852
|
level,
|
|
1385
853
|
valid: valid3,
|
|
1386
854
|
name,
|
|
1387
|
-
message:
|
|
855
|
+
message: message2
|
|
1388
856
|
};
|
|
1389
857
|
});
|
|
1390
858
|
const results = (await Promise.all(pendingResults)).filter(
|
|
@@ -1433,14 +901,14 @@ function getScopeEnumUtil(context) {
|
|
|
1433
901
|
function getScopeEnum(context) {
|
|
1434
902
|
return getNxScopes(context);
|
|
1435
903
|
}
|
|
1436
|
-
function getRuleFromScopeEnum(
|
|
1437
|
-
if (!
|
|
904
|
+
function getRuleFromScopeEnum(scopeEnum) {
|
|
905
|
+
if (!scopeEnum?.filter(Boolean).length) {
|
|
1438
906
|
throw new Error("No scopes found in the Storm workspace.");
|
|
1439
907
|
}
|
|
1440
908
|
return [
|
|
1441
909
|
2 /* Error */,
|
|
1442
910
|
"always",
|
|
1443
|
-
|
|
911
|
+
scopeEnum.filter(Boolean)
|
|
1444
912
|
];
|
|
1445
913
|
}
|
|
1446
914
|
|
|
@@ -1737,16 +1205,16 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1737
1205
|
{#CCCCCC Please provide the requested details below...}
|
|
1738
1206
|
`);
|
|
1739
1207
|
state.answers = await askQuestions(state);
|
|
1740
|
-
const
|
|
1208
|
+
const message = formatCommitMessage(state);
|
|
1741
1209
|
const commitMsgFile = chunkDDGJVTT5_cjs.joinPaths(getGitDir(), "COMMIT_EDITMSG");
|
|
1742
1210
|
console.log(chalkTemplate__default.default`
|
|
1743
1211
|
{bold.#999999 ----------------------------------------}
|
|
1744
1212
|
|
|
1745
|
-
{bold.#FFFFFF Commit message} - {#DDDDDD ${
|
|
1213
|
+
{bold.#FFFFFF Commit message} - {#DDDDDD ${message}}
|
|
1746
1214
|
{bold.#FFFFFF Git-Commit File} - {#DDDDDD ${commitMsgFile}}
|
|
1747
1215
|
|
|
1748
1216
|
`);
|
|
1749
|
-
await runCommitLint(config, { message
|
|
1217
|
+
await runCommitLint(config, { message });
|
|
1750
1218
|
const commandItems = ["git", "commit", "-S"];
|
|
1751
1219
|
commandItems.push(...["--file", commitMsgFile]);
|
|
1752
1220
|
const command = shellescape__default.default(commandItems);
|
|
@@ -1755,9 +1223,9 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1755
1223
|
`Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
|
|
1756
1224
|
config
|
|
1757
1225
|
);
|
|
1758
|
-
chunkDDGJVTT5_cjs.writeDebug(`Message [dry-run]: ${
|
|
1226
|
+
chunkDDGJVTT5_cjs.writeDebug(`Message [dry-run]: ${message}`, config);
|
|
1759
1227
|
} else {
|
|
1760
|
-
await fs__default.default.writeFile(commitMsgFile,
|
|
1228
|
+
await fs__default.default.writeFile(commitMsgFile, message);
|
|
1761
1229
|
chunkCIJVSMK2_cjs.run(config, command);
|
|
1762
1230
|
}
|
|
1763
1231
|
};
|
|
@@ -1775,11 +1243,11 @@ var askQuestions = async (state) => {
|
|
|
1775
1243
|
return state.answers;
|
|
1776
1244
|
};
|
|
1777
1245
|
var askQuestion = (index, question) => {
|
|
1778
|
-
const
|
|
1246
|
+
const message = chalkTemplate__default.default`{bold ${index + 1}. ${question.title}} - ${question.description}
|
|
1779
1247
|
`;
|
|
1780
1248
|
if (question.type === "select" && question.enum && Object.keys(question.enum).length > 1) {
|
|
1781
1249
|
return prompts.select({
|
|
1782
|
-
message
|
|
1250
|
+
message,
|
|
1783
1251
|
choices: Object.keys(question.enum).filter((key) => !question.enum?.[key]?.hidden).map((key) => ({
|
|
1784
1252
|
name: question.enum?.[key]?.title || key,
|
|
1785
1253
|
value: key,
|
|
@@ -1789,7 +1257,7 @@ var askQuestion = (index, question) => {
|
|
|
1789
1257
|
});
|
|
1790
1258
|
} else if (question.type === "confirm") {
|
|
1791
1259
|
return prompts.confirm({
|
|
1792
|
-
message
|
|
1260
|
+
message,
|
|
1793
1261
|
default: Boolean(question.defaultValue)
|
|
1794
1262
|
});
|
|
1795
1263
|
} else {
|
|
@@ -1806,7 +1274,7 @@ var askQuestion = (index, question) => {
|
|
|
1806
1274
|
};
|
|
1807
1275
|
}
|
|
1808
1276
|
return prompts.input({
|
|
1809
|
-
message
|
|
1277
|
+
message,
|
|
1810
1278
|
required: !!(question.minLength !== void 0 && question.minLength > 0),
|
|
1811
1279
|
default: String(question.defaultValue || ""),
|
|
1812
1280
|
validate
|
|
@@ -2857,7 +2325,7 @@ function parseChangelogMarkdown(contents) {
|
|
|
2857
2325
|
}
|
|
2858
2326
|
async function gitTag({
|
|
2859
2327
|
tag,
|
|
2860
|
-
message
|
|
2328
|
+
message,
|
|
2861
2329
|
additionalArgs,
|
|
2862
2330
|
dryRun,
|
|
2863
2331
|
verbose,
|
|
@@ -2871,7 +2339,7 @@ async function gitTag({
|
|
|
2871
2339
|
"--sign",
|
|
2872
2340
|
tag,
|
|
2873
2341
|
"--message",
|
|
2874
|
-
|
|
2342
|
+
message || tag
|
|
2875
2343
|
];
|
|
2876
2344
|
if (additionalArgs) {
|
|
2877
2345
|
if (Array.isArray(additionalArgs)) {
|
|
@@ -2906,8 +2374,8 @@ async function gitCommit({
|
|
|
2906
2374
|
}) {
|
|
2907
2375
|
logFn = logFn || console.log;
|
|
2908
2376
|
const commandArgs = ["commit", "-S"];
|
|
2909
|
-
for (const
|
|
2910
|
-
commandArgs.push("--message",
|
|
2377
|
+
for (const message of messages) {
|
|
2378
|
+
commandArgs.push("--message", message);
|
|
2911
2379
|
}
|
|
2912
2380
|
if (additionalArgs) {
|
|
2913
2381
|
if (Array.isArray(additionalArgs)) {
|
|
@@ -4941,7 +4409,7 @@ Stacktrace: ${error.stack}` : ""}`,
|
|
|
4941
4409
|
}
|
|
4942
4410
|
async function commitLintAction({
|
|
4943
4411
|
config,
|
|
4944
|
-
message
|
|
4412
|
+
message,
|
|
4945
4413
|
file
|
|
4946
4414
|
}) {
|
|
4947
4415
|
try {
|
|
@@ -4951,7 +4419,7 @@ async function commitLintAction({
|
|
|
4951
4419
|
);
|
|
4952
4420
|
await runCommitLint(_config, {
|
|
4953
4421
|
config,
|
|
4954
|
-
message
|
|
4422
|
+
message,
|
|
4955
4423
|
file
|
|
4956
4424
|
});
|
|
4957
4425
|
chunkDDGJVTT5_cjs.writeSuccess(
|