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.
@@ -11,1359 +11,12 @@ exports.getNearestNodeModulesDirectory = getNearestNodeModulesDirectory;
11
11
  exports.getNearestProjectRootDirectory = getNearestProjectRootDirectory;
12
12
  exports.getPrompter = getPrompter;
13
13
  exports.resolveAdapterPath = resolveAdapterPath;
14
- var _child_process = _interopRequireDefault(require("child_process"));
15
- var _path = _interopRequireDefault(require("path"));
16
- var _fs = _interopRequireDefault(require("fs"));
17
- var _findNodeModules = _interopRequireDefault(require("find-node-modules"));
18
- var _lodash = _interopRequireDefault(require("lodash"));
14
+ var _nodeChild_process = _interopRequireDefault(require("node:child_process"));
15
+ var _nodePath = _interopRequireDefault(require("node:path"));
16
+ var _nodeFs = _interopRequireDefault(require("node:fs"));
19
17
  var _detectIndent = _interopRequireDefault(require("detect-indent"));
20
18
  var _util = require("../common/util");
21
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
- function cov_16lcdpz3tp() {
23
- var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/adapter.js";
24
- var hash = "e37ec3ccafde4f581a254419294338bc76165289";
25
- var global = new Function("return this")();
26
- var gcv = "__coverage__";
27
- var coverageData = {
28
- path: "/home/runner/work/cz-cli/cz-cli/src/commitizen/adapter.js",
29
- statementMap: {
30
- "0": {
31
- start: {
32
- line: 36,
33
- column: 32
34
- },
35
- end: {
36
- line: 42,
37
- column: 3
38
- }
39
- },
40
- "1": {
41
- start: {
42
- line: 44,
43
- column: 24
44
- },
45
- end: {
46
- line: 44,
47
- column: 91
48
- }
49
- },
50
- "2": {
51
- start: {
52
- line: 45,
53
- column: 26
54
- },
55
- end: {
56
- line: 45,
57
- column: 67
58
- }
59
- },
60
- "3": {
61
- start: {
62
- line: 47,
63
- column: 15
64
- },
65
- end: {
66
- line: 47,
67
- column: 61
68
- }
69
- },
70
- "4": {
71
- start: {
72
- line: 48,
73
- column: 27
74
- },
75
- end: {
76
- line: 48,
77
- column: 56
78
- }
79
- },
80
- "5": {
81
- start: {
82
- line: 49,
83
- column: 30
84
- },
85
- end: {
86
- line: 49,
87
- column: 32
88
- }
89
- },
90
- "6": {
91
- start: {
92
- line: 50,
93
- column: 2
94
- },
95
- end: {
96
- line: 52,
97
- column: 3
98
- }
99
- },
100
- "7": {
101
- start: {
102
- line: 51,
103
- column: 4
104
- },
105
- end: {
106
- line: 51,
107
- column: 81
108
- }
109
- },
110
- "8": {
111
- start: {
112
- line: 53,
113
- column: 2
114
- },
115
- end: {
116
- line: 53,
117
- column: 96
118
- }
119
- },
120
- "9": {
121
- start: {
122
- line: 60,
123
- column: 2
124
- },
125
- end: {
126
- line: 60,
127
- column: 70
128
- }
129
- },
130
- "10": {
131
- start: {
132
- line: 67,
133
- column: 26
134
- },
135
- end: {
136
- line: 67,
137
- column: 35
138
- }
139
- },
140
- "11": {
141
- start: {
142
- line: 68,
143
- column: 34
144
- },
145
- end: {
146
- line: 72,
147
- column: 3
148
- }
149
- },
150
- "12": {
151
- start: {
152
- line: 74,
153
- column: 2
154
- },
155
- end: {
156
- line: 74,
157
- column: 68
158
- }
159
- },
160
- "13": {
161
- start: {
162
- line: 81,
163
- column: 2
164
- },
165
- end: {
166
- line: 81,
167
- column: 121
168
- }
169
- },
170
- "14": {
171
- start: {
172
- line: 90,
173
- column: 31
174
- },
175
- end: {
176
- line: 90,
177
- column: 55
178
- }
179
- },
180
- "15": {
181
- start: {
182
- line: 95,
183
- column: 2
184
- },
185
- end: {
186
- line: 99,
187
- column: 3
188
- }
189
- },
190
- "16": {
191
- start: {
192
- line: 96,
193
- column: 4
194
- },
195
- end: {
196
- line: 96,
197
- column: 37
198
- }
199
- },
200
- "17": {
201
- start: {
202
- line: 106,
203
- column: 2
204
- },
205
- end: {
206
- line: 106,
207
- column: 78
208
- }
209
- },
210
- "18": {
211
- start: {
212
- line: 113,
213
- column: 14
214
- },
215
- end: {
216
- line: 117,
217
- column: 48
218
- }
219
- },
220
- "19": {
221
- start: {
222
- line: 119,
223
- column: 15
224
- },
225
- end: {
226
- line: 122,
227
- column: 48
228
- }
229
- },
230
- "20": {
231
- start: {
232
- line: 124,
233
- column: 15
234
- },
235
- end: {
236
- line: 127,
237
- column: 57
238
- }
239
- },
240
- "21": {
241
- start: {
242
- line: 129,
243
- column: 14
244
- },
245
- end: {
246
- line: 129,
247
- column: 33
248
- }
249
- },
250
- "22": {
251
- start: {
252
- line: 131,
253
- column: 2
254
- },
255
- end: {
256
- line: 131,
257
- column: 36
258
- }
259
- },
260
- "23": {
261
- start: {
262
- line: 139,
263
- column: 28
264
- },
265
- end: {
266
- line: 139,
267
- column: 59
268
- }
269
- },
270
- "24": {
271
- start: {
272
- line: 142,
273
- column: 16
274
- },
275
- end: {
276
- line: 142,
277
- column: 44
278
- }
279
- },
280
- "25": {
281
- start: {
282
- line: 160,
283
- column: 15
284
- },
285
- end: {
286
- line: 160,
287
- column: 45
288
- }
289
- },
290
- "26": {
291
- start: {
292
- line: 161,
293
- column: 15
294
- },
295
- end: {
296
- line: 161,
297
- column: 68
298
- }
299
- },
300
- "27": {
301
- start: {
302
- line: 164,
303
- column: 28
304
- },
305
- end: {
306
- line: 166,
307
- column: 22
308
- }
309
- },
310
- "28": {
311
- start: {
312
- line: 168,
313
- column: 2
314
- },
315
- end: {
316
- line: 174,
317
- column: 3
318
- }
319
- },
320
- "29": {
321
- start: {
322
- line: 170,
323
- column: 4
324
- },
325
- end: {
326
- line: 170,
327
- column: 48
328
- }
329
- },
330
- "30": {
331
- start: {
332
- line: 172,
333
- column: 4
334
- },
335
- end: {
336
- line: 172,
337
- column: 86
338
- }
339
- },
340
- "31": {
341
- start: {
342
- line: 173,
343
- column: 4
344
- },
345
- end: {
346
- line: 173,
347
- column: 16
348
- }
349
- },
350
- "32": {
351
- start: {
352
- line: 178,
353
- column: 2
354
- },
355
- end: {
356
- line: 178,
357
- column: 109
358
- }
359
- }
360
- },
361
- fnMap: {
362
- "0": {
363
- name: "addPathToAdapterConfig",
364
- decl: {
365
- start: {
366
- line: 34,
367
- column: 9
368
- },
369
- end: {
370
- line: 34,
371
- column: 31
372
- }
373
- },
374
- loc: {
375
- start: {
376
- line: 34,
377
- column: 68
378
- },
379
- end: {
380
- line: 54,
381
- column: 1
382
- }
383
- },
384
- line: 34
385
- },
386
- "1": {
387
- name: "getInstallOptions",
388
- decl: {
389
- start: {
390
- line: 59,
391
- column: 9
392
- },
393
- end: {
394
- line: 59,
395
- column: 26
396
- }
397
- },
398
- loc: {
399
- start: {
400
- line: 59,
401
- column: 43
402
- },
403
- end: {
404
- line: 61,
405
- column: 1
406
- }
407
- },
408
- line: 59
409
- },
410
- "2": {
411
- name: "getInstallCommand",
412
- decl: {
413
- start: {
414
- line: 66,
415
- column: 9
416
- },
417
- end: {
418
- line: 66,
419
- column: 26
420
- }
421
- },
422
- loc: {
423
- start: {
424
- line: 66,
425
- column: 43
426
- },
427
- end: {
428
- line: 75,
429
- column: 1
430
- }
431
- },
432
- line: 66
433
- },
434
- "3": {
435
- name: "generateInstallAdapterCommand",
436
- decl: {
437
- start: {
438
- line: 80,
439
- column: 9
440
- },
441
- end: {
442
- line: 80,
443
- column: 38
444
- }
445
- },
446
- loc: {
447
- start: {
448
- line: 80,
449
- column: 95
450
- },
451
- end: {
452
- line: 82,
453
- column: 1
454
- }
455
- },
456
- line: 80
457
- },
458
- "4": {
459
- name: "getNearestNodeModulesDirectory",
460
- decl: {
461
- start: {
462
- line: 87,
463
- column: 9
464
- },
465
- end: {
466
- line: 87,
467
- column: 39
468
- }
469
- },
470
- loc: {
471
- start: {
472
- line: 87,
473
- column: 50
474
- },
475
- end: {
476
- line: 100,
477
- column: 1
478
- }
479
- },
480
- line: 87
481
- },
482
- "5": {
483
- name: "getNearestProjectRootDirectory",
484
- decl: {
485
- start: {
486
- line: 105,
487
- column: 9
488
- },
489
- end: {
490
- line: 105,
491
- column: 39
492
- }
493
- },
494
- loc: {
495
- start: {
496
- line: 105,
497
- column: 60
498
- },
499
- end: {
500
- line: 107,
501
- column: 1
502
- }
503
- },
504
- line: 105
505
- },
506
- "6": {
507
- name: "getInstallStringMappings",
508
- decl: {
509
- start: {
510
- line: 112,
511
- column: 9
512
- },
513
- end: {
514
- line: 112,
515
- column: 33
516
- }
517
- },
518
- loc: {
519
- start: {
520
- line: 112,
521
- column: 99
522
- },
523
- end: {
524
- line: 132,
525
- column: 1
526
- }
527
- },
528
- line: 112
529
- },
530
- "7": {
531
- name: "getPrompter",
532
- decl: {
533
- start: {
534
- line: 137,
535
- column: 9
536
- },
537
- end: {
538
- line: 137,
539
- column: 20
540
- }
541
- },
542
- loc: {
543
- start: {
544
- line: 137,
545
- column: 35
546
- },
547
- end: {
548
- line: 152,
549
- column: 1
550
- }
551
- },
552
- line: 137
553
- },
554
- "8": {
555
- name: "resolveAdapterPath",
556
- decl: {
557
- start: {
558
- line: 158,
559
- column: 9
560
- },
561
- end: {
562
- line: 158,
563
- column: 27
564
- }
565
- },
566
- loc: {
567
- start: {
568
- line: 158,
569
- column: 49
570
- },
571
- end: {
572
- line: 175,
573
- column: 1
574
- }
575
- },
576
- line: 158
577
- },
578
- "9": {
579
- name: "getGitRootPath",
580
- decl: {
581
- start: {
582
- line: 177,
583
- column: 9
584
- },
585
- end: {
586
- line: 177,
587
- column: 23
588
- }
589
- },
590
- loc: {
591
- start: {
592
- line: 177,
593
- column: 27
594
- },
595
- end: {
596
- line: 179,
597
- column: 1
598
- }
599
- },
600
- line: 177
601
- }
602
- },
603
- branchMap: {
604
- "0": {
605
- loc: {
606
- start: {
607
- line: 47,
608
- column: 15
609
- },
610
- end: {
611
- line: 47,
612
- column: 61
613
- }
614
- },
615
- type: "binary-expr",
616
- locations: [{
617
- start: {
618
- line: 47,
619
- column: 15
620
- },
621
- end: {
622
- line: 47,
623
- column: 53
624
- }
625
- }, {
626
- start: {
627
- line: 47,
628
- column: 57
629
- },
630
- end: {
631
- line: 47,
632
- column: 61
633
- }
634
- }],
635
- line: 47
636
- },
637
- "1": {
638
- loc: {
639
- start: {
640
- line: 50,
641
- column: 2
642
- },
643
- end: {
644
- line: 52,
645
- column: 3
646
- }
647
- },
648
- type: "if",
649
- locations: [{
650
- start: {
651
- line: 50,
652
- column: 2
653
- },
654
- end: {
655
- line: 52,
656
- column: 3
657
- }
658
- }, {
659
- start: {
660
- line: undefined,
661
- column: undefined
662
- },
663
- end: {
664
- line: undefined,
665
- column: undefined
666
- }
667
- }],
668
- line: 50
669
- },
670
- "2": {
671
- loc: {
672
- start: {
673
- line: 74,
674
- column: 9
675
- },
676
- end: {
677
- line: 74,
678
- column: 67
679
- }
680
- },
681
- type: "binary-expr",
682
- locations: [{
683
- start: {
684
- line: 74,
685
- column: 9
686
- },
687
- end: {
688
- line: 74,
689
- column: 48
690
- }
691
- }, {
692
- start: {
693
- line: 74,
694
- column: 52
695
- },
696
- end: {
697
- line: 74,
698
- column: 67
699
- }
700
- }],
701
- line: 74
702
- },
703
- "3": {
704
- loc: {
705
- start: {
706
- line: 80,
707
- column: 71
708
- },
709
- end: {
710
- line: 80,
711
- column: 93
712
- }
713
- },
714
- type: "default-arg",
715
- locations: [{
716
- start: {
717
- line: 80,
718
- column: 88
719
- },
720
- end: {
721
- line: 80,
722
- column: 93
723
- }
724
- }],
725
- line: 80
726
- },
727
- "4": {
728
- loc: {
729
- start: {
730
- line: 95,
731
- column: 2
732
- },
733
- end: {
734
- line: 99,
735
- column: 3
736
- }
737
- },
738
- type: "if",
739
- locations: [{
740
- start: {
741
- line: 95,
742
- column: 2
743
- },
744
- end: {
745
- line: 99,
746
- column: 3
747
- }
748
- }],
749
- line: 95
750
- },
751
- "5": {
752
- loc: {
753
- start: {
754
- line: 95,
755
- column: 6
756
- },
757
- end: {
758
- line: 95,
759
- column: 65
760
- }
761
- },
762
- type: "binary-expr",
763
- locations: [{
764
- start: {
765
- line: 95,
766
- column: 6
767
- },
768
- end: {
769
- line: 95,
770
- column: 28
771
- }
772
- }, {
773
- start: {
774
- line: 95,
775
- column: 32
776
- },
777
- end: {
778
- line: 95,
779
- column: 65
780
- }
781
- }],
782
- line: 95
783
- },
784
- "6": {
785
- loc: {
786
- start: {
787
- line: 114,
788
- column: 17
789
- },
790
- end: {
791
- line: 114,
792
- column: 56
793
- }
794
- },
795
- type: "cond-expr",
796
- locations: [{
797
- start: {
798
- line: 114,
799
- column: 36
800
- },
801
- end: {
802
- line: 114,
803
- column: 44
804
- }
805
- }, {
806
- start: {
807
- line: 114,
808
- column: 47
809
- },
810
- end: {
811
- line: 114,
812
- column: 56
813
- }
814
- }],
815
- line: 114
816
- },
817
- "7": {
818
- loc: {
819
- start: {
820
- line: 114,
821
- column: 17
822
- },
823
- end: {
824
- line: 114,
825
- column: 33
826
- }
827
- },
828
- type: "binary-expr",
829
- locations: [{
830
- start: {
831
- line: 114,
832
- column: 17
833
- },
834
- end: {
835
- line: 114,
836
- column: 21
837
- }
838
- }, {
839
- start: {
840
- line: 114,
841
- column: 25
842
- },
843
- end: {
844
- line: 114,
845
- column: 33
846
- }
847
- }],
848
- line: 114
849
- },
850
- "8": {
851
- loc: {
852
- start: {
853
- line: 115,
854
- column: 20
855
- },
856
- end: {
857
- line: 115,
858
- column: 54
859
- }
860
- },
861
- type: "cond-expr",
862
- locations: [{
863
- start: {
864
- line: 115,
865
- column: 30
866
- },
867
- end: {
868
- line: 115,
869
- column: 42
870
- }
871
- }, {
872
- start: {
873
- line: 115,
874
- column: 45
875
- },
876
- end: {
877
- line: 115,
878
- column: 54
879
- }
880
- }],
881
- line: 115
882
- },
883
- "9": {
884
- loc: {
885
- start: {
886
- line: 116,
887
- column: 22
888
- },
889
- end: {
890
- line: 116,
891
- column: 60
892
- }
893
- },
894
- type: "cond-expr",
895
- locations: [{
896
- start: {
897
- line: 116,
898
- column: 34
899
- },
900
- end: {
901
- line: 116,
902
- column: 48
903
- }
904
- }, {
905
- start: {
906
- line: 116,
907
- column: 51
908
- },
909
- end: {
910
- line: 116,
911
- column: 60
912
- }
913
- }],
914
- line: 116
915
- },
916
- "10": {
917
- loc: {
918
- start: {
919
- line: 117,
920
- column: 18
921
- },
922
- end: {
923
- line: 117,
924
- column: 47
925
- }
926
- },
927
- type: "cond-expr",
928
- locations: [{
929
- start: {
930
- line: 117,
931
- column: 26
932
- },
933
- end: {
934
- line: 117,
935
- column: 35
936
- }
937
- }, {
938
- start: {
939
- line: 117,
940
- column: 38
941
- },
942
- end: {
943
- line: 117,
944
- column: 47
945
- }
946
- }],
947
- line: 117
948
- },
949
- "11": {
950
- loc: {
951
- start: {
952
- line: 120,
953
- column: 16
954
- },
955
- end: {
956
- line: 120,
957
- column: 41
958
- }
959
- },
960
- type: "cond-expr",
961
- locations: [{
962
- start: {
963
- line: 120,
964
- column: 22
965
- },
966
- end: {
967
- line: 120,
968
- column: 29
969
- }
970
- }, {
971
- start: {
972
- line: 120,
973
- column: 32
974
- },
975
- end: {
976
- line: 120,
977
- column: 41
978
- }
979
- }],
980
- line: 120
981
- },
982
- "12": {
983
- loc: {
984
- start: {
985
- line: 121,
986
- column: 18
987
- },
988
- end: {
989
- line: 121,
990
- column: 47
991
- }
992
- },
993
- type: "cond-expr",
994
- locations: [{
995
- start: {
996
- line: 121,
997
- column: 26
998
- },
999
- end: {
1000
- line: 121,
1001
- column: 35
1002
- }
1003
- }, {
1004
- start: {
1005
- line: 121,
1006
- column: 38
1007
- },
1008
- end: {
1009
- line: 121,
1010
- column: 47
1011
- }
1012
- }],
1013
- line: 121
1014
- },
1015
- "13": {
1016
- loc: {
1017
- start: {
1018
- line: 122,
1019
- column: 18
1020
- },
1021
- end: {
1022
- line: 122,
1023
- column: 47
1024
- }
1025
- },
1026
- type: "cond-expr",
1027
- locations: [{
1028
- start: {
1029
- line: 122,
1030
- column: 26
1031
- },
1032
- end: {
1033
- line: 122,
1034
- column: 35
1035
- }
1036
- }, {
1037
- start: {
1038
- line: 122,
1039
- column: 38
1040
- },
1041
- end: {
1042
- line: 122,
1043
- column: 47
1044
- }
1045
- }],
1046
- line: 122
1047
- },
1048
- "14": {
1049
- loc: {
1050
- start: {
1051
- line: 125,
1052
- column: 17
1053
- },
1054
- end: {
1055
- line: 125,
1056
- column: 61
1057
- }
1058
- },
1059
- type: "cond-expr",
1060
- locations: [{
1061
- start: {
1062
- line: 125,
1063
- column: 36
1064
- },
1065
- end: {
1066
- line: 125,
1067
- column: 49
1068
- }
1069
- }, {
1070
- start: {
1071
- line: 125,
1072
- column: 52
1073
- },
1074
- end: {
1075
- line: 125,
1076
- column: 61
1077
- }
1078
- }],
1079
- line: 125
1080
- },
1081
- "15": {
1082
- loc: {
1083
- start: {
1084
- line: 125,
1085
- column: 17
1086
- },
1087
- end: {
1088
- line: 125,
1089
- column: 33
1090
- }
1091
- },
1092
- type: "binary-expr",
1093
- locations: [{
1094
- start: {
1095
- line: 125,
1096
- column: 17
1097
- },
1098
- end: {
1099
- line: 125,
1100
- column: 21
1101
- }
1102
- }, {
1103
- start: {
1104
- line: 125,
1105
- column: 25
1106
- },
1107
- end: {
1108
- line: 125,
1109
- column: 33
1110
- }
1111
- }],
1112
- line: 125
1113
- },
1114
- "16": {
1115
- loc: {
1116
- start: {
1117
- line: 126,
1118
- column: 16
1119
- },
1120
- end: {
1121
- line: 126,
1122
- column: 50
1123
- }
1124
- },
1125
- type: "cond-expr",
1126
- locations: [{
1127
- start: {
1128
- line: 126,
1129
- column: 26
1130
- },
1131
- end: {
1132
- line: 126,
1133
- column: 38
1134
- }
1135
- }, {
1136
- start: {
1137
- line: 126,
1138
- column: 41
1139
- },
1140
- end: {
1141
- line: 126,
1142
- column: 50
1143
- }
1144
- }],
1145
- line: 126
1146
- },
1147
- "17": {
1148
- loc: {
1149
- start: {
1150
- line: 127,
1151
- column: 18
1152
- },
1153
- end: {
1154
- line: 127,
1155
- column: 56
1156
- }
1157
- },
1158
- type: "cond-expr",
1159
- locations: [{
1160
- start: {
1161
- line: 127,
1162
- column: 30
1163
- },
1164
- end: {
1165
- line: 127,
1166
- column: 44
1167
- }
1168
- }, {
1169
- start: {
1170
- line: 127,
1171
- column: 47
1172
- },
1173
- end: {
1174
- line: 127,
1175
- column: 56
1176
- }
1177
- }],
1178
- line: 127
1179
- },
1180
- "18": {
1181
- loc: {
1182
- start: {
1183
- line: 131,
1184
- column: 9
1185
- },
1186
- end: {
1187
- line: 131,
1188
- column: 35
1189
- }
1190
- },
1191
- type: "binary-expr",
1192
- locations: [{
1193
- start: {
1194
- line: 131,
1195
- column: 9
1196
- },
1197
- end: {
1198
- line: 131,
1199
- column: 28
1200
- }
1201
- }, {
1202
- start: {
1203
- line: 131,
1204
- column: 32
1205
- },
1206
- end: {
1207
- line: 131,
1208
- column: 35
1209
- }
1210
- }],
1211
- line: 131
1212
- },
1213
- "19": {
1214
- loc: {
1215
- start: {
1216
- line: 161,
1217
- column: 15
1218
- },
1219
- end: {
1220
- line: 161,
1221
- column: 68
1222
- }
1223
- },
1224
- type: "binary-expr",
1225
- locations: [{
1226
- start: {
1227
- line: 161,
1228
- column: 15
1229
- },
1230
- end: {
1231
- line: 161,
1232
- column: 36
1233
- }
1234
- }, {
1235
- start: {
1236
- line: 161,
1237
- column: 40
1238
- },
1239
- end: {
1240
- line: 161,
1241
- column: 68
1242
- }
1243
- }],
1244
- line: 161
1245
- },
1246
- "20": {
1247
- loc: {
1248
- start: {
1249
- line: 164,
1250
- column: 28
1251
- },
1252
- end: {
1253
- line: 166,
1254
- column: 22
1255
- }
1256
- },
1257
- type: "cond-expr",
1258
- locations: [{
1259
- start: {
1260
- line: 165,
1261
- column: 4
1262
- },
1263
- end: {
1264
- line: 165,
1265
- column: 54
1266
- }
1267
- }, {
1268
- start: {
1269
- line: 166,
1270
- column: 4
1271
- },
1272
- end: {
1273
- line: 166,
1274
- column: 22
1275
- }
1276
- }],
1277
- line: 164
1278
- }
1279
- },
1280
- s: {
1281
- "0": 0,
1282
- "1": 0,
1283
- "2": 0,
1284
- "3": 0,
1285
- "4": 0,
1286
- "5": 0,
1287
- "6": 0,
1288
- "7": 0,
1289
- "8": 0,
1290
- "9": 0,
1291
- "10": 0,
1292
- "11": 0,
1293
- "12": 0,
1294
- "13": 0,
1295
- "14": 0,
1296
- "15": 0,
1297
- "16": 0,
1298
- "17": 0,
1299
- "18": 0,
1300
- "19": 0,
1301
- "20": 0,
1302
- "21": 0,
1303
- "22": 0,
1304
- "23": 0,
1305
- "24": 0,
1306
- "25": 0,
1307
- "26": 0,
1308
- "27": 0,
1309
- "28": 0,
1310
- "29": 0,
1311
- "30": 0,
1312
- "31": 0,
1313
- "32": 0
1314
- },
1315
- f: {
1316
- "0": 0,
1317
- "1": 0,
1318
- "2": 0,
1319
- "3": 0,
1320
- "4": 0,
1321
- "5": 0,
1322
- "6": 0,
1323
- "7": 0,
1324
- "8": 0,
1325
- "9": 0
1326
- },
1327
- b: {
1328
- "0": [0, 0],
1329
- "1": [0, 0],
1330
- "2": [0, 0],
1331
- "3": [0],
1332
- "4": [0],
1333
- "5": [0, 0],
1334
- "6": [0, 0],
1335
- "7": [0, 0],
1336
- "8": [0, 0],
1337
- "9": [0, 0],
1338
- "10": [0, 0],
1339
- "11": [0, 0],
1340
- "12": [0, 0],
1341
- "13": [0, 0],
1342
- "14": [0, 0],
1343
- "15": [0, 0],
1344
- "16": [0, 0],
1345
- "17": [0, 0],
1346
- "18": [0, 0],
1347
- "19": [0, 0],
1348
- "20": [0, 0]
1349
- },
1350
- _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
1351
- hash: "e37ec3ccafde4f581a254419294338bc76165289"
1352
- };
1353
- var coverage = global[gcv] || (global[gcv] = {});
1354
- if (!coverage[path] || coverage[path].hash !== hash) {
1355
- coverage[path] = coverageData;
1356
- }
1357
- var actualCoverage = coverage[path];
1358
- {
1359
- // @ts-ignore
1360
- cov_16lcdpz3tp = function () {
1361
- return actualCoverage;
1362
- };
1363
- }
1364
- return actualCoverage;
1365
- }
1366
- cov_16lcdpz3tp();
1367
20
  /**
1368
21
  * ADAPTER
1369
22
  *
@@ -1378,38 +31,41 @@ cov_16lcdpz3tp();
1378
31
  * Must be passed an absolute path to the cli's root
1379
32
  */
