@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.js
CHANGED
|
@@ -9,11 +9,8 @@ import chalkTemplate from 'chalk-template';
|
|
|
9
9
|
import fs, { readFile as readFile$1, writeFile } from 'node:fs/promises';
|
|
10
10
|
import { existsSync } from 'fs';
|
|
11
11
|
import { readFile } from 'fs/promises';
|
|
12
|
-
import childProcess, { execSync
|
|
13
|
-
import
|
|
14
|
-
import { minLength, maxLength, case as _case, maxLineLength } from '@commitlint/ensure';
|
|
15
|
-
import message9 from '@commitlint/message';
|
|
16
|
-
import toLines2 from '@commitlint/to-lines';
|
|
12
|
+
import childProcess, { execSync } from 'node:child_process';
|
|
13
|
+
import defaultRules from '@commitlint/rules';
|
|
17
14
|
import 'stream';
|
|
18
15
|
import util from 'util';
|
|
19
16
|
import { readCachedProjectGraph, createProjectGraphAsync as createProjectGraphAsync$1, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph$1 } from 'nx/src/project-graph/project-graph';
|
|
@@ -329,516 +326,6 @@ var DEFAULT_COMMITLINT_CONFIG = {
|
|
|
329
326
|
issuePrefixes: ["#"]
|
|
330
327
|
}
|
|
331
328
|
};
|
|
332
|
-
var negated = (when) => when === "never";
|
|
333
|
-
var bodyCase = (parsed, when = "always", value = []) => {
|
|
334
|
-
const { body } = parsed;
|
|
335
|
-
if (!body) {
|
|
336
|
-
return [true];
|
|
337
|
-
}
|
|
338
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
339
|
-
if (typeof check === "string") {
|
|
340
|
-
return {
|
|
341
|
-
when: "always",
|
|
342
|
-
case: check
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
return check;
|
|
346
|
-
});
|
|
347
|
-
const result = checks.some((check) => {
|
|
348
|
-
const r = _case(body, check.case);
|
|
349
|
-
return negated(check.when) ? !r : r;
|
|
350
|
-
});
|
|
351
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
352
|
-
return [
|
|
353
|
-
negated(when) ? !result : result,
|
|
354
|
-
message9([`body must`, negated(when) ? `not` : null, `be ${list}`])
|
|
355
|
-
];
|
|
356
|
-
};
|
|
357
|
-
var bodyEmpty = (parsed, when = "always") => {
|
|
358
|
-
const negated6 = when === "never";
|
|
359
|
-
const notEmpty6 = ensure.notEmpty(parsed.body || "");
|
|
360
|
-
return [
|
|
361
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
362
|
-
message9(["body", negated6 ? "may not" : "must", "be empty"])
|
|
363
|
-
];
|
|
364
|
-
};
|
|
365
|
-
var bodyFullStop = (parsed, when = "always", value = ".") => {
|
|
366
|
-
const input2 = parsed.body;
|
|
367
|
-
if (!input2) {
|
|
368
|
-
return [true];
|
|
369
|
-
}
|
|
370
|
-
const negated6 = when === "never";
|
|
371
|
-
const hasStop = input2[input2.length - 1] === value;
|
|
372
|
-
return [
|
|
373
|
-
negated6 ? !hasStop : hasStop,
|
|
374
|
-
message9(["body", negated6 ? "may not" : "must", "end with full stop"])
|
|
375
|
-
];
|
|
376
|
-
};
|
|
377
|
-
var bodyLeadingBlank = (parsed, when) => {
|
|
378
|
-
if (!parsed.body) {
|
|
379
|
-
return [true];
|
|
380
|
-
}
|
|
381
|
-
const negated6 = when === "never";
|
|
382
|
-
const [leading] = toLines2(parsed.raw).slice(1);
|
|
383
|
-
const succeeds = leading === "";
|
|
384
|
-
return [
|
|
385
|
-
negated6 ? !succeeds : succeeds,
|
|
386
|
-
message9(["body", negated6 ? "may not" : "must", "have leading blank line"])
|
|
387
|
-
];
|
|
388
|
-
};
|
|
389
|
-
var bodyMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
390
|
-
const input2 = parsed.body;
|
|
391
|
-
if (!input2) {
|
|
392
|
-
return [true];
|
|
393
|
-
}
|
|
394
|
-
return [
|
|
395
|
-
maxLength(input2, value),
|
|
396
|
-
`body must not be longer than ${value} characters`
|
|
397
|
-
];
|
|
398
|
-
};
|
|
399
|
-
var bodyMaxLineLength = (parsed, _when = void 0, value = 0) => {
|
|
400
|
-
const input2 = parsed.body;
|
|
401
|
-
if (!input2) {
|
|
402
|
-
return [true];
|
|
403
|
-
}
|
|
404
|
-
return [
|
|
405
|
-
maxLineLength(input2, value),
|
|
406
|
-
`body's lines must not be longer than ${value} characters`
|
|
407
|
-
];
|
|
408
|
-
};
|
|
409
|
-
var bodyMinLength = (parsed, _when = void 0, value = 0) => {
|
|
410
|
-
if (!parsed.body) {
|
|
411
|
-
return [true];
|
|
412
|
-
}
|
|
413
|
-
return [
|
|
414
|
-
minLength(parsed.body, value),
|
|
415
|
-
`body must not be shorter than ${value} characters`
|
|
416
|
-
];
|
|
417
|
-
};
|
|
418
|
-
var footerEmpty = (parsed, when = "always") => {
|
|
419
|
-
const negated6 = when === "never";
|
|
420
|
-
const notEmpty6 = ensure.notEmpty(parsed.footer || "");
|
|
421
|
-
return [
|
|
422
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
423
|
-
message9(["footer", negated6 ? "may not" : "must", "be empty"])
|
|
424
|
-
];
|
|
425
|
-
};
|
|
426
|
-
var footerLeadingBlank = (parsed, when = "always") => {
|
|
427
|
-
if (!parsed.footer) {
|
|
428
|
-
return [true];
|
|
429
|
-
}
|
|
430
|
-
const negated6 = when === "never";
|
|
431
|
-
const rawLines = toLines2(parsed.raw);
|
|
432
|
-
const footerLines = toLines2(parsed.footer);
|
|
433
|
-
const footerOffset = rawLines.indexOf(footerLines[0]);
|
|
434
|
-
const [leading] = rawLines.slice(footerOffset - 1);
|
|
435
|
-
const succeeds = leading === "";
|
|
436
|
-
return [
|
|
437
|
-
negated6 ? !succeeds : succeeds,
|
|
438
|
-
message9([
|
|
439
|
-
"footer",
|
|
440
|
-
negated6 ? "may not" : "must",
|
|
441
|
-
"have leading blank line"
|
|
442
|
-
])
|
|
443
|
-
];
|
|
444
|
-
};
|
|
445
|
-
var footerMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
446
|
-
const input2 = parsed.footer;
|
|
447
|
-
if (!input2) {
|
|
448
|
-
return [true];
|
|
449
|
-
}
|
|
450
|
-
return [
|
|
451
|
-
maxLength(input2, value),
|
|
452
|
-
`footer must not be longer than ${value} characters`
|
|
453
|
-
];
|
|
454
|
-
};
|
|
455
|
-
var footerMaxLineLength = (parsed, _when = void 0, value = 0) => {
|
|
456
|
-
const input2 = parsed.footer;
|
|
457
|
-
if (!input2) {
|
|
458
|
-
return [true];
|
|
459
|
-
}
|
|
460
|
-
return [
|
|
461
|
-
maxLineLength(input2, value),
|
|
462
|
-
`footer's lines must not be longer than ${value} characters`
|
|
463
|
-
];
|
|
464
|
-
};
|
|
465
|
-
var footerMinLength = (parsed, _when = void 0, value = 0) => {
|
|
466
|
-
if (!parsed.footer) {
|
|
467
|
-
return [true];
|
|
468
|
-
}
|
|
469
|
-
return [
|
|
470
|
-
minLength(parsed.footer, value),
|
|
471
|
-
`footer must not be shorter than ${value} characters`
|
|
472
|
-
];
|
|
473
|
-
};
|
|
474
|
-
var negated2 = (when) => when === "never";
|
|
475
|
-
var headerCase = (parsed, when = "always", value = []) => {
|
|
476
|
-
const { header } = parsed;
|
|
477
|
-
if (typeof header !== "string" || !header.match(/^[a-z]/i)) {
|
|
478
|
-
return [true];
|
|
479
|
-
}
|
|
480
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
481
|
-
if (typeof check === "string") {
|
|
482
|
-
return {
|
|
483
|
-
when: "always",
|
|
484
|
-
case: check
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
return check;
|
|
488
|
-
});
|
|
489
|
-
const result = checks.some((check) => {
|
|
490
|
-
const r = _case(header, check.case);
|
|
491
|
-
return negated2(check.when) ? !r : r;
|
|
492
|
-
});
|
|
493
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
494
|
-
return [
|
|
495
|
-
negated2(when) ? !result : result,
|
|
496
|
-
message9([`header must`, negated2(when) ? `not` : null, `be ${list}`])
|
|
497
|
-
];
|
|
498
|
-
};
|
|
499
|
-
var headerFullStop = (parsed, when = "always", value = ".") => {
|
|
500
|
-
const { header } = parsed;
|
|
501
|
-
const negated6 = when === "never";
|
|
502
|
-
const hasStop = header?.[header.length - 1] === value;
|
|
503
|
-
return [
|
|
504
|
-
negated6 ? !hasStop : hasStop,
|
|
505
|
-
message9(["header", negated6 ? "may not" : "must", "end with full stop"])
|
|
506
|
-
];
|
|
507
|
-
};
|
|
508
|
-
var headerMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
509
|
-
return [
|
|
510
|
-
maxLength(parsed.header, value),
|
|
511
|
-
`header must not be longer than ${value} characters, current length is ${parsed.header?.length}`
|
|
512
|
-
];
|
|
513
|
-
};
|
|
514
|
-
var headerMinLength = (parsed, _when = void 0, value = 0) => {
|
|
515
|
-
return [
|
|
516
|
-
minLength(parsed.header, value),
|
|
517
|
-
`header must not be shorter than ${value} characters, current length is ${parsed.header?.length}`
|
|
518
|
-
];
|
|
519
|
-
};
|
|
520
|
-
var headerTrim = (parsed) => {
|
|
521
|
-
const { header } = parsed;
|
|
522
|
-
if (!header)
|
|
523
|
-
return [true];
|
|
524
|
-
const startsWithWhiteSpace = header.length > header.trimStart().length;
|
|
525
|
-
const endsWithWhiteSpace = header.length > header.trimEnd().length;
|
|
526
|
-
if (startsWithWhiteSpace && endsWithWhiteSpace)
|
|
527
|
-
return [false, message9(["header", "must not be surrounded by whitespace"])];
|
|
528
|
-
if (startsWithWhiteSpace)
|
|
529
|
-
return [false, message9(["header", "must not start with whitespace"])];
|
|
530
|
-
if (endsWithWhiteSpace)
|
|
531
|
-
return [false, message9(["header", "must not end with whitespace"])];
|
|
532
|
-
return [true];
|
|
533
|
-
};
|
|
534
|
-
var referencesEmpty = (parsed, when = "never") => {
|
|
535
|
-
const negated6 = when === "always";
|
|
536
|
-
const notEmpty6 = parsed.references.length > 0;
|
|
537
|
-
return [
|
|
538
|
-
negated6 ? !notEmpty6 : notEmpty6,
|
|
539
|
-
message9(["references", negated6 ? "must" : "may not", "be empty"])
|
|
540
|
-
];
|
|
541
|
-
};
|
|
542
|
-
var negated3 = (when) => when === "never";
|
|
543
|
-
var scopeCase = (parsed, when = "always", value = []) => {
|
|
544
|
-
const { scope } = parsed;
|
|
545
|
-
if (!scope) {
|
|
546
|
-
return [true];
|
|
547
|
-
}
|
|
548
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
549
|
-
if (typeof check === "string") {
|
|
550
|
-
return {
|
|
551
|
-
when: "always",
|
|
552
|
-
case: check
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
return check;
|
|
556
|
-
});
|
|
557
|
-
const delimiters = /\/|\\|, ?/g;
|
|
558
|
-
const scopeSegments = scope.split(delimiters);
|
|
559
|
-
const result = checks.some((check) => {
|
|
560
|
-
const r = scopeSegments.every((segment) => delimiters.test(segment) || _case(segment, check.case));
|
|
561
|
-
return negated3(check.when) ? !r : r;
|
|
562
|
-
});
|
|
563
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
564
|
-
return [
|
|
565
|
-
negated3(when) ? !result : result,
|
|
566
|
-
message9([`scope must`, negated3(when) ? `not` : null, `be ${list}`])
|
|
567
|
-
];
|
|
568
|
-
};
|
|
569
|
-
var scopeEmpty = (parsed, when = "never") => {
|
|
570
|
-
const negated6 = when === "always";
|
|
571
|
-
const notEmpty6 = ensure.notEmpty(parsed.scope || "");
|
|
572
|
-
return [
|
|
573
|
-
negated6 ? !notEmpty6 : notEmpty6,
|
|
574
|
-
message9(["scope", negated6 ? "must" : "may not", "be empty"])
|
|
575
|
-
];
|
|
576
|
-
};
|
|
577
|
-
var scopeEnum = ({ scope }, when = "always", value = []) => {
|
|
578
|
-
if (!scope || !value.length) {
|
|
579
|
-
return [true, ""];
|
|
580
|
-
}
|
|
581
|
-
const delimiters = /\/|\\|, ?/g;
|
|
582
|
-
const messageScopes = scope.split(delimiters);
|
|
583
|
-
const errorMessage = ["scope must", `be one of [${value.join(", ")}]`];
|
|
584
|
-
const isScopeInEnum = (scope2) => ensure.enum(scope2, value);
|
|
585
|
-
let isValid;
|
|
586
|
-
if (when === "never") {
|
|
587
|
-
isValid = !messageScopes.some(isScopeInEnum) && !isScopeInEnum(scope);
|
|
588
|
-
errorMessage.splice(1, 0, "not");
|
|
589
|
-
} else {
|
|
590
|
-
isValid = messageScopes.every(isScopeInEnum) || isScopeInEnum(scope);
|
|
591
|
-
}
|
|
592
|
-
return [isValid, message9(errorMessage)];
|
|
593
|
-
};
|
|
594
|
-
var scopeMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
595
|
-
const input2 = parsed.scope;
|
|
596
|
-
if (!input2) {
|
|
597
|
-
return [true];
|
|
598
|
-
}
|
|
599
|
-
return [
|
|
600
|
-
maxLength(input2, value),
|
|
601
|
-
`scope must not be longer than ${value} characters`
|
|
602
|
-
];
|
|
603
|
-
};
|
|
604
|
-
var scopeMinLength = (parsed, _when = void 0, value = 0) => {
|
|
605
|
-
const input2 = parsed.scope;
|
|
606
|
-
if (!input2) {
|
|
607
|
-
return [true];
|
|
608
|
-
}
|
|
609
|
-
return [
|
|
610
|
-
minLength(input2, value),
|
|
611
|
-
`scope must not be shorter than ${value} characters`
|
|
612
|
-
];
|
|
613
|
-
};
|
|
614
|
-
var signedOffBy = (parsed, when = "always", value = "") => {
|
|
615
|
-
const lines = toLines2(parsed.raw).filter((ln) => (
|
|
616
|
-
// skip comments
|
|
617
|
-
!ln.startsWith("#") && // ignore empty lines
|
|
618
|
-
Boolean(ln)
|
|
619
|
-
));
|
|
620
|
-
const last = lines[lines.length - 1];
|
|
621
|
-
const negated6 = when === "never";
|
|
622
|
-
const hasSignedOffBy = (
|
|
623
|
-
// empty commit message
|
|
624
|
-
last ? last.startsWith(value) : false
|
|
625
|
-
);
|
|
626
|
-
return [
|
|
627
|
-
negated6 ? !hasSignedOffBy : hasSignedOffBy,
|
|
628
|
-
message9(["message", negated6 ? "must not" : "must", "be signed off"])
|
|
629
|
-
];
|
|
630
|
-
};
|
|
631
|
-
var startsWithLetterRegex = /^[\p{Ll}\p{Lu}\p{Lt}]/iu;
|
|
632
|
-
var negated4 = (when) => when === "never";
|
|
633
|
-
var subjectCase = (parsed, when = "always", value = []) => {
|
|
634
|
-
const { subject } = parsed;
|
|
635
|
-
if (typeof subject !== "string" || !subject.match(startsWithLetterRegex)) {
|
|
636
|
-
return [true];
|
|
637
|
-
}
|
|
638
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
639
|
-
if (typeof check === "string") {
|
|
640
|
-
return {
|
|
641
|
-
when: "always",
|
|
642
|
-
case: check
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
return check;
|
|
646
|
-
});
|
|
647
|
-
const result = checks.some((check) => {
|
|
648
|
-
const r = _case(subject, check.case);
|
|
649
|
-
return negated4(check.when) ? !r : r;
|
|
650
|
-
});
|
|
651
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
652
|
-
return [
|
|
653
|
-
negated4(when) ? !result : result,
|
|
654
|
-
message9([`subject must`, negated4(when) ? `not` : null, `be ${list}`])
|
|
655
|
-
];
|
|
656
|
-
};
|
|
657
|
-
var subjectEmpty = (parsed, when = "always") => {
|
|
658
|
-
const negated6 = when === "never";
|
|
659
|
-
const notEmpty6 = ensure.notEmpty(parsed.subject || "");
|
|
660
|
-
return [
|
|
661
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
662
|
-
message9(["subject", negated6 ? "may not" : "must", "be empty"])
|
|
663
|
-
];
|
|
664
|
-
};
|
|
665
|
-
var subjectFullStop = (parsed, when = "always", value = ".") => {
|
|
666
|
-
const colonIndex = parsed.header?.indexOf(":") || 0;
|
|
667
|
-
if (colonIndex > 0 && colonIndex === parsed.header.length - 1) {
|
|
668
|
-
return [true];
|
|
669
|
-
}
|
|
670
|
-
const input2 = parsed.header;
|
|
671
|
-
const negated6 = when === "never";
|
|
672
|
-
let hasStop = input2?.[input2.length - 1] === value;
|
|
673
|
-
if (input2?.slice(-3) === "...") {
|
|
674
|
-
hasStop = false;
|
|
675
|
-
}
|
|
676
|
-
return [
|
|
677
|
-
negated6 ? !hasStop : hasStop,
|
|
678
|
-
message9(["subject", negated6 ? "may not" : "must", "end with full stop"])
|
|
679
|
-
];
|
|
680
|
-
};
|
|
681
|
-
var subjectMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
682
|
-
const input2 = parsed.subject;
|
|
683
|
-
if (!input2) {
|
|
684
|
-
return [true];
|
|
685
|
-
}
|
|
686
|
-
return [
|
|
687
|
-
maxLength(input2, value),
|
|
688
|
-
`subject must not be longer than ${value} characters`
|
|
689
|
-
];
|
|
690
|
-
};
|
|
691
|
-
var subjectMinLength = (parsed, _when = void 0, value = 0) => {
|
|
692
|
-
const input2 = parsed.subject;
|
|
693
|
-
if (!input2) {
|
|
694
|
-
return [true];
|
|
695
|
-
}
|
|
696
|
-
return [
|
|
697
|
-
minLength(input2, value),
|
|
698
|
-
`subject must not be shorter than ${value} characters`
|
|
699
|
-
];
|
|
700
|
-
};
|
|
701
|
-
var subjectExclamationMark = (parsed, when = "always") => {
|
|
702
|
-
const input2 = parsed.header;
|
|
703
|
-
if (!input2) {
|
|
704
|
-
return [true, ""];
|
|
705
|
-
}
|
|
706
|
-
const negated6 = when === "never";
|
|
707
|
-
const hasExclamationMark = /!:/.test(input2);
|
|
708
|
-
return [
|
|
709
|
-
negated6 ? !hasExclamationMark : hasExclamationMark,
|
|
710
|
-
message9([
|
|
711
|
-
"subject",
|
|
712
|
-
negated6 ? "must not" : "must",
|
|
713
|
-
"have an exclamation mark in the subject to identify a breaking change"
|
|
714
|
-
])
|
|
715
|
-
];
|
|
716
|
-
};
|
|
717
|
-
var trailerExists = (parsed, when = "always", value = "") => {
|
|
718
|
-
const trailers = spawnSync("git", ["interpret-trailers", "--parse"], {
|
|
719
|
-
input: parsed.raw || ""
|
|
720
|
-
}).stdout;
|
|
721
|
-
const matches = toLines2(trailers.toString()).filter((ln) => ln.startsWith(value)).length;
|
|
722
|
-
const negated6 = when === "never";
|
|
723
|
-
const hasTrailer = matches > 0;
|
|
724
|
-
return [
|
|
725
|
-
negated6 ? !hasTrailer : hasTrailer,
|
|
726
|
-
message9([
|
|
727
|
-
"message",
|
|
728
|
-
negated6 ? "must not" : "must",
|
|
729
|
-
"have `" + value + "` trailer"
|
|
730
|
-
])
|
|
731
|
-
];
|
|
732
|
-
};
|
|
733
|
-
var negated5 = (when) => when === "never";
|
|
734
|
-
var typeCase = (parsed, when = "always", value = []) => {
|
|
735
|
-
const { type } = parsed;
|
|
736
|
-
if (!type) {
|
|
737
|
-
return [true];
|
|
738
|
-
}
|
|
739
|
-
const checks = (Array.isArray(value) ? value : [value]).map((check) => {
|
|
740
|
-
if (typeof check === "string") {
|
|
741
|
-
return {
|
|
742
|
-
when: "always",
|
|
743
|
-
case: check
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
return check;
|
|
747
|
-
});
|
|
748
|
-
const result = checks.some((check) => {
|
|
749
|
-
const r = _case(type, check.case);
|
|
750
|
-
return negated5(check.when) ? !r : r;
|
|
751
|
-
});
|
|
752
|
-
const list = checks.map((c) => c.case).join(", ");
|
|
753
|
-
return [
|
|
754
|
-
negated5(when) ? !result : result,
|
|
755
|
-
message9([`type must`, negated5(when) ? `not` : null, `be ${list}`])
|
|
756
|
-
];
|
|
757
|
-
};
|
|
758
|
-
var typeEmpty = (parsed, when = "always") => {
|
|
759
|
-
const negated6 = when === "never";
|
|
760
|
-
const notEmpty6 = ensure.notEmpty(parsed.type || "");
|
|
761
|
-
return [
|
|
762
|
-
negated6 ? notEmpty6 : !notEmpty6,
|
|
763
|
-
message9(["type", negated6 ? "may not" : "must", "be empty"])
|
|
764
|
-
];
|
|
765
|
-
};
|
|
766
|
-
var typeEnum = (parsed, when = "always", value = []) => {
|
|
767
|
-
const { type: input2 } = parsed;
|
|
768
|
-
if (!input2) {
|
|
769
|
-
return [true];
|
|
770
|
-
}
|
|
771
|
-
const negated6 = when === "never";
|
|
772
|
-
const result = ensure.enum(input2, value);
|
|
773
|
-
return [
|
|
774
|
-
negated6 ? !result : result,
|
|
775
|
-
message9([
|
|
776
|
-
`type must`,
|
|
777
|
-
negated6 ? `not` : null,
|
|
778
|
-
`be one of [${value.join(", ")}]`
|
|
779
|
-
])
|
|
780
|
-
];
|
|
781
|
-
};
|
|
782
|
-
var typeMaxLength = (parsed, _when = void 0, value = 0) => {
|
|
783
|
-
const input2 = parsed.type;
|
|
784
|
-
if (!input2) {
|
|
785
|
-
return [true];
|
|
786
|
-
}
|
|
787
|
-
return [
|
|
788
|
-
maxLength(input2, value),
|
|
789
|
-
`type must not be longer than ${value} characters`
|
|
790
|
-
];
|
|
791
|
-
};
|
|
792
|
-
var typeMinLength = (parsed, _when = void 0, value = 0) => {
|
|
793
|
-
const input2 = parsed.type;
|
|
794
|
-
if (!input2) {
|
|
795
|
-
return [true];
|
|
796
|
-
}
|
|
797
|
-
return [
|
|
798
|
-
minLength(input2, value),
|
|
799
|
-
`type must not be shorter than ${value} characters`
|
|
800
|
-
];
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
// ../../node_modules/.pnpm/@commitlint+rules@19.8.1/node_modules/@commitlint/rules/lib/index.js
|
|
804
|
-
var lib_default = {
|
|
805
|
-
"body-case": bodyCase,
|
|
806
|
-
"body-empty": bodyEmpty,
|
|
807
|
-
"body-full-stop": bodyFullStop,
|
|
808
|
-
"body-leading-blank": bodyLeadingBlank,
|
|
809
|
-
"body-max-length": bodyMaxLength,
|
|
810
|
-
"body-max-line-length": bodyMaxLineLength,
|
|
811
|
-
"body-min-length": bodyMinLength,
|
|
812
|
-
"footer-empty": footerEmpty,
|
|
813
|
-
"footer-leading-blank": footerLeadingBlank,
|
|
814
|
-
"footer-max-length": footerMaxLength,
|
|
815
|
-
"footer-max-line-length": footerMaxLineLength,
|
|
816
|
-
"footer-min-length": footerMinLength,
|
|
817
|
-
"header-case": headerCase,
|
|
818
|
-
"header-full-stop": headerFullStop,
|
|
819
|
-
"header-max-length": headerMaxLength,
|
|
820
|
-
"header-min-length": headerMinLength,
|
|
821
|
-
"header-trim": headerTrim,
|
|
822
|
-
"references-empty": referencesEmpty,
|
|
823
|
-
"scope-case": scopeCase,
|
|
824
|
-
"scope-empty": scopeEmpty,
|
|
825
|
-
"scope-enum": scopeEnum,
|
|
826
|
-
"scope-max-length": scopeMaxLength,
|
|
827
|
-
"scope-min-length": scopeMinLength,
|
|
828
|
-
"signed-off-by": signedOffBy,
|
|
829
|
-
"subject-case": subjectCase,
|
|
830
|
-
"subject-empty": subjectEmpty,
|
|
831
|
-
"subject-full-stop": subjectFullStop,
|
|
832
|
-
"subject-max-length": subjectMaxLength,
|
|
833
|
-
"subject-min-length": subjectMinLength,
|
|
834
|
-
"subject-exclamation-mark": subjectExclamationMark,
|
|
835
|
-
"trailer-exists": trailerExists,
|
|
836
|
-
"type-case": typeCase,
|
|
837
|
-
"type-empty": typeEmpty,
|
|
838
|
-
"type-enum": typeEnum,
|
|
839
|
-
"type-max-length": typeMaxLength,
|
|
840
|
-
"type-min-length": typeMinLength
|
|
841
|
-
};
|
|
842
329
|
|
|
843
330
|
// ../../node_modules/.pnpm/conventional-commits-parser@6.2.0/node_modules/conventional-commits-parser/dist/regex.js
|
|
844
331
|
var nomatchRegex = /(?!.*)/;
|
|
@@ -1246,30 +733,30 @@ var buildCommitMessage = ({
|
|
|
1246
733
|
body,
|
|
1247
734
|
footer
|
|
1248
735
|
}) => {
|
|
1249
|
-
let
|
|
1250
|
-
|
|
736
|
+
let message = header;
|
|
737
|
+
message = body ? `${message}
|
|
1251
738
|
|
|
1252
|
-
${body}` :
|
|
1253
|
-
|
|
739
|
+
${body}` : message;
|
|
740
|
+
message = footer ? `${message}
|
|
1254
741
|
|
|
1255
|
-
${footer}` :
|
|
1256
|
-
return
|
|
742
|
+
${footer}` : message;
|
|
743
|
+
return message || "";
|
|
1257
744
|
};
|
|
1258
|
-
async function lint(
|
|
745
|
+
async function lint(message, rawRulesConfig, rawOpts) {
|
|
1259
746
|
const rulesConfig = rawRulesConfig || {};
|
|
1260
747
|
const parser = new CommitParser(
|
|
1261
748
|
rawOpts?.parserOpts ?? DEFAULT_COMMITLINT_CONFIG.parserOpts
|
|
1262
749
|
);
|
|
1263
|
-
const parsed = parser.parse(
|
|
750
|
+
const parsed = parser.parse(message);
|
|
1264
751
|
if (parsed.header === null && parsed.body === null && parsed.footer === null) {
|
|
1265
752
|
return {
|
|
1266
753
|
valid: true,
|
|
1267
754
|
errors: [],
|
|
1268
755
|
warnings: [],
|
|
1269
|
-
input:
|
|
756
|
+
input: message
|
|
1270
757
|
};
|
|
1271
758
|
}
|
|
1272
|
-
const allRules = new Map(Object.entries(
|
|
759
|
+
const allRules = new Map(Object.entries(defaultRules));
|
|
1273
760
|
const missing = Object.keys(rulesConfig).filter(
|
|
1274
761
|
(name) => typeof allRules.get(name) !== "function"
|
|
1275
762
|
);
|
|
@@ -1343,12 +830,12 @@ async function lint(message23, rawRulesConfig, rawOpts) {
|
|
|
1343
830
|
throw new Error(`Could not find rule implementation for ${name}`);
|
|
1344
831
|
}
|
|
1345
832
|
const executableRule = rule;
|
|
1346
|
-
const [valid3,
|
|
833
|
+
const [valid3, message2] = await executableRule(parsed, when, value);
|
|
1347
834
|
return {
|
|
1348
835
|
level,
|
|
1349
836
|
valid: valid3,
|
|
1350
837
|
name,
|
|
1351
|
-
message:
|
|
838
|
+
message: message2
|
|
1352
839
|
};
|
|
1353
840
|
});
|
|
1354
841
|
const results = (await Promise.all(pendingResults)).filter(
|
|
@@ -1397,14 +884,14 @@ function getScopeEnumUtil(context) {
|
|
|
1397
884
|
function getScopeEnum(context) {
|
|
1398
885
|
return getNxScopes(context);
|
|
1399
886
|
}
|
|
1400
|
-
function getRuleFromScopeEnum(
|
|
1401
|
-
if (!
|
|
887
|
+
function getRuleFromScopeEnum(scopeEnum) {
|
|
888
|
+
if (!scopeEnum?.filter(Boolean).length) {
|
|
1402
889
|
throw new Error("No scopes found in the Storm workspace.");
|
|
1403
890
|
}
|
|
1404
891
|
return [
|
|
1405
892
|
2 /* Error */,
|
|
1406
893
|
"always",
|
|
1407
|
-
|
|
894
|
+
scopeEnum.filter(Boolean)
|
|
1408
895
|
];
|
|
1409
896
|
}
|
|
1410
897
|
|
|
@@ -1701,16 +1188,16 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1701
1188
|
{#CCCCCC Please provide the requested details below...}
|
|
1702
1189
|
`);
|
|
1703
1190
|
state.answers = await askQuestions(state);
|
|
1704
|
-
const
|
|
1191
|
+
const message = formatCommitMessage(state);
|
|
1705
1192
|
const commitMsgFile = joinPaths(getGitDir(), "COMMIT_EDITMSG");
|
|
1706
1193
|
console.log(chalkTemplate`
|
|
1707
1194
|
{bold.#999999 ----------------------------------------}
|
|
1708
1195
|
|
|
1709
|
-
{bold.#FFFFFF Commit message} - {#DDDDDD ${
|
|
1196
|
+
{bold.#FFFFFF Commit message} - {#DDDDDD ${message}}
|
|
1710
1197
|
{bold.#FFFFFF Git-Commit File} - {#DDDDDD ${commitMsgFile}}
|
|
1711
1198
|
|
|
1712
1199
|
`);
|
|
1713
|
-
await runCommitLint(config, { message
|
|
1200
|
+
await runCommitLint(config, { message });
|
|
1714
1201
|
const commandItems = ["git", "commit", "-S"];
|
|
1715
1202
|
commandItems.push(...["--file", commitMsgFile]);
|
|
1716
1203
|
const command = shellescape(commandItems);
|
|
@@ -1719,9 +1206,9 @@ var runCommit = async (commitizenFile = "@storm-software/git-tools/commit/config
|
|
|
1719
1206
|
`Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
|
|
1720
1207
|
config
|
|
1721
1208
|
);
|
|
1722
|
-
writeDebug(`Message [dry-run]: ${
|
|
1209
|
+
writeDebug(`Message [dry-run]: ${message}`, config);
|
|
1723
1210
|
} else {
|
|
1724
|
-
await fs.writeFile(commitMsgFile,
|
|
1211
|
+
await fs.writeFile(commitMsgFile, message);
|
|
1725
1212
|
run(config, command);
|
|
1726
1213
|
}
|
|
1727
1214
|
};
|
|
@@ -1739,11 +1226,11 @@ var askQuestions = async (state) => {
|
|
|
1739
1226
|
return state.answers;
|
|
1740
1227
|
};
|
|
1741
1228
|
var askQuestion = (index, question) => {
|
|
1742
|
-
const
|
|
1229
|
+
const message = chalkTemplate`{bold ${index + 1}. ${question.title}} - ${question.description}
|
|
1743
1230
|
`;
|
|
1744
1231
|
if (question.type === "select" && question.enum && Object.keys(question.enum).length > 1) {
|
|
1745
1232
|
return select({
|
|
1746
|
-
message
|
|
1233
|
+
message,
|
|
1747
1234
|
choices: Object.keys(question.enum).filter((key) => !question.enum?.[key]?.hidden).map((key) => ({
|
|
1748
1235
|
name: question.enum?.[key]?.title || key,
|
|
1749
1236
|
value: key,
|
|
@@ -1753,7 +1240,7 @@ var askQuestion = (index, question) => {
|
|
|
1753
1240
|
});
|
|
1754
1241
|
} else if (question.type === "confirm") {
|
|
1755
1242
|
return confirm({
|
|
1756
|
-
message
|
|
1243
|
+
message,
|
|
1757
1244
|
default: Boolean(question.defaultValue)
|
|
1758
1245
|
});
|
|
1759
1246
|
} else {
|
|
@@ -1770,7 +1257,7 @@ var askQuestion = (index, question) => {
|
|
|
1770
1257
|
};
|
|
1771
1258
|
}
|
|
1772
1259
|
return input({
|
|
1773
|
-
message
|
|
1260
|
+
message,
|
|
1774
1261
|
required: !!(question.minLength !== void 0 && question.minLength > 0),
|
|
1775
1262
|
default: String(question.defaultValue || ""),
|
|
1776
1263
|
validate
|
|
@@ -2821,7 +2308,7 @@ function parseChangelogMarkdown(contents) {
|
|
|
2821
2308
|
}
|
|
2822
2309
|
async function gitTag({
|
|
2823
2310
|
tag,
|
|
2824
|
-
message
|
|
2311
|
+
message,
|
|
2825
2312
|
additionalArgs,
|
|
2826
2313
|
dryRun,
|
|
2827
2314
|
verbose,
|
|
@@ -2835,7 +2322,7 @@ async function gitTag({
|
|
|
2835
2322
|
"--sign",
|
|
2836
2323
|
tag,
|
|
2837
2324
|
"--message",
|
|
2838
|
-
|
|
2325
|
+
message || tag
|
|
2839
2326
|
];
|
|
2840
2327
|
if (additionalArgs) {
|
|
2841
2328
|
if (Array.isArray(additionalArgs)) {
|
|
@@ -2870,8 +2357,8 @@ async function gitCommit({
|
|
|
2870
2357
|
}) {
|
|
2871
2358
|
logFn = logFn || console.log;
|
|
2872
2359
|
const commandArgs = ["commit", "-S"];
|
|
2873
|
-
for (const
|
|
2874
|
-
commandArgs.push("--message",
|
|
2360
|
+
for (const message of messages) {
|
|
2361
|
+
commandArgs.push("--message", message);
|
|
2875
2362
|
}
|
|
2876
2363
|
if (additionalArgs) {
|
|
2877
2364
|
if (Array.isArray(additionalArgs)) {
|
|
@@ -4905,7 +4392,7 @@ Stacktrace: ${error.stack}` : ""}`,
|
|
|
4905
4392
|
}
|
|
4906
4393
|
async function commitLintAction({
|
|
4907
4394
|
config,
|
|
4908
|
-
message
|
|
4395
|
+
message,
|
|
4909
4396
|
file
|
|
4910
4397
|
}) {
|
|
4911
4398
|
try {
|
|
@@ -4915,7 +4402,7 @@ async function commitLintAction({
|
|
|
4915
4402
|
);
|
|
4916
4403
|
await runCommitLint(_config, {
|
|
4917
4404
|
config,
|
|
4918
|
-
message
|
|
4405
|
+
message,
|
|
4919
4406
|
file
|
|
4920
4407
|
});
|
|
4921
4408
|
writeSuccess(
|