commitizen 4.3.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,863 +4,81 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commit = commit;
7
- var _child_process = require("child_process");
8
- var _path = _interopRequireDefault(require("path"));
9
- var _fs = require("fs");
7
+ var _nodeChild_process = require("node:child_process");
8
+ var _nodePath = _interopRequireDefault(require("node:path"));
9
+ var _nodeFs = require("node:fs");
10
10
  var _dedent = _interopRequireDefault(require("dedent"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function cov_lpc78prp4() {
13
- var path = "/home/runner/work/cz-cli/cz-cli/src/git/commit.js";
14
- var hash = "dffb8a6807d61696bc8019d6e9da18a39917eafb";
15
- var global = new Function("return this")();
16
- var gcv = "__coverage__";
17
- var coverageData = {
18
- path: "/home/runner/work/cz-cli/cz-cli/src/git/commit.js",
19
- statementMap: {
20
- "0": {
21
- start: {
22
- line: 15,
23
- column: 15
24
- },
25
- end: {
26
- line: 15,
27
- column: 20
28
- }
29
- },
30
- "1": {
31
- start: {
32
- line: 20,
33
- column: 2
34
- },
35
- end: {
36
- line: 85,
37
- column: 3
38
- }
39
- },
40
- "2": {
41
- start: {
42
- line: 21,
43
- column: 15
44
- },
45
- end: {
46
- line: 21,
47
- column: 73
48
- }
49
- },
50
- "3": {
51
- start: {
52
- line: 22,
53
- column: 16
54
- },
55
- end: {
56
- line: 25,
57
- column: 6
58
- }
59
- },
60
- "4": {
61
- start: {
62
- line: 27,
63
- column: 4
64
- },
65
- end: {
66
- line: 32,
67
- column: 7
68
- }
69
- },
70
- "5": {
71
- start: {
72
- line: 28,
73
- column: 6
74
- },
75
- end: {
76
- line: 28,
77
- column: 25
78
- }
79
- },
80
- "6": {
81
- start: {
82
- line: 28,
83
- column: 18
84
- },
85
- end: {
86
- line: 28,
87
- column: 25
88
- }
89
- },
90
- "7": {
91
- start: {
92
- line: 29,
93
- column: 6
94
- },
95
- end: {
96
- line: 29,
97
- column: 20
98
- }
99
- },
100
- "8": {
101
- start: {
102
- line: 31,
103
- column: 6
104
- },
105
- end: {
106
- line: 31,
107
- column: 16
108
- }
109
- },
110
- "9": {
111
- start: {
112
- line: 34,
113
- column: 4
114
- },
115
- end: {
116
- line: 51,
117
- column: 7
118
- }
119
- },
120
- "10": {
121
- start: {
122
- line: 35,
123
- column: 6
124
- },
125
- end: {
126
- line: 35,
127
- column: 25
128
- }
129
- },
130
- "11": {
131
- start: {
132
- line: 35,
133
- column: 18
134
- },
135
- end: {
136
- line: 35,
137
- column: 25
138
- }
139
- },
140
- "12": {
141
- start: {
142
- line: 36,
143
- column: 6
144
- },
145
- end: {
146
- line: 36,
147
- column: 20
148
- }
149
- },
150
- "13": {
151
- start: {
152
- line: 38,
153
- column: 6
154
- },
155
- end: {
156
- line: 50,
157
- column: 7
158
- }
159
- },
160
- "14": {
161
- start: {
162
- line: 39,
163
- column: 8
164
- },
165
- end: {
166
- line: 46,
167
- column: 9
168
- }
169
- },
170
- "15": {
171
- start: {
172
- line: 40,
173
- column: 10
174
- },
175
- end: {
176
- line: 45,
177
- column: 14
178
- }
179
- },
180
- "16": {
181
- start: {
182
- line: 47,
183
- column: 8
184
- },
185
- end: {
186
- line: 47,
187
- column: 95
188
- }
189
- },
190
- "17": {
191
- start: {
192
- line: 49,
193
- column: 8
194
- },
195
- end: {
196
- line: 49,
197
- column: 19
198
- }
199
- },
200
- "18": {
201
- start: {
202
- line: 53,
203
- column: 23
204
- },
205
- end: {
206
- line: 56,
207
- column: 12
208
- }
209
- },
210
- "19": {
211
- start: {
212
- line: 57,
213
- column: 27
214
- },
215
- end: {
216
- line: 57,
217
- column: 66
218
- }
219
- },
220
- "20": {
221
- start: {
222
- line: 58,
223
- column: 4
224
- },
225
- end: {
226
- line: 84,
227
- column: 5
228
- }
229
- },
230
- "21": {
231
- start: {
232
- line: 59,
233
- column: 17
234
- },
235
- end: {
236
- line: 59,
237
- column: 46
238
- }
239
- },
240
- "22": {
241
- start: {
242
- line: 60,
243
- column: 6
244
- },
245
- end: {
246
- line: 67,
247
- column: 7
248
- }
249
- },
250
- "23": {
251
- start: {
252
- line: 61,
253
- column: 8
254
- },
255
- end: {
256
- line: 61,
257
- column: 43
258
- }
259
- },
260
- "24": {
261
- start: {
262
- line: 62,
263
- column: 8
264
- },
265
- end: {
266
- line: 62,
267
- column: 19
268
- }
269
- },
270
- "25": {
271
- start: {
272
- line: 64,
273
- column: 8
274
- },
275
- end: {
276
- line: 64,
277
- column: 16
278
- }
279
- },
280
- "26": {
281
- start: {
282
- line: 66,
283
- column: 8
284
- },
285
- end: {
286
- line: 66,
287
- column: 22
288
- }
289
- },
290
- "27": {
291
- start: {
292
- line: 71,
293
- column: 6
294
- },
295
- end: {
296
- line: 83,
297
- column: 7
298
- }
299
- },
300
- "28": {
301
- start: {
302
- line: 72,
303
- column: 19
304
- },
305
- end: {
306
- line: 72,
307
- column: 49
308
- }
309
- },
310
- "29": {
311
- start: {
312
- line: 73,
313
- column: 8
314
- },
315
- end: {
316
- line: 80,
317
- column: 9
318
- }
319
- },
320
- "30": {
321
- start: {
322
- line: 74,
323
- column: 10
324
- },
325
- end: {
326
- line: 74,
327
- column: 45
328
- }
329
- },
330
- "31": {
331
- start: {
332
- line: 75,
333
- column: 10
334
- },
335
- end: {
336
- line: 75,
337
- column: 21
338
- }
339
- },
340
- "32": {
341
- start: {
342
- line: 77,
343
- column: 10
344
- },
345
- end: {
346
- line: 77,
347
- column: 18
348
- }
349
- },
350
- "33": {
351
- start: {
352
- line: 79,
353
- column: 10
354
- },
355
- end: {
356
- line: 79,
357
- column: 24
358
- }
359
- },
360
- "34": {
361
- start: {
362
- line: 82,
363
- column: 8
364
- },
365
- end: {
366
- line: 82,
367
- column: 16
368
- }
369
- }
370
- },
371
- fnMap: {
372
- "0": {
373
- name: "commit",
374
- decl: {
375
- start: {
376
- line: 14,
377
- column: 9
378
- },
379
- end: {
380
- line: 14,
381
- column: 15
382
- }
383
- },
384
- loc: {
385
- start: {
386
- line: 14,
387
- column: 51
388
- },
389
- end: {
390
- line: 86,
391
- column: 1
392
- }
393
- },
394
- line: 14
395
- },
396
- "1": {
397
- name: "(anonymous_1)",
398
- decl: {
399
- start: {
400
- line: 27,
401
- column: 22
402
- },
403
- end: {
404
- line: 27,
405
- column: 23
406
- }
407
- },
408
- loc: {
409
- start: {
410
- line: 27,
411
- column: 37
412
- },
413
- end: {
414
- line: 32,
415
- column: 5
416
- }
417
- },
418
- line: 27
419
- },
420
- "2": {
421
- name: "(anonymous_2)",
422
- decl: {
423
- start: {
424
- line: 34,
425
- column: 21
426
- },
427
- end: {
428
- line: 34,
429
- column: 22
430
- }
431
- },
432
- loc: {
433
- start: {
434
- line: 34,
435
- column: 45
436
- },
437
- end: {
438
- line: 51,
439
- column: 5
440
- }
441
- },
442
- line: 34
443
- }
444
- },
445
- branchMap: {
446
- "0": {
447
- loc: {
448
- start: {
449
- line: 20,
450
- column: 2
451
- },
452
- end: {
453
- line: 85,
454
- column: 3
455
- }
456
- },
457
- type: "if",
458
- locations: [{
459
- start: {
460
- line: 20,
461
- column: 2
462
- },
463
- end: {
464
- line: 85,
465
- column: 3
466
- }
467
- }, {
468
- start: {
469
- line: 52,
470
- column: 9
471
- },
472
- end: {
473
- line: 85,
474
- column: 3
475
- }
476
- }],
477
- line: 20
478
- },
479
- "1": {
480
- loc: {
481
- start: {
482
- line: 21,
483
- column: 53
484
- },
485
- end: {
486
- line: 21,
487
- column: 71
488
- }
489
- },
490
- type: "binary-expr",
491
- locations: [{
492
- start: {
493
- line: 21,
494
- column: 53
495
- },
496
- end: {
497
- line: 21,
498
- column: 65
499
- }
500
- }, {
501
- start: {
502
- line: 21,
503
- column: 69
504
- },
505
- end: {
506
- line: 21,
507
- column: 71
508
- }
509
- }],
510
- line: 21
511
- },
512
- "2": {
513
- loc: {
514
- start: {
515
- line: 24,
516
- column: 13
517
- },
518
- end: {
519
- line: 24,
520
- column: 49
521
- }
522
- },
523
- type: "cond-expr",
524
- locations: [{
525
- start: {
526
- line: 24,
527
- column: 29
528
- },
529
- end: {
530
- line: 24,
531
- column: 37
532
- }
533
- }, {
534
- start: {
535
- line: 24,
536
- column: 40
537
- },
538
- end: {
539
- line: 24,
540
- column: 49
541
- }
542
- }],
543
- line: 24
544
- },
545
- "3": {
546
- loc: {
547
- start: {
548
- line: 28,
549
- column: 6
550
- },
551
- end: {
552
- line: 28,
553
- column: 25
554
- }
555
- },
556
- type: "if",
557
- locations: [{
558
- start: {
559
- line: 28,
560
- column: 6
561
- },
562
- end: {
563
- line: 28,
564
- column: 25
565
- }
566
- }, {
567
- start: {
568
- line: undefined,
569
- column: undefined
570
- },
571
- end: {
572
- line: undefined,
573
- column: undefined
574
- }
575
- }],
576
- line: 28
577
- },
578
- "4": {
579
- loc: {
580
- start: {
581
- line: 35,
582
- column: 6
583
- },
584
- end: {
585
- line: 35,
586
- column: 25
587
- }
588
- },
589
- type: "if",
590
- locations: [{
591
- start: {
592
- line: 35,
593
- column: 6
594
- },
595
- end: {
596
- line: 35,
597
- column: 25
598
- }
599
- }, {
600
- start: {
601
- line: undefined,
602
- column: undefined
603
- },
604
- end: {
605
- line: undefined,
606
- column: undefined
607
- }
608
- }],
609
- line: 35
610
- },
611
- "5": {
612
- loc: {
613
- start: {
614
- line: 38,
615
- column: 6
616
- },
617
- end: {
618
- line: 50,
619
- column: 7
620
- }
621
- },
622
- type: "if",
623
- locations: [{
624
- start: {
625
- line: 38,
626
- column: 6
627
- },
628
- end: {
629
- line: 50,
630
- column: 7
631
- }
632
- }, {
633
- start: {
634
- line: 48,
635
- column: 13
636
- },
637
- end: {
638
- line: 50,
639
- column: 7
640
- }
641
- }],
642
- line: 38
643
- },
644
- "6": {
645
- loc: {
646
- start: {
647
- line: 39,
648
- column: 8
649
- },
650
- end: {
651
- line: 46,
652
- column: 9
653
- }
654
- },
655
- type: "if",
656
- locations: [{
657
- start: {
658
- line: 39,
659
- column: 8
660
- },
661
- end: {
662
- line: 46,
663
- column: 9
664
- }
665
- }, {
666
- start: {
667
- line: undefined,
668
- column: undefined
669
- },
670
- end: {
671
- line: undefined,
672
- column: undefined
673
- }
674
- }],
675
- line: 39
676
- }
677
- },
678
- s: {
679
- "0": 0,
680
- "1": 0,
681
- "2": 0,
682
- "3": 0,
683
- "4": 0,
684
- "5": 0,
685
- "6": 0,
686
- "7": 0,
687
- "8": 0,
688
- "9": 0,
689
- "10": 0,
690
- "11": 0,
691
- "12": 0,
692
- "13": 0,
693
- "14": 0,
694
- "15": 0,
695
- "16": 0,
696
- "17": 0,
697
- "18": 0,
698
- "19": 0,
699
- "20": 0,
700
- "21": 0,
701
- "22": 0,
702
- "23": 0,
703
- "24": 0,
704
- "25": 0,
705
- "26": 0,
706
- "27": 0,
707
- "28": 0,
708
- "29": 0,
709
- "30": 0,
710
- "31": 0,
711
- "32": 0,
712
- "33": 0,
713
- "34": 0
714
- },
715
- f: {
716
- "0": 0,
717
- "1": 0,
718
- "2": 0
719
- },
720
- b: {
721
- "0": [0, 0],
722
- "1": [0, 0],
723
- "2": [0, 0],
724
- "3": [0, 0],
725
- "4": [0, 0],
726
- "5": [0, 0],
727
- "6": [0, 0]
728
- },
729
- _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
730
- hash: "dffb8a6807d61696bc8019d6e9da18a39917eafb"
731
- };
732
- var coverage = global[gcv] || (global[gcv] = {});
733
- if (!coverage[path] || coverage[path].hash !== hash) {
734
- coverage[path] = coverageData;
735
- }
736
- var actualCoverage = coverage[path];
737
- {
738
- // @ts-ignore
739
- cov_lpc78prp4 = function () {
740
- return actualCoverage;
741
- };
742
- }
743
- return actualCoverage;
744
- }
745
- cov_lpc78prp4();
746
12
  /**
747
13
  * Asynchronously git commit at a given path with a message
748
14
  */
749
15
  function commit(repoPath, message, options, done) {
750
- cov_lpc78prp4().f[0]++;
751
- let called = (cov_lpc78prp4().s[0]++, false);
16
+ let called = false;
752
17
 
753
18
  // commit the file by spawning a git process, unless the --hook
754
19
  // option was provided. in that case, write the commit message into
755
20
  // the .git/COMMIT_EDITMSG file
756
- cov_lpc78prp4().s[1]++;
757
21
  if (!options.hookMode) {
758
- cov_lpc78prp4().b[0][0]++;
759
- let args = (cov_lpc78prp4().s[2]++, ['commit', '-m', (0, _dedent.default)(message), ...((cov_lpc78prp4().b[1][0]++, options.args) || (cov_lpc78prp4().b[1][1]++, []))]);
760
- let child = (cov_lpc78prp4().s[3]++, (0, _child_process.spawn)('git', args, {
22
+ let args = ['commit', '-m', (0, _dedent.default)(message), ...(options.args || [])];
23
+ let child = (0, _nodeChild_process.spawn)('git', args, {
761
24
  cwd: repoPath,
762
- stdio: options.quiet ? (cov_lpc78prp4().b[2][0]++, 'ignore') : (cov_lpc78prp4().b[2][1]++, 'inherit')
763
- }));
764
- cov_lpc78prp4().s[4]++;
25
+ stdio: options.quiet ? 'ignore' : 'inherit'
26
+ });
765
27
  child.on('error', function (err) {
766
- cov_lpc78prp4().f[1]++;
767
- cov_lpc78prp4().s[5]++;
768
- if (called) {
769
- cov_lpc78prp4().b[3][0]++;
770
- cov_lpc78prp4().s[6]++;
771
- return;
772
- } else {
773
- cov_lpc78prp4().b[3][1]++;
774
- }
775
- cov_lpc78prp4().s[7]++;
28
+ if (called) return;
776
29
  called = true;
777
- cov_lpc78prp4().s[8]++;
778
30
  done(err);
779
31
  });
780
- cov_lpc78prp4().s[9]++;
781
32
  child.on('exit', function (code, signal) {
782
- cov_lpc78prp4().f[2]++;
783
- cov_lpc78prp4().s[10]++;
784
- if (called) {
785
- cov_lpc78prp4().b[4][0]++;
786
- cov_lpc78prp4().s[11]++;
787
- return;
788
- } else {
789
- cov_lpc78prp4().b[4][1]++;
790
- }
791
- cov_lpc78prp4().s[12]++;
33
+ if (called) return;
792
34
  called = true;
793
- cov_lpc78prp4().s[13]++;
794
35
  if (code) {
795
- cov_lpc78prp4().b[5][0]++;
796
- cov_lpc78prp4().s[14]++;
797
36
  if (code === 128) {
798
- cov_lpc78prp4().b[6][0]++;
799
- cov_lpc78prp4().s[15]++;
800
37
  console.warn(`
801
38
  Git exited with code 128. Did you forget to run:
802
39
 
803
40
  git config --global user.email "you@example.com"
804
41
  git config --global user.name "Your Name"
805
42
  `);
806
- } else {
807
- cov_lpc78prp4().b[6][1]++;
808
43
  }
809
- cov_lpc78prp4().s[16]++;
810
44
  done(Object.assign(new Error(`git exited with error code ${code}`), {
811
45
  code,
812
46
  signal
813
47
  }));
814
48
  } else {
815
- cov_lpc78prp4().b[5][1]++;
816
- cov_lpc78prp4().s[17]++;
817
49
  done(null);
818
50
  }
819
51
  });
820
52
  } else {
821
- cov_lpc78prp4().b[0][1]++;
822
- const gitDirPath = (cov_lpc78prp4().s[18]++, (0, _child_process.execSync)('git rev-parse --absolute-git-dir', {
53
+ const gitDirPath = (0, _nodeChild_process.execSync)('git rev-parse --absolute-git-dir', {
823
54
  cwd: repoPath,
824
55
  encoding: 'utf8'
825
- }).trim());
826
- const commitFilePath = (cov_lpc78prp4().s[19]++, _path.default.join(gitDirPath, 'COMMIT_EDITMSG'));
827
- cov_lpc78prp4().s[20]++;
56
+ }).trim();
57
+ const commitFilePath = _nodePath.default.join(gitDirPath, 'COMMIT_EDITMSG');
828
58
  try {
829
- const fd = (cov_lpc78prp4().s[21]++, (0, _fs.openSync)(commitFilePath, 'w'));
830
- cov_lpc78prp4().s[22]++;
59
+ const fd = (0, _nodeFs.openSync)(commitFilePath, 'w');
831
60
  try {
832
- cov_lpc78prp4().s[23]++;
833
- (0, _fs.writeFileSync)(fd, (0, _dedent.default)(message));
834
- cov_lpc78prp4().s[24]++;
61
+ (0, _nodeFs.writeFileSync)(fd, (0, _dedent.default)(message));
835
62
  done(null);
836
63
  } catch (e) {
837
- cov_lpc78prp4().s[25]++;
838
64
  done(e);
839
65
  } finally {
840
- cov_lpc78prp4().s[26]++;
841
- (0, _fs.closeSync)(fd);
66
+ (0, _nodeFs.closeSync)(fd);
842
67
  }
843
68
  } catch (e) {
844
- cov_lpc78prp4().s[27]++;
845
69
  // windows doesn't allow opening existing hidden files
846
70
  // in 'w' mode... but it does let you do 'r+'!
847
71
  try {
848
- const fd = (cov_lpc78prp4().s[28]++, (0, _fs.openSync)(commitFilePath, 'r+'));
849
- cov_lpc78prp4().s[29]++;
72
+ const fd = (0, _nodeFs.openSync)(commitFilePath, 'r+');
850
73
  try {
851
- cov_lpc78prp4().s[30]++;
852
- (0, _fs.writeFileSync)(fd, (0, _dedent.default)(message));
853
- cov_lpc78prp4().s[31]++;
74
+ (0, _nodeFs.writeFileSync)(fd, (0, _dedent.default)(message));
854
75
  done(null);
855
76
  } catch (e) {
856
- cov_lpc78prp4().s[32]++;
857
77
  done(e);
858
78
  } finally {
859
- cov_lpc78prp4().s[33]++;
860
- (0, _fs.closeSync)(fd);
79
+ (0, _nodeFs.closeSync)(fd);
861
80
  }
862
81
  } catch (e) {
863
- cov_lpc78prp4().s[34]++;
864
82
  done(e);
865
83
  }
866
84
  }