@donmahallem/lerna2codecov 0.1.2 → 0.1.5

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/dist/cjs/index.js CHANGED
@@ -172,6 +172,36 @@ gitHosts$2.gist = Object.assign({}, defaults$1, {
172
172
  }
173
173
  });
174
174
 
175
+ gitHosts$2.sourcehut = Object.assign({}, defaults$1, {
176
+ protocols: ['git+ssh:', 'https:'],
177
+ domain: 'git.sr.ht',
178
+ treepath: 'tree',
179
+ browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
180
+ filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,
181
+ httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
182
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,
183
+ bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,
184
+ docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
185
+ extract: (url) => {
186
+ let [, user, project, aux] = url.pathname.split('/', 4);
187
+
188
+ // tarball url
189
+ if (['archive'].includes(aux)) {
190
+ return
191
+ }
192
+
193
+ if (project && project.endsWith('.git')) {
194
+ project = project.slice(0, -4);
195
+ }
196
+
197
+ if (!user || !project) {
198
+ return
199
+ }
200
+
201
+ return { user, project, committish: url.hash.slice(1) }
202
+ }
203
+ });
204
+
175
205
  const names = Object.keys(gitHosts$2);
176
206
  gitHosts$2.byShortcut = {};
177
207
  gitHosts$2.byDomain = {};
@@ -4070,8 +4100,10 @@ function patch$1 (fs) {
4070
4100
  return function (target, options) {
4071
4101
  var stats = options ? orig.call(fs, target, options)
4072
4102
  : orig.call(fs, target);
4073
- if (stats.uid < 0) stats.uid += 0x100000000;
4074
- if (stats.gid < 0) stats.gid += 0x100000000;
4103
+ if (stats) {
4104
+ if (stats.uid < 0) stats.uid += 0x100000000;
4105
+ if (stats.gid < 0) stats.gid += 0x100000000;
4106
+ }
4075
4107
  return stats;
4076
4108
  }
4077
4109
  }
@@ -7223,7 +7255,7 @@ function getChalk(options) {
7223
7255
  }
7224
7256
 
7225
7257
  function highlight(code, options = {}) {
7226
- if (shouldHighlight(options)) {
7258
+ if (code !== "" && shouldHighlight(options)) {
7227
7259
  const chalk = getChalk(options);
7228
7260
  const defs = getDefs$1(chalk);
7229
7261
  return highlightTokens(defs, code);
@@ -7695,7 +7727,9 @@ const processOk = function (process) {
7695
7727
  // some kind of non-node environment, just no-op
7696
7728
  /* istanbul ignore if */
7697
7729
  if (!processOk(process$1)) {
7698
- signalExit.exports = function () {};
7730
+ signalExit.exports = function () {
7731
+ return function () {}
7732
+ };
7699
7733
  } else {
7700
7734
  var assert = require$$5__default$1["default"];
7701
7735
  var signals = signals$1.exports;
@@ -7728,7 +7762,7 @@ if (!processOk(process$1)) {
7728
7762
  signalExit.exports = function (cb, opts) {
7729
7763
  /* istanbul ignore if */
7730
7764
  if (!processOk(commonjsGlobal.process)) {
7731
- return
7765
+ return function () {}
7732
7766
  }
7733
7767
  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
7734
7768
 
@@ -10430,57 +10464,57 @@ class Package {
10430
10464
 
10431
10465
  var Package_1 = Package;
10432
10466
 
10433
- /*
10434
- * Package @donmahallem/lerna2codecov
10435
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10436
- */
10437
- /**
10438
- * Removes potential scopes from the package name
10439
- *
10440
- * @param {Package|string} packageName Package Name
10441
- * @returns {string} the striped package name
10442
- */
10443
- function stripScope(packageName) {
10444
- if (packageName instanceof Package_1) {
10445
- return stripScope(packageName.get('name'));
10446
- }
10447
- const sliced = packageName.split('/');
10448
- return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10449
- }
10450
- /**
10451
- * @param {Project} project Lerna Project
10452
- * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10453
- * @param {IUpdateOptions} opts Options
10454
- * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10455
- */
10456
- async function updateConfig(project, codecovCfg, opts) {
10457
- var _a, _b;
10458
- const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10459
- const packages = await project.getPackages();
10460
- if (packages.length === 0) {
10461
- return codecovCfg;
10462
- }
10463
- const codecovProjects = {};
10464
- const sourcePackages = ((_b = (_a = codecovCfg === null || codecovCfg === void 0 ? void 0 : codecovCfg.coverage) === null || _a === void 0 ? void 0 : _a.status) === null || _b === void 0 ? void 0 : _b.project) || {};
10465
- for (const pkg of packages) {
10466
- const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10467
- if (stripedPackageName in sourcePackages) {
10468
- continue;
10469
- }
10470
- codecovProjects[stripedPackageName] = {
10471
- paths: [require$$3.relative(project.rootPath, pkg.location)],
10472
- };
10473
- }
10474
- return deepmerge__default["default"](codecovCfg, {
10475
- coverage: {
10476
- status: {
10477
- project: codecovProjects,
10478
- },
10479
- },
10480
- });
10467
+ /*
10468
+ * Package @donmahallem/lerna2codecov
10469
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10470
+ */
10471
+ /**
10472
+ * Removes potential scopes from the package name
10473
+ *
10474
+ * @param {Package|string} packageName Package Name
10475
+ * @returns {string} the striped package name
10476
+ */
10477
+ function stripScope(packageName) {
10478
+ if (packageName instanceof Package_1) {
10479
+ return stripScope(packageName.get('name'));
10480
+ }
10481
+ const sliced = packageName.split('/');
10482
+ return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10483
+ }
10484
+ /**
10485
+ * @param {Project} project Lerna Project
10486
+ * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10487
+ * @param {IUpdateOptions} opts Options
10488
+ * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10489
+ */
10490
+ async function updateConfig(project, codecovCfg, opts) {
10491
+ var _a, _b;
10492
+ const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10493
+ const packages = await project.getPackages();
10494
+ if (packages.length === 0) {
10495
+ return codecovCfg;
10496
+ }
10497
+ const codecovProjects = {};
10498
+ const sourcePackages = ((_b = (_a = codecovCfg === null || codecovCfg === void 0 ? void 0 : codecovCfg.coverage) === null || _a === void 0 ? void 0 : _a.status) === null || _b === void 0 ? void 0 : _b.project) || {};
10499
+ for (const pkg of packages) {
10500
+ const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10501
+ if (stripedPackageName in sourcePackages) {
10502
+ continue;
10503
+ }
10504
+ codecovProjects[stripedPackageName] = {
10505
+ paths: [require$$3.relative(project.rootPath, pkg.location)],
10506
+ };
10507
+ }
10508
+ return deepmerge__default["default"](codecovCfg, {
10509
+ coverage: {
10510
+ status: {
10511
+ project: codecovProjects,
10512
+ },
10513
+ },
10514
+ });
10481
10515
  }
10482
10516
 
10483
10517
  exports.updateConfig = updateConfig;
10484
- // BUILD: Fri Jan 07 2022 14:36:06 GMT+0100 (Central European Standard Time)
10518
+ // BUILD: Sat Mar 26 2022 22:52:56 GMT+0000 (Coordinated Universal Time)
10485
10519
 
10486
10520
  //# sourceMappingURL=index.js.map