1380
33
  function addPathToAdapterConfig(cliPath, repoPath, adapterNpmName) {
1381
- cov_16lcdpz3tp().f[0]++;
1382
- let commitizenAdapterConfig = (cov_16lcdpz3tp().s[0]++, {
34
+ let commitizenAdapterConfig = {
1383
35
  config: {
1384
36
  commitizen: {
1385
37
  path: `./node_modules/${adapterNpmName}`
1386
38
  }
1387
39
  }
1388
- });
1389
- let packageJsonPath = (cov_16lcdpz3tp().s[1]++, _path.default.join(getNearestProjectRootDirectory(repoPath), 'package.json'));
1390
- let packageJsonString = (cov_16lcdpz3tp().s[2]++, _fs.default.readFileSync(packageJsonPath, 'utf-8'));
40
+ };
41
+ let packageJsonPath = _nodePath.default.join(getNearestProjectRootDirectory(repoPath), 'package.json');
42
+ let packageJsonString = _nodeFs.default.readFileSync(packageJsonPath, 'utf-8');
1391
43
  // tries to detect the indentation and falls back to a default if it can't
1392
- let indent = (cov_16lcdpz3tp().s[3]++, (cov_16lcdpz3tp().b[0][0]++, (0, _detectIndent.default)(packageJsonString).indent) || (cov_16lcdpz3tp().b[0][1]++, ' '));
1393
- let packageJsonContent = (cov_16lcdpz3tp().s[4]++, JSON.parse(packageJsonString));
1394
- let newPackageJsonContent = (cov_16lcdpz3tp().s[5]++, '');
1395
- cov_16lcdpz3tp().s[6]++;
1396
- if (_lodash.default.get(packageJsonContent, 'config.commitizen.path') !== adapterNpmName) {
1397
- cov_16lcdpz3tp().b[1][0]++;
1398
- cov_16lcdpz3tp().s[7]++;
1399
- newPackageJsonContent = _lodash.default.merge(packageJsonContent, commitizenAdapterConfig);
1400
- } else {
1401
- cov_16lcdpz3tp().b[1][1]++;
44
+ let indent = (0, _detectIndent.default)(packageJsonString).indent || ' ';
45
+ let packageJsonContent = JSON.parse(packageJsonString);
46
+ let currentAdapterPath = packageJsonContent.config?.commitizen?.path;
47
+
48
+ // Already pointing at this adapter (bare name or ./node_modules path): leave
49
+ // package.json untouched.
50
+ if (currentAdapterPath === adapterNpmName || currentAdapterPath === commitizenAdapterConfig.config.commitizen.path) {
51
+ return;
1402
52
  }
1403
- cov_16lcdpz3tp().s[8]++;
1404
- _fs.default.writeFileSync(packageJsonPath, JSON.stringify(newPackageJsonContent, null, indent) + '\n');
53
+
54
+ // Set config.commitizen.path, keeping any other config / commitizen keys.
55
+ packageJsonContent.config = {
56
+ ...packageJsonContent.config,
57
+ commitizen: {
58
+ ...packageJsonContent.config?.commitizen,
59
+ path: commitizenAdapterConfig.config.commitizen.path
60
+ }
61
+ };
62
+ _nodeFs.default.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, indent) + '\n');
1405
63
  }
