@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/esm/index.js CHANGED
@@ -155,6 +155,36 @@ gitHosts$2.gist = Object.assign({}, defaults$1, {
155
155
  }
156
156
  });
157
157
 
158
+ gitHosts$2.sourcehut = Object.assign({}, defaults$1, {
159
+ protocols: ['git+ssh:', 'https:'],
160
+ domain: 'git.sr.ht',
161
+ treepath: 'tree',
162
+ browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
163
+ filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,
164
+ httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
165
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,
166
+ bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,
167
+ docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
168
+ extract: (url) => {
169
+ let [, user, project, aux] = url.pathname.split('/', 4);
170
+
171
+ // tarball url
172
+ if (['archive'].includes(aux)) {
173
+ return
174
+ }
175
+
176
+ if (project && project.endsWith('.git')) {
177
+ project = project.slice(0, -4);
178
+ }
179
+
180
+ if (!user || !project) {
181
+ return
182
+ }
183
+
184
+ return { user, project, committish: url.hash.slice(1) }
185
+ }
186
+ });
187
+
158
188
  const names = Object.keys(gitHosts$2);
159
189
  gitHosts$2.byShortcut = {};
160
190
  gitHosts$2.byDomain = {};
@@ -4053,8 +4083,10 @@ function patch$1 (fs) {
4053
4083
  return function (target, options) {
4054
4084
  var stats = options ? orig.call(fs, target, options)
4055
4085
  : orig.call(fs, target);
4056
- if (stats.uid < 0) stats.uid += 0x100000000;
4057
- if (stats.gid < 0) stats.gid += 0x100000000;
4086
+ if (stats) {
4087
+ if (stats.uid < 0) stats.uid += 0x100000000;
4088
+ if (stats.gid < 0) stats.gid += 0x100000000;
4089
+ }
4058
4090
  return stats;
4059
4091
  }
4060
4092
  }
@@ -7206,7 +7238,7 @@ function getChalk(options) {
7206
7238
  }
7207
7239
 
7208
7240
  function highlight(code, options = {}) {
7209
- if (shouldHighlight(options)) {
7241
+ if (code !== "" && shouldHighlight(options)) {
7210
7242
  const chalk = getChalk(options);
7211
7243
  const defs = getDefs$1(chalk);
7212
7244
  return highlightTokens(defs, code);
@@ -7678,7 +7710,9 @@ const processOk = function (process) {
7678
7710
  // some kind of non-node environment, just no-op
7679
7711
  /* istanbul ignore if */
7680
7712
  if (!processOk(process$1)) {
7681
- signalExit.exports = function () {};
7713
+ signalExit.exports = function () {
7714
+ return function () {}
7715
+ };
7682
7716
  } else {
7683
7717
  var assert = require$$5$1;
7684
7718
  var signals = signals$1.exports;
@@ -7711,7 +7745,7 @@ if (!processOk(process$1)) {
7711
7745
  signalExit.exports = function (cb, opts) {
7712
7746
  /* istanbul ignore if */
7713
7747
  if (!processOk(commonjsGlobal.process)) {
7714
- return
7748
+ return function () {}
7715
7749
  }
7716
7750
  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
7717
7751
 
@@ -10413,57 +10447,57 @@ class Package {
10413
10447
 
10414
10448
  var Package_1 = Package;
10415
10449
 
10416
- /*
10417
- * Package @donmahallem/lerna2codecov
10418
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10419
- */
10420
- /**
10421
- * Removes potential scopes from the package name
10422
- *
10423
- * @param {Package|string} packageName Package Name
10424
- * @returns {string} the striped package name
10425
- */
10426
- function stripScope(packageName) {
10427
- if (packageName instanceof Package_1) {
10428
- return stripScope(packageName.get('name'));
10429
- }
10430
- const sliced = packageName.split('/');
10431
- return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10432
- }
10433
- /**
10434
- * @param {Project} project Lerna Project
10435
- * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10436
- * @param {IUpdateOptions} opts Options
10437
- * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10438
- */
10439
- async function updateConfig(project, codecovCfg, opts) {
10440
- var _a, _b;
10441
- const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10442
- const packages = await project.getPackages();
10443
- if (packages.length === 0) {
10444
- return codecovCfg;
10445
- }
10446
- const codecovProjects = {};
10447
- 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) || {};
10448
- for (const pkg of packages) {
10449
- const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10450
- if (stripedPackageName in sourcePackages) {
10451
- continue;
10452
- }
10453
- codecovProjects[stripedPackageName] = {
10454
- paths: [relative(project.rootPath, pkg.location)],
10455
- };
10456
- }
10457
- return deepmerge(codecovCfg, {
10458
- coverage: {
10459
- status: {
10460
- project: codecovProjects,
10461
- },
10462
- },
10463
- });
10450
+ /*
10451
+ * Package @donmahallem/lerna2codecov
10452
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10453
+ */
10454
+ /**
10455
+ * Removes potential scopes from the package name
10456
+ *
10457
+ * @param {Package|string} packageName Package Name
10458
+ * @returns {string} the striped package name
10459
+ */
10460
+ function stripScope(packageName) {
10461
+ if (packageName instanceof Package_1) {
10462
+ return stripScope(packageName.get('name'));
10463
+ }
10464
+ const sliced = packageName.split('/');
10465
+ return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10466
+ }
10467
+ /**
10468
+ * @param {Project} project Lerna Project
10469
+ * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10470
+ * @param {IUpdateOptions} opts Options
10471
+ * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10472
+ */
10473
+ async function updateConfig(project, codecovCfg, opts) {
10474
+ var _a, _b;
10475
+ const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10476
+ const packages = await project.getPackages();
10477
+ if (packages.length === 0) {
10478
+ return codecovCfg;
10479
+ }
10480
+ const codecovProjects = {};
10481
+ 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) || {};
10482
+ for (const pkg of packages) {
10483
+ const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10484
+ if (stripedPackageName in sourcePackages) {
10485
+ continue;
10486
+ }
10487
+ codecovProjects[stripedPackageName] = {
10488
+ paths: [relative(project.rootPath, pkg.location)],
10489
+ };
10490
+ }
10491
+ return deepmerge(codecovCfg, {
10492
+ coverage: {
10493
+ status: {
10494
+ project: codecovProjects,
10495
+ },
10496
+ },
10497
+ });
10464
10498
  }
10465
10499
 
10466
10500
  export { updateConfig };
10467
- // BUILD: Fri Jan 07 2022 14:36:06 GMT+0100 (Central European Standard Time)
10501
+ // BUILD: Sat Mar 26 2022 22:52:57 GMT+0000 (Coordinated Universal Time)
10468
10502
 
10469
10503
  //# sourceMappingURL=index.js.map