commitizen 4.2.5 → 4.3.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.
@@ -6,13 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getCacheValueSync = getCacheValueSync;
7
7
  exports.readCacheSync = readCacheSync;
8
8
  exports.setCacheValueSync = setCacheValueSync;
9
-
10
9
  var _fs = _interopRequireDefault(require("fs"));
11
-
12
10
  var _lodash = _interopRequireDefault(require("lodash"));
13
-
14
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
12
  function cov_1557knvvim() {
17
13
  var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/cache.js";
18
14
  var hash = "23833091a58ef2217ec49ef06116296b4f6e0a60";
@@ -219,11 +215,9 @@ function cov_1557knvvim() {
219
215
  hash: "23833091a58ef2217ec49ef06116296b4f6e0a60"
220
216
  };
221
217
  var coverage = global[gcv] || (global[gcv] = {});
222
-
223
218
  if (!coverage[path] || coverage[path].hash !== hash) {
224
219
  coverage[path] = coverageData;
225
220
  }
226
-
227
221
  var actualCoverage = coverage[path];
228
222
  {
229
223
  // @ts-ignore
@@ -233,9 +227,7 @@ function cov_1557knvvim() {
233
227
  }
234
228
  return actualCoverage;
235
229
  }
236
-
237
230
  cov_1557knvvim();
238
-
239
231
  /**
240
232
  * Reads the entire cache
241
233
  */
@@ -244,16 +236,14 @@ function readCacheSync(cachePath) {
244
236
  cov_1557knvvim().s[0]++;
245
237
  return JSON.parse(_fs.default.readFileSync(cachePath, 'utf8'));
246
238
  }
239
+
247
240
  /**
248
241
  * Sets a cache value and writes the file to disk
249
242
  */
250
-
251
-
252
243
  function setCacheValueSync(cachePath, key, value) {
253
244
  cov_1557knvvim().f[1]++;
254
245
  var originalCache;
255
246
  cov_1557knvvim().s[1]++;
256
-
257
247
  try {
258
248
  cov_1557knvvim().s[2]++;
259
249
  originalCache = readCacheSync(cachePath);
@@ -261,26 +251,21 @@ function setCacheValueSync(cachePath, key, value) {
261
251
  cov_1557knvvim().s[3]++;
262
252
  originalCache = {};
263
253
  }
264
-
265
254
  var newCache = (cov_1557knvvim().s[4]++, _lodash.default.assign(originalCache, {
266
255
  [key]: value
267
256
  }));
268
257
  cov_1557knvvim().s[5]++;
269
-
270
258
  _fs.default.writeFileSync(cachePath, JSON.stringify(newCache, null, ' '));
271
-
272
259
  cov_1557knvvim().s[6]++;
273
260
  return newCache;
274
261
  }
262
+
275
263
  /**
276
264
  * Gets a single value from the cache given a key
277
265
  */
278
-
279
-
280
266
  function getCacheValueSync(cachePath, repoPath) {
281
267
  cov_1557knvvim().f[2]++;
282
268
  cov_1557knvvim().s[7]++;
283
-
284
269
  try {
285
270
  let cache = (cov_1557knvvim().s[8]++, readCacheSync(cachePath));
286
271
  cov_1557knvvim().s[9]++;
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _cachedir = _interopRequireDefault(require("cachedir"));
11
-
12
9
  var _fsExtra = require("fs-extra");
13
-
14
10
  var _git = require("../git");
15
-
16
11
  var cache = _interopRequireWildcard(require("./cache"));
17
-
18
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
15
  function cov_g0ukcvuof() {
25
16
  var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/commit.js";
26
17
  var hash = "4a518579188a2aabf17606ae1fd56644666d7e1b";
@@ -525,11 +516,9 @@ function cov_g0ukcvuof() {
525
516
  hash: "4a518579188a2aabf17606ae1fd56644666d7e1b"
526
517
  };
527
518
  var coverage = global[gcv] || (global[gcv] = {});
528
-
529
519
  if (!coverage[path] || coverage[path].hash !== hash) {
530
520
  coverage[path] = coverageData;
531
521
  }
532
-
533
522
  var actualCoverage = coverage[path];
534
523
  {
535
524
  // @ts-ignore
@@ -539,22 +528,17 @@ function cov_g0ukcvuof() {
539
528
  }
540
529
  return actualCoverage;
541
530
  }
542
-
543
531
  cov_g0ukcvuof();
544
-
545
532
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
546
-
547
533
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
548
-
549
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
550
-
534
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
535
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
536
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
551
537
  var _default = commit;
552
538
  /**
553
539
  * Takes all of the final inputs needed in order to make dispatch a git commit
554
540
  */
555
-
556
541
  exports.default = _default;
557
-
558
542
  function dispatchGitCommit(repoPath, template, options, overrideOptions, done) {
559
543
  cov_g0ukcvuof().f[0]++;
560
544
  cov_g0ukcvuof().s[0]++;
@@ -565,11 +549,10 @@ function dispatchGitCommit(repoPath, template, options, overrideOptions, done) {
565
549
  done(error, template);
566
550
  });
567
551
  }
552
+
568
553
  /**
569
554
  * Asynchronously commits files using commitizen
570
555
  */
571
-
572
-
573
556
  function commit(inquirer, repoPath, prompter, options, done) {
574
557
  cov_g0ukcvuof().f[2]++;
575
558
  var cacheDirectory = (cov_g0ukcvuof().s[2]++, (0, _cachedir.default)('commitizen'));
@@ -578,21 +561,21 @@ function commit(inquirer, repoPath, prompter, options, done) {
578
561
  (0, _fsExtra.ensureDir)(cacheDirectory, function (error) {
579
562
  cov_g0ukcvuof().f[3]++;
580
563
  cov_g0ukcvuof().s[5]++;
581
-
582
564
  if (error) {
583
565
  cov_g0ukcvuof().b[0][0]++;
584
566
  cov_g0ukcvuof().s[6]++;
585
- console.error("Couldn't create commitizen cache directory: ", error); // TODO: properly handle error?
567
+ console.error("Couldn't create commitizen cache directory: ", error);
568
+ // TODO: properly handle error?
586
569
  } else {
587
570
  cov_g0ukcvuof().b[0][1]++;
588
571
  cov_g0ukcvuof().s[7]++;
589
-
590
572
  if (options.retryLastCommit) {
591
573
  cov_g0ukcvuof().b[1][0]++;
592
574
  cov_g0ukcvuof().s[8]++;
593
- console.log('Retrying last commit attempt.'); // We want to use the last commit instead of the current commit,
594
- // so lets override some options using the values from cache.
575
+ console.log('Retrying last commit attempt.');
595
576
 
577
+ // We want to use the last commit instead of the current commit,
578
+ // so lets override some options using the values from cache.
596
579
  let {
597
580
  options: retryOptions,
598
581
  overrideOptions: retryOverrideOptions,
@@ -607,7 +590,6 @@ function commit(inquirer, repoPath, prompter, options, done) {
607
590
  prompter(inquirer, function (error, template, overrideOptions) {
608
591
  cov_g0ukcvuof().f[4]++;
609
592
  cov_g0ukcvuof().s[12]++;
610
-
611
593
  // Allow adapters to error out
612
594
  // (error: Error?, template: String, overrideOptions: Object)
613
595
  if (!(error instanceof Error)) {
@@ -621,18 +603,16 @@ function commit(inquirer, repoPath, prompter, options, done) {
621
603
  } else {
622
604
  cov_g0ukcvuof().b[2][1]++;
623
605
  }
624
-
625
606
  cov_g0ukcvuof().s[16]++;
626
-
627
607
  if (error) {
628
608
  cov_g0ukcvuof().b[3][0]++;
629
609
  cov_g0ukcvuof().s[17]++;
630
610
  return done(error);
631
611
  } else {
632
612
  cov_g0ukcvuof().b[3][1]++;
633
- } // We don't want to add retries to the cache, only actual commands
634
-
613
+ }
635
614
 
615
+ // We don't want to add retries to the cache, only actual commands
636
616
  cov_g0ukcvuof().s[18]++;
637
617
  cache.setCacheValueSync(cachePath, repoPath, {
638
618
  template,
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.load = load;
7
-
8
7
  var _configLoader = require("../configLoader");
9
-
10
8
  function cov_1itu0bpi0j() {
11
9
  var path = "/home/runner/work/cz-cli/cz-cli/src/commitizen/configLoader.js";
12
10
  var hash = "c627c83b933ee54517e9c98550128758f664f3aa";
@@ -75,11 +73,9 @@ function cov_1itu0bpi0j() {
75
73
  hash: "c627c83b933ee54517e9c98550128758f664f3aa"
76
74
  };
77
75
  var coverage = global[gcv] || (global[gcv] = {});
78
-
79
76
  if (!coverage[path] || coverage[path].hash !== hash) {
80
77
  coverage[path] = coverageData;
81
78
  }
82
-
83
79
  var actualCoverage = coverage[path];
84
80
  {
85
81
  // @ts-ignore
@@ -89,11 +85,9 @@ function cov_1itu0bpi0j() {
89
85
  }
90
86
  return actualCoverage;
91
87
  }
92
-
93
88
  cov_1itu0bpi0j();
94
89
  // Configuration sources in priority order.
95
90
  var configs = (cov_1itu0bpi0j().s[0]++, ['.czrc', '.cz.json', 'package.json']);
96
-
97
91
  function load(config, cwd) {
98
92
  cov_1itu0bpi0j().f[0]++;
99
93
  cov_1itu0bpi0j().s[1]++;