commitizen 4.3.2 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,546 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _path = _interopRequireDefault(require("path"));
7
+ var _nodePath = _interopRequireDefault(require("node:path"));
8
8
  var _cachedir = _interopRequireDefault(require("cachedir"));
9
- var _fsExtra = require("fs-extra");
9
+ var _nodeFs = require("node:fs");
10
10
  var _git = require("../git");
11
11
  var cache = _interopRequireWildcard(require("./cache"));
12
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ var e;
13
+ function _interopRequireWildcard(t, r) { if (!r && t && t.__esModule) return t; var n, a, o = Object.defineProperty, f = { __proto__: null, default: t }; if (Object(t) !== t) return f; if (e || "function" != typeof WeakMap || (e = new WeakMap()), e) { if (e.has(t)) return e.get(t); e.set(t, f); } for (a in t) "default" !== a && {}.hasOwnProperty.call(t, a) && ((n = o && Object.getOwnPropertyDescriptor(t, a)) && (n.get || n.set) ? o(f, a, n) : f[a] = t[a]); return f; }
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function cov_g0ukcvuof() {
15
- var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/commit.js";
16
- var hash = "4a518579188a2aabf17606ae1fd56644666d7e1b";
17
- var global = new Function("return this")();
18
- var gcv = "__coverage__";
19
- var coverageData = {
20
- path: "/home/runner/work/cz-cli/cz-cli/src/commitizen/commit.js",
21
- statementMap: {
22
- "0": {
23
- start: {
24
- line: 15,
25
- column: 4
26
- },
27
- end: {
28
- line: 17,
29
- column: 7
30
- }
31
- },
32
- "1": {
33
- start: {
34
- line: 16,
35
- column: 6
36
- },
37
- end: {
38
- line: 16,
39
- column: 28
40
- }
41
- },
42
- "2": {
43
- start: {
44
- line: 24,
45
- column: 23
46
- },
47
- end: {
48
- line: 24,
49
- column: 45
50
- }
51
- },
52
- "3": {
53
- start: {
54
- line: 25,
55
- column: 18
56
- },
57
- end: {
58
- line: 25,
59
- column: 62
60
- }
61
- },
62
- "4": {
63
- start: {
64
- line: 27,
65
- column: 2
66
- },
67
- end: {
68
- line: 66,
69
- column: 5
70
- }
71
- },
72
- "5": {
73
- start: {
74
- line: 28,
75
- column: 4
76
- },
77
- end: {
78
- line: 65,
79
- column: 5
80
- }
81
- },
82
- "6": {
83
- start: {
84
- line: 29,
85
- column: 6
86
- },
87
- end: {
88
- line: 29,
89
- column: 75
90
- }
91
- },
92
- "7": {
93
- start: {
94
- line: 32,
95
- column: 6
96
- },
97
- end: {
98
- line: 64,
99
- column: 7
100
- }
101
- },
102
- "8": {
103
- start: {
104
- line: 34,
105
- column: 8
106
- },
107
- end: {
108
- line: 34,
109
- column: 53
110
- }
111
- },
112
- "9": {
113
- start: {
114
- line: 42,
115
- column: 12
116
- },
117
- end: {
118
- line: 42,
119
- column: 56
120
- }
121
- },
122
- "10": {
123
- start: {
124
- line: 43,
125
- column: 8
126
- },
127
- end: {
128
- line: 43,
129
- column: 93
130
- }
131
- },
132
- "11": {
133
- start: {
134
- line: 47,
135
- column: 8
136
- },
137
- end: {
138
- line: 63,
139
- column: 11
140
- }
141
- },
142
- "12": {
143
- start: {
144
- line: 50,
145
- column: 10
146
- },
147
- end: {
148
- line: 54,
149
- column: 11
150
- }
151
- },
152
- "13": {
153
- start: {
154
- line: 51,
155
- column: 12
156
- },
157
- end: {
158
- line: 51,
159
- column: 39
160
- }
161
- },
162
- "14": {
163
- start: {
164
- line: 52,
165
- column: 12
166
- },
167
- end: {
168
- line: 52,
169
- column: 29
170
- }
171
- },
172
- "15": {
173
- start: {
174
- line: 53,
175
- column: 12
176
- },
177
- end: {
178
- line: 53,
179
- column: 25
180
- }
181
- },
182
- "16": {
183
- start: {
184
- line: 56,
185
- column: 10
186
- },
187
- end: {
188
- line: 58,
189
- column: 11
190
- }
191
- },
192
- "17": {
193
- start: {
194
- line: 57,
195
- column: 12
196
- },
197
- end: {
198
- line: 57,
199
- column: 31
200
- }
201
- },
202
- "18": {
203
- start: {
204
- line: 61,
205
- column: 10
206
- },
207
- end: {
208
- line: 61,
209
- column: 95
210
- }
211
- },
212
- "19": {
213
- start: {
214
- line: 62,
215
- column: 10
216
- },
217
- end: {
218
- line: 62,
219
- column: 80
220
- }
221
- }
222
- },
223
- fnMap: {
224
- "0": {
225
- name: "dispatchGitCommit",
226
- decl: {
227
- start: {
228
- line: 13,
229
- column: 9
230
- },
231
- end: {
232
- line: 13,
233
- column: 26
234
- }
235
- },
236
- loc: {
237
- start: {
238
- line: 13,
239
- column: 80
240
- },
241
- end: {
242
- line: 18,
243
- column: 1
244
- }
245
- },
246
- line: 13
247
- },
248
- "1": {
249
- name: "(anonymous_1)",
250
- decl: {
251
- start: {
252
- line: 15,
253
- column: 70
254
- },
255
- end: {
256
- line: 15,
257
- column: 71
258
- }
259
- },
260
- loc: {
261
- start: {
262
- line: 15,
263
- column: 87
264
- },
265
- end: {
266
- line: 17,
267
- column: 5
268
- }
269
- },
270
- line: 15
271
- },
272
- "2": {
273
- name: "commit",
274
- decl: {
275
- start: {
276
- line: 23,
277
- column: 9
278
- },
279
- end: {
280
- line: 23,
281
- column: 15
282
- }
283
- },
284
- loc: {
285
- start: {
286
- line: 23,
287
- column: 62
288
- },
289
- end: {
290
- line: 68,
291
- column: 1
292
- }
293
- },
294
- line: 23
295
- },
296
- "3": {
297
- name: "(anonymous_3)",
298
- decl: {
299
- start: {
300
- line: 27,
301
- column: 28
302
- },
303
- end: {
304
- line: 27,
305
- column: 29
306
- }
307
- },
308
- loc: {
309
- start: {
310
- line: 27,
311
- column: 45
312
- },
313
- end: {
314
- line: 66,
315
- column: 3
316
- }
317
- },
318
- line: 27
319
- },
320
- "4": {
321
- name: "(anonymous_4)",
322
- decl: {
323
- start: {
324
- line: 47,
325
- column: 27
326
- },
327
- end: {
328
- line: 47,
329
- column: 28
330
- }
331
- },
332
- loc: {
333
- start: {
334
- line: 47,
335
- column: 71
336
- },
337
- end: {
338
- line: 63,
339
- column: 9
340
- }
341
- },
342
- line: 47
343
- }
344
- },
345
- branchMap: {
346
- "0": {
347
- loc: {
348
- start: {
349
- line: 28,
350
- column: 4
351
- },
352
- end: {
353
- line: 65,
354
- column: 5
355
- }
356
- },
357
- type: "if",
358
- locations: [{
359
- start: {
360
- line: 28,
361
- column: 4
362
- },
363
- end: {
364
- line: 65,
365
- column: 5
366
- }
367
- }, {
368
- start: {
369
- line: 31,
370
- column: 11
371
- },
372
- end: {
373
- line: 65,
374
- column: 5
375
- }
376
- }],
377
- line: 28
378
- },
379
- "1": {
380
- loc: {
381
- start: {
382
- line: 32,
383
- column: 6
384
- },
385
- end: {
386
- line: 64,
387
- column: 7
388
- }
389
- },
390
- type: "if",
391
- locations: [{
392
- start: {
393
- line: 32,
394
- column: 6
395
- },
396
- end: {
397
- line: 64,
398
- column: 7
399
- }
400
- }, {
401
- start: {
402
- line: 45,
403
- column: 13
404
- },
405
- end: {
406
- line: 64,
407
- column: 7
408
- }
409
- }],
410
- line: 32
411
- },
412
- "2": {
413
- loc: {
414
- start: {
415
- line: 50,
416
- column: 10
417
- },
418
- end: {
419
- line: 54,
420
- column: 11
421
- }
422
- },
423
- type: "if",
424
- locations: [{
425
- start: {
426
- line: 50,
427
- column: 10
428
- },
429
- end: {
430
- line: 54,
431
- column: 11
432
- }
433
- }, {
434
- start: {
435
- line: undefined,
436
- column: undefined
437
- },
438
- end: {
439
- line: undefined,
440
- column: undefined
441
- }
442
- }],
443
- line: 50
444
- },
445
- "3": {
446
- loc: {
447
- start: {
448
- line: 56,
449
- column: 10
450
- },
451
- end: {
452
- line: 58,
453
- column: 11
454
- }
455
- },
456
- type: "if",
457
- locations: [{
458
- start: {
459
- line: 56,
460
- column: 10
461
- },
462
- end: {
463
- line: 58,
464
- column: 11
465
- }
466
- }, {
467
- start: {
468
- line: undefined,
469
- column: undefined
470
- },
471
- end: {
472
- line: undefined,
473
- column: undefined
474
- }
475
- }],
476
- line: 56
477
- }
478
- },
479
- s: {
480
- "0": 0,
481
- "1": 0,
482
- "2": 0,
483
- "3": 0,
484
- "4": 0,
485
- "5": 0,
486
- "6": 0,
487
- "7": 0,
488
- "8": 0,
489
- "9": 0,
490
- "10": 0,
491
- "11": 0,
492
- "12": 0,
493
- "13": 0,
494
- "14": 0,
495
- "15": 0,
496
- "16": 0,
497
- "17": 0,
498
- "18": 0,
499
- "19": 0
500
- },
501
- f: {
502
- "0": 0,
503
- "1": 0,
504
- "2": 0,
505
- "3": 0,
506
- "4": 0
507
- },
508
- b: {
509
- "0": [0, 0],
510
- "1": [0, 0],
511
- "2": [0, 0],
512
- "3": [0, 0]
513
- },
514
- _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
515
- hash: "4a518579188a2aabf17606ae1fd56644666d7e1b"
516
- };
517
- var coverage = global[gcv] || (global[gcv] = {});
518
- if (!coverage[path] || coverage[path].hash !== hash) {
519
- coverage[path] = coverageData;
520
- }
521
- var actualCoverage = coverage[path];
522
- {
523
- // @ts-ignore
524
- cov_g0ukcvuof = function () {
525
- return actualCoverage;
526
- };
527
- }
528
- return actualCoverage;
529
- }
530
- cov_g0ukcvuof();
531
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
532
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
533
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
534
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
535
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
536
15
  var _default = exports.default = commit;