1406
64
 
1407
65
  /*
1408
66
  * Get additional options for install command
1409
67
  */
1410
68
  function getInstallOptions(stringMappings) {
1411
- cov_16lcdpz3tp().f[1]++;
1412
- cov_16lcdpz3tp().s[9]++;
1413
69
  return Array.from(stringMappings.values()).filter(Boolean).join(" ");
1414
70
  }
1415
71
 
@@ -1417,23 +73,19 @@ function getInstallOptions(stringMappings) {
1417
73
  * Get specific install command for passed package manager
1418
74
  */
1419
75
  function getInstallCommand(packageManager) {
1420
- cov_16lcdpz3tp().f[2]++;
1421
- const fallbackCommand = (cov_16lcdpz3tp().s[10]++, 'install');
1422
- const commandByPackageManager = (cov_16lcdpz3tp().s[11]++, {
76
+ const fallbackCommand = 'install';
77
+ const commandByPackageManager = {
1423
78
  npm: 'install',
1424
79
  yarn: 'add',
1425
80
  pnpm: 'add'
1426
- });
1427
- cov_16lcdpz3tp().s[12]++;
1428
- return (cov_16lcdpz3tp().b[2][0]++, commandByPackageManager[packageManager]) || (cov_16lcdpz3tp().b[2][1]++, fallbackCommand);
81
+ };
82
+ return commandByPackageManager[packageManager] || fallbackCommand;
1429
83
  }
1430
84
 
1431
85
  /**
1432
86
  * Generates an npm install command given a map of strings and a package name
1433
87
  */
1434
- function generateInstallAdapterCommand(stringMappings, adapterNpmName, packageManager = (cov_16lcdpz3tp().b[3][0]++, "npm")) {
1435
- cov_16lcdpz3tp().f[3]++;
1436
- cov_16lcdpz3tp().s[13]++;
88
+ function generateInstallAdapterCommand(stringMappings, adapterNpmName, packageManager = "npm") {
1437
89
  return `${packageManager} ${getInstallCommand(packageManager)} ${adapterNpmName} ${getInstallOptions(stringMappings)}`;
1438
90
  }
1439
91
 
@@ -1441,18 +93,16 @@ function generateInstallAdapterCommand(stringMappings, adapterNpmName, packageMa
1441
93
  * Gets the nearest npm_modules directory
1442
94
  */
1443
95
  function getNearestNodeModulesDirectory(options) {
1444
- cov_16lcdpz3tp().f[4]++;
1445
- // Get the nearest node_modules directories to the current working directory
1446
- let nodeModulesDirectories = (cov_16lcdpz3tp().s[14]++, (0, _findNodeModules.default)(options));
96
+ // Get the nearest node_modules directory to the current working directory
97
+ // (or options / options.cwd), relative to that directory
98
+ let cwd = typeof options === 'string' ? options : options?.cwd;
99
+ let nodeModulesDirectory = (0, _util.findNearestNodeModules)(cwd);
1447
100
 
1448
101
  // Make sure we find a node_modules folder
1449
102
 
1450
103
  /* istanbul ignore else */
1451
- cov_16lcdpz3tp().s[15]++;
1452
- if ((cov_16lcdpz3tp().b[5][0]++, nodeModulesDirectories) && (cov_16lcdpz3tp().b[5][1]++, nodeModulesDirectories.length > 0)) {
1453
- cov_16lcdpz3tp().b[4][0]++;
1454
- cov_16lcdpz3tp().s[16]++;
1455
- return nodeModulesDirectories[0];
104
+ if (nodeModulesDirectory !== undefined) {
105
+ return nodeModulesDirectory;
1456
106
  } else {
1457
107
  console.error(`Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?`);
1458
108
  }
@@ -1462,9 +112,7 @@ function getNearestNodeModulesDirectory(options) {
1462
112
  * Gets the nearest project root directory
1463
113
  */
1464
114
  function getNearestProjectRootDirectory(repoPath, options) {
1465
- cov_16lcdpz3tp().f[5]++;
1466
- cov_16lcdpz3tp().s[17]++;
1467
- return _path.default.join(repoPath, getNearestNodeModulesDirectory(options), '/../');
115
+ return _nodePath.default.join(repoPath, getNearestNodeModulesDirectory(options), '/../');
1468
116
  }
1469
117
 
1470
118
  /**
@@ -1478,29 +126,29 @@ function getInstallStringMappings({
1478
126
  saveExact,
1479
127
  force
1480
128
  }, packageManager) {
1481
- cov_16lcdpz3tp().f[6]++;
1482
- const npm = (cov_16lcdpz3tp().s[18]++, new Map().set('save', (cov_16lcdpz3tp().b[7][0]++, save) && (cov_16lcdpz3tp().b[7][1]++, !saveDev) ? (cov_16lcdpz3tp().b[6][0]++, '--save') : (cov_16lcdpz3tp().b[6][1]++, undefined)).set('saveDev', saveDev ? (cov_16lcdpz3tp().b[8][0]++, '--save-dev') : (cov_16lcdpz3tp().b[8][1]++, undefined)).set('saveExact', saveExact ? (cov_16lcdpz3tp().b[9][0]++, '--save-exact') : (cov_16lcdpz3tp().b[9][1]++, undefined)).set('force', force ? (cov_16lcdpz3tp().b[10][0]++, '--force') : (cov_16lcdpz3tp().b[10][1]++, undefined)));
1483
- const yarn = (cov_16lcdpz3tp().s[19]++, new Map().set('dev', dev ? (cov_16lcdpz3tp().b[11][0]++, '--dev') : (cov_16lcdpz3tp().b[11][1]++, undefined)).set('exact', exact ? (cov_16lcdpz3tp().b[12][0]++, '--exact') : (cov_16lcdpz3tp().b[12][1]++, undefined)).set('force', force ? (cov_16lcdpz3tp().b[13][0]++, '--force') : (cov_16lcdpz3tp().b[13][1]++, undefined)));
1484
- const pnpm = (cov_16lcdpz3tp().s[20]++, new Map().set('save', (cov_16lcdpz3tp().b[15][0]++, save) && (cov_16lcdpz3tp().b[15][1]++, !saveDev) ? (cov_16lcdpz3tp().b[14][0]++, '--save-prod') : (cov_16lcdpz3tp().b[14][1]++, undefined)).set('dev', saveDev ? (cov_16lcdpz3tp().b[16][0]++, '--save-dev') : (cov_16lcdpz3tp().b[16][1]++, undefined)).set('exact', saveExact ? (cov_16lcdpz3tp().b[17][0]++, '--save-exact') : (cov_16lcdpz3tp().b[17][1]++, undefined)));
1485
- const map = (cov_16lcdpz3tp().s[21]++, {
129
+ const npm = new Map().set('save', save && !saveDev ? '--save' : undefined).set('saveDev', saveDev ? '--save-dev' : undefined).set('saveExact', saveExact ? '--save-exact' : undefined).set('force', force ? '--force' : undefined);
130
+ const yarn = new Map().set('dev', dev ? '--dev' : undefined).set('exact', exact ? '--exact' : undefined).set('force', force ? '--force' : undefined);
131
+ const pnpm = new Map().set('save', save && !saveDev ? '--save-prod' : undefined).set('dev', saveDev ? '--save-dev' : undefined).set('exact', exact || saveExact ? '--save-exact' : undefined)
132
+ // pnpm >= 10 turns "ignored build scripts" into a hard error; commitizen
133
+ // adapters never need their dependencies' install scripts to run.
134
+ .set('ignoreScripts', '--ignore-scripts');
135
+ const map = {
1486
136
  npm,
1487
137
  yarn,
1488
138
  pnpm
1489
- });
1490
- cov_16lcdpz3tp().s[22]++;
1491
- return (cov_16lcdpz3tp().b[18][0]++, map[packageManager]) || (cov_16lcdpz3tp().b[18][1]++, npm);
139
+ };
140
+ return map[packageManager] || npm;
1492
141
  }
1493
142
 
1494
143
  /**
1495
144
  * Gets the prompter from an adapter given an adapter path
1496
145
  */
1497
146
  function getPrompter(adapterPath) {
1498
- cov_16lcdpz3tp().f[7]++;
1499
147
  // Resolve the adapter path
1500
- let resolvedAdapterPath = (cov_16lcdpz3tp().s[23]++, resolveAdapterPath(adapterPath));
148
+ let resolvedAdapterPath = resolveAdapterPath(adapterPath);
1501
149
 
1502
150
  // Load the adapter
1503
- let adapter = (cov_16lcdpz3tp().s[24]++, require(resolvedAdapterPath));
151
+ let adapter = require(resolvedAdapterPath);
1504
152
 
1505
153
  /* istanbul ignore next */
1506
154
  if (adapter && adapter.prompter && (0, _util.isFunction)(adapter.prompter)) {
@@ -1517,29 +165,22 @@ function getPrompter(adapterPath) {
1517
165
  * return a located adapter path or will throw.
1518
166
  */
1519
167
  function resolveAdapterPath(inboundAdapterPath) {
1520
- cov_16lcdpz3tp().f[8]++;
1521
168
  // Check if inboundAdapterPath is a path or node module name
1522
- let parsed = (cov_16lcdpz3tp().s[25]++, _path.default.parse(inboundAdapterPath));
1523
- let isPath = (cov_16lcdpz3tp().s[26]++, (cov_16lcdpz3tp().b[19][0]++, parsed.dir.length > 0) && (cov_16lcdpz3tp().b[19][1]++, parsed.dir.charAt(0) !== "@"));
169
+ let parsed = _nodePath.default.parse(inboundAdapterPath);
170
+ let isPath = parsed.dir.length > 0 && parsed.dir.charAt(0) !== "@";
1524
171
 
1525
172
  // Resolve from the root of the git repo if inboundAdapterPath is a path
1526
- let absoluteAdapterPath = (cov_16lcdpz3tp().s[27]++, isPath ? (cov_16lcdpz3tp().b[20][0]++, _path.default.resolve(getGitRootPath(), inboundAdapterPath)) : (cov_16lcdpz3tp().b[20][1]++, inboundAdapterPath));
1527
- cov_16lcdpz3tp().s[28]++;
173
+ let absoluteAdapterPath = isPath ? _nodePath.default.resolve(getGitRootPath(), inboundAdapterPath) : inboundAdapterPath;
1528
174
  try {
1529
- cov_16lcdpz3tp().s[29]++;
1530
175
  // try to resolve the given path
1531
176
  return require.resolve(absoluteAdapterPath);
1532
177
  } catch (error) {
1533
- cov_16lcdpz3tp().s[30]++;
1534
178
  error.message = "Could not resolve " + absoluteAdapterPath + ". " + error.message;
1535
- cov_16lcdpz3tp().s[31]++;
1536
179
  throw error;
1537
180
  }
1538
181
  }
1539
182
  function getGitRootPath() {
1540
- cov_16lcdpz3tp().f[9]++;
1541
- cov_16lcdpz3tp().s[32]++;
1542
- return _child_process.default.spawnSync('git', ['rev-parse', '--show-toplevel'], {
183
+ return _nodeChild_process.default.spawnSync('git', ['rev-parse', '--show-toplevel'], {
1543
184
  encoding: 'utf8'
1544
185
  }).stdout.trim();
1545
186
  }