537
16
  /**
538
17
  * Takes all of the final inputs needed in order to make dispatch a git commit
539
18
  */
540
19
  function dispatchGitCommit(repoPath, template, options, overrideOptions, done) {
541
- cov_g0ukcvuof().f[0]++;
542
- cov_g0ukcvuof().s[0]++;
543
20
  // Commit the user input -- side effect that we'll test
544
- (0, _git.commit)(repoPath, template, _objectSpread(_objectSpread({}, options), overrideOptions), function (error) {
545
- cov_g0ukcvuof().f[1]++;
546
- cov_g0ukcvuof().s[1]++;
21
+ (0, _git.commit)(repoPath, template, {
22
+ ...options,
23
+ ...overrideOptions
24
+ }, function (error) {
547
25
  done(error, template);
548
26
  });
549
27
  }
@@ -552,24 +30,16 @@ function dispatchGitCommit(repoPath, template, options, overrideOptions, done) {
552
30
  * Asynchronously commits files using commitizen
553
31
  */
554
32
  function commit(inquirer, repoPath, prompter, options, done) {
555
- cov_g0ukcvuof().f[2]++;
556
- var cacheDirectory = (cov_g0ukcvuof().s[2]++, (0, _cachedir.default)('commitizen'));
557
- var cachePath = (cov_g0ukcvuof().s[3]++, _path.default.join(cacheDirectory, 'commitizen.json'));
558
- cov_g0ukcvuof().s[4]++;
559
- (0, _fsExtra.ensureDir)(cacheDirectory, function (error) {
560
- cov_g0ukcvuof().f[3]++;
561
- cov_g0ukcvuof().s[5]++;
33
+ var cacheDirectory = (0, _cachedir.default)('commitizen');
34
+ var cachePath = _nodePath.default.join(cacheDirectory, 'commitizen.json');
35
+ (0, _nodeFs.mkdir)(cacheDirectory, {
36
+ recursive: true
37
+ }, function (error) {
562
38
  if (error) {
563
- cov_g0ukcvuof().b[0][0]++;
564
- cov_g0ukcvuof().s[6]++;
565
39
  console.error("Couldn't create commitizen cache directory: ", error);
566
40
  // TODO: properly handle error?
567
41
  } else {
568
- cov_g0ukcvuof().b[0][1]++;
569
- cov_g0ukcvuof().s[7]++;
570
42
  if (options.retryLastCommit) {
571
- cov_g0ukcvuof().b[1][0]++;
572
- cov_g0ukcvuof().s[8]++;
573
43
  console.log('Retrying last commit attempt.');
574
44
 
575
45
  // We want to use the last commit instead of the current commit,
@@ -578,46 +48,28 @@ function commit(inquirer, repoPath, prompter, options, done) {
578
48
  options: retryOptions,
579
49
  overrideOptions: retryOverrideOptions,
580
50
  template: retryTemplate
581
- } = (cov_g0ukcvuof().s[9]++, cache.getCacheValueSync(cachePath, repoPath));
582
- cov_g0ukcvuof().s[10]++;
51
+ } = cache.getCacheValueSync(cachePath, repoPath);
583
52
  dispatchGitCommit(repoPath, retryTemplate, retryOptions, retryOverrideOptions, done);
584
53
  } else {
585
- cov_g0ukcvuof().b[1][1]++;
586
- cov_g0ukcvuof().s[11]++;
587
54
  // Get user input -- side effect that is hard to test
588
55
  prompter(inquirer, function (error, template, overrideOptions) {
589
- cov_g0ukcvuof().f[4]++;
590
- cov_g0ukcvuof().s[12]++;
591
56
  // Allow adapters to error out
592
57
  // (error: Error?, template: String, overrideOptions: Object)
593
58
  if (!(error instanceof Error)) {
594
- cov_g0ukcvuof().b[2][0]++;
595
- cov_g0ukcvuof().s[13]++;
596
59
  overrideOptions = template;
597
- cov_g0ukcvuof().s[14]++;
598
60
  template = error;
599
- cov_g0ukcvuof().s[15]++;
600
61
  error = null;
601
- } else {
602
- cov_g0ukcvuof().b[2][1]++;
603
62
  }
604
- cov_g0ukcvuof().s[16]++;
605
63
  if (error) {
606
- cov_g0ukcvuof().b[3][0]++;
607
- cov_g0ukcvuof().s[17]++;
608
64
  return done(error);
609
- } else {
610
- cov_g0ukcvuof().b[3][1]++;
611
65
  }
612
66
 
613
67
  // We don't want to add retries to the cache, only actual commands
614
- cov_g0ukcvuof().s[18]++;
615
68
  cache.setCacheValueSync(cachePath, repoPath, {
616
69
  template,
617
70
  options,
618
71
  overrideOptions
619
72
  });
620
- cov_g0ukcvuof().s[19]++;
621
73
  dispatchGitCommit(repoPath, template, options, overrideOptions, done);
622
74
  });
623
75
  }
@@ -5,91 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.load = load;
7
7
  var _configLoader = require("../configLoader");
8
- function cov_1itu0bpi0j() {
9
- var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/configLoader.js";
10
- var hash = "c627c83b933ee54517e9c98550128758f664f3aa";
11
- var global = new Function("return this")();
12
- var gcv = "__coverage__";
13
- var coverageData = {
14
- path: "/home/runner/work/cz-cli/cz-cli/src/commitizen/configLoader.js",
15
- statementMap: {
16
- "0": {
17
- start: {
18
- line: 6,
19
- column: 14
20
- },
21
- end: {
22
- line: 6,
23
- column: 51
24
- }
25
- },
26
- "1": {
27
- start: {
28
- line: 9,
29
- column: 2
30
- },
31
- end: {
32
- line: 9,
33
- column: 38
34
- }
35
- }
36
- },
37
- fnMap: {
38
- "0": {
39
- name: "load",
40
- decl: {
41
- start: {
42
- line: 8,
43
- column: 9
44
- },
45
- end: {
46
- line: 8,
47
- column: 13
48
- }
49
- },
50
- loc: {
51
- start: {
52
- line: 8,
53
- column: 28
54
- },
55
- end: {
56
- line: 10,
57
- column: 1
58
- }
59
- },
60
- line: 8
61
- }
62
- },
63
- branchMap: {},
64
- s: {
65
- "0": 0,
66
- "1": 0
67
- },
68
- f: {
69
- "0": 0
70
- },
71
- b: {},
72
- _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
73
- hash: "c627c83b933ee54517e9c98550128758f664f3aa"
74
- };
75
- var coverage = global[gcv] || (global[gcv] = {});
76
- if (!coverage[path] || coverage[path].hash !== hash) {
77
- coverage[path] = coverageData;
78
- }
79
- var actualCoverage = coverage[path];
80
- {
81
- // @ts-ignore
82
- cov_1itu0bpi0j = function () {
83
- return actualCoverage;
84
- };
85
- }
86
- return actualCoverage;
87
- }
88
- cov_1itu0bpi0j();
89
8
  // Configuration sources in priority order.
90
- var configs = (cov_1itu0bpi0j().s[0]++, ['.czrc', '.cz.json', 'package.json']);
9
+ var configs = ['.czrc', '.cz.json', 'package.json'];
91
10
  function load(config, cwd) {
92
- cov_1itu0bpi0j().f[0]++;
93
- cov_1itu0bpi0j().s[1]++;
94
11
  return (0, _configLoader.loader)(configs, config, cwd);
95
12
  }