@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/cli/cli.js CHANGED
@@ -173,6 +173,36 @@ gitHosts$2.gist = Object.assign({}, defaults$1, {
173
173
  }
174
174
  });
175
175
 
176
+ gitHosts$2.sourcehut = Object.assign({}, defaults$1, {
177
+ protocols: ['git+ssh:', 'https:'],
178
+ domain: 'git.sr.ht',
179
+ treepath: 'tree',
180
+ browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
181
+ filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,
182
+ httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
183
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,
184
+ bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,
185
+ docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
186
+ extract: (url) => {
187
+ let [, user, project, aux] = url.pathname.split('/', 4);
188
+
189
+ // tarball url
190
+ if (['archive'].includes(aux)) {
191
+ return
192
+ }
193
+
194
+ if (project && project.endsWith('.git')) {
195
+ project = project.slice(0, -4);
196
+ }
197
+
198
+ if (!user || !project) {
199
+ return
200
+ }
201
+
202
+ return { user, project, committish: url.hash.slice(1) }
203
+ }
204
+ });
205
+
176
206
  const names = Object.keys(gitHosts$2);
177
207
  gitHosts$2.byShortcut = {};
178
208
  gitHosts$2.byDomain = {};
@@ -4071,8 +4101,10 @@ function patch$1 (fs) {
4071
4101
  return function (target, options) {
4072
4102
  var stats = options ? orig.call(fs, target, options)
4073
4103
  : orig.call(fs, target);
4074
- if (stats.uid < 0) stats.uid += 0x100000000;
4075
- if (stats.gid < 0) stats.gid += 0x100000000;
4104
+ if (stats) {
4105
+ if (stats.uid < 0) stats.uid += 0x100000000;
4106
+ if (stats.gid < 0) stats.gid += 0x100000000;
4107
+ }
4076
4108
  return stats;
4077
4109
  }
4078
4110
  }
@@ -7224,7 +7256,7 @@ function getChalk(options) {
7224
7256
  }
7225
7257
 
7226
7258
  function highlight(code, options = {}) {
7227
- if (shouldHighlight(options)) {
7259
+ if (code !== "" && shouldHighlight(options)) {
7228
7260
  const chalk = getChalk(options);
7229
7261
  const defs = getDefs$1(chalk);
7230
7262
  return highlightTokens(defs, code);
@@ -7696,7 +7728,9 @@ const processOk = function (process) {
7696
7728
  // some kind of non-node environment, just no-op
7697
7729
  /* istanbul ignore if */
7698
7730
  if (!processOk(process$1)) {
7699
- signalExit.exports = function () {};
7731
+ signalExit.exports = function () {
7732
+ return function () {}
7733
+ };
7700
7734
  } else {
7701
7735
  var assert = require$$5__default$1["default"];
7702
7736
  var signals = signals$1.exports;
@@ -7729,7 +7763,7 @@ if (!processOk(process$1)) {
7729
7763
  signalExit.exports = function (cb, opts) {
7730
7764
  /* istanbul ignore if */
7731
7765
  if (!processOk(commonjsGlobal.process)) {
7732
- return
7766
+ return function () {}
7733
7767
  }
7734
7768
  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
7735
7769
 
@@ -10431,124 +10465,124 @@ class Package {
10431
10465
 
10432
10466
  var Package_1 = Package;
10433
10467
 
10434
- /*
10435
- * Package @donmahallem/lerna2codecov
10436
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10437
- */
10438
- /**
10439
- * Removes potential scopes from the package name
10440
- *
10441
- * @param {Package|string} packageName Package Name
10442
- * @returns {string} the striped package name
10443
- */
10444
- function stripScope(packageName) {
10445
- if (packageName instanceof Package_1) {
10446
- return stripScope(packageName.get('name'));
10447
- }
10448
- const sliced = packageName.split('/');
10449
- return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10450
- }
10451
- /**
10452
- * @param {Project} project Lerna Project
10453
- * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10454
- * @param {IUpdateOptions} opts Options
10455
- * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10456
- */
10457
- async function updateConfig(project, codecovCfg, opts) {
10458
- var _a, _b;
10459
- const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10460
- const packages = await project.getPackages();
10461
- if (packages.length === 0) {
10462
- return codecovCfg;
10463
- }
10464
- const codecovProjects = {};
10465
- 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) || {};
10466
- for (const pkg of packages) {
10467
- const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10468
- if (stripedPackageName in sourcePackages) {
10469
- continue;
10470
- }
10471
- codecovProjects[stripedPackageName] = {
10472
- paths: [require$$3.relative(project.rootPath, pkg.location)],
10473
- };
10474
- }
10475
- return deepmerge__default["default"](codecovCfg, {
10476
- coverage: {
10477
- status: {
10478
- project: codecovProjects,
10479
- },
10480
- },
10481
- });
10482
- }
10483
-
10484
- /*
10485
- * Package @donmahallem/lerna2codecov
10486
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10487
- */
10488
- /**
10489
- * @param {string} lernaRoot path to lerna project root
10490
- * @param {string} codecovFile path to codecov file
10491
- * @returns {Promise<void>} a Promise which resolves on success
10492
- */
10493
- async function update(lernaRoot, codecovFile) {
10494
- let codecovSourceFile;
10495
- try {
10496
- codecovSourceFile = await require$$0$4.promises.readFile(codecovFile, 'utf-8');
10497
- }
10498
- catch (err) {
10499
- codecovSourceFile = '';
10500
- }
10501
- const parsedCodecovSource = yaml.parse(codecovSourceFile);
10502
- const updatedConfig = await updateConfig(new project.Project(lernaRoot), parsedCodecovSource);
10503
- const outputCodecovConfig = yaml.stringify(updatedConfig);
10504
- return await require$$0$4.promises.writeFile(codecovFile, outputCodecovConfig, 'utf-8');
10505
- }
10506
-
10507
- /*
10508
- * Package @donmahallem/lerna2codecov
10509
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10510
- */
10511
- /**
10512
- * @param path
10513
- */
10514
- function resolvePath(path) {
10515
- return require$$3.resolve(path);
10516
- }
10517
- /**
10518
- * @param opts
10519
- * @param opts.exitOverride
10520
- */
10521
- function updateCommand(opts) {
10522
- const program = new commander.Command('lerna2codecov');
10523
- program
10524
- /**
10525
- * version gets replaced by rollup
10526
- */
10527
- .version('undefined')
10528
- .addHelpText('beforeAll', 'Update script for codecov configs');
10529
- const updateCommand = new commander.Command('update');
10530
- if (opts === null || opts === void 0 ? void 0 : opts.exitOverride) {
10531
- program.exitOverride();
10532
- updateCommand.exitOverride();
10533
- }
10534
- updateCommand
10535
- .description('Updates the codecov.yml with information from lerna.json file')
10536
- .requiredOption('-l, --lerna <path>', 'path to lerna root folder', resolvePath)
10537
- .requiredOption('-c, --codecov <path>', 'path to codecov.yml', resolvePath)
10538
- .usage('-c <codecov file path> -l <lerna root folder>')
10539
- .action(async (opts, cmd) => {
10540
- await update(opts.lerna, opts.codecov);
10541
- })
10542
- .addHelpText('after', '\nExamples:\n update -l ./path/to/lerna -c codecov.yml');
10543
- program.addCommand(updateCommand);
10544
- return program;
10545
- }
10546
-
10547
- /*
10548
- * Package @donmahallem/lerna2codecov
10549
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10550
- */
10468
+ /*
10469
+ * Package @donmahallem/lerna2codecov
10470
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10471
+ */
10472
+ /**
10473
+ * Removes potential scopes from the package name
10474
+ *
10475
+ * @param {Package|string} packageName Package Name
10476
+ * @returns {string} the striped package name
10477
+ */
10478
+ function stripScope(packageName) {
10479
+ if (packageName instanceof Package_1) {
10480
+ return stripScope(packageName.get('name'));
10481
+ }
10482
+ const sliced = packageName.split('/');
10483
+ return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10484
+ }
10485
+ /**
10486
+ * @param {Project} project Lerna Project
10487
+ * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10488
+ * @param {IUpdateOptions} opts Options
10489
+ * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10490
+ */
10491
+ async function updateConfig(project, codecovCfg, opts) {
10492
+ var _a, _b;
10493
+ const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10494
+ const packages = await project.getPackages();
10495
+ if (packages.length === 0) {
10496
+ return codecovCfg;
10497
+ }
10498
+ const codecovProjects = {};
10499
+ 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) || {};
10500
+ for (const pkg of packages) {
10501
+ const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10502
+ if (stripedPackageName in sourcePackages) {
10503
+ continue;
10504
+ }
10505
+ codecovProjects[stripedPackageName] = {
10506
+ paths: [require$$3.relative(project.rootPath, pkg.location)],
10507
+ };
10508
+ }
10509
+ return deepmerge__default["default"](codecovCfg, {
10510
+ coverage: {
10511
+ status: {
10512
+ project: codecovProjects,
10513
+ },
10514
+ },
10515
+ });
10516
+ }
10517
+
10518
+ /*
10519
+ * Package @donmahallem/lerna2codecov
10520
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10521
+ */
10522
+ /**
10523
+ * @param {string} lernaRoot path to lerna project root
10524
+ * @param {string} codecovFile path to codecov file
10525
+ * @returns {Promise<void>} a Promise which resolves on success
10526
+ */
10527
+ async function update(lernaRoot, codecovFile) {
10528
+ let codecovSourceFile;
10529
+ try {
10530
+ codecovSourceFile = await require$$0$4.promises.readFile(codecovFile, 'utf-8');
10531
+ }
10532
+ catch (err) {
10533
+ codecovSourceFile = '';
10534
+ }
10535
+ const parsedCodecovSource = yaml.parse(codecovSourceFile);
10536
+ const updatedConfig = await updateConfig(new project.Project(lernaRoot), parsedCodecovSource);
10537
+ const outputCodecovConfig = yaml.stringify(updatedConfig);
10538
+ return await require$$0$4.promises.writeFile(codecovFile, outputCodecovConfig, 'utf-8');
10539
+ }
10540
+
10541
+ /*
10542
+ * Package @donmahallem/lerna2codecov
10543
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10544
+ */
10545
+ /**
10546
+ * @param path
10547
+ */
10548
+ function resolvePath(path) {
10549
+ return require$$3.resolve(path);
10550
+ }
10551
+ /**
10552
+ * @param opts
10553
+ * @param opts.exitOverride
10554
+ */
10555
+ function updateCommand(opts) {
10556
+ const program = new commander.Command('lerna2codecov');
10557
+ program
10558
+ /**
10559
+ * version gets replaced by rollup
10560
+ */
10561
+ .version('undefined')
10562
+ .addHelpText('beforeAll', 'Update script for codecov configs');
10563
+ const updateCommand = new commander.Command('update');
10564
+ if (opts === null || opts === void 0 ? void 0 : opts.exitOverride) {
10565
+ program.exitOverride();
10566
+ updateCommand.exitOverride();
10567
+ }
10568
+ updateCommand
10569
+ .description('Updates the codecov.yml with information from lerna.json file')
10570
+ .requiredOption('-l, --lerna <path>', 'path to lerna root folder', resolvePath)
10571
+ .requiredOption('-c, --codecov <path>', 'path to codecov.yml', resolvePath)
10572
+ .usage('-c <codecov file path> -l <lerna root folder>')
10573
+ .action(async (opts, cmd) => {
10574
+ await update(opts.lerna, opts.codecov);
10575
+ })
10576
+ .addHelpText('after', '\nExamples:\n update -l ./path/to/lerna -c codecov.yml');
10577
+ program.addCommand(updateCommand);
10578
+ return program;
10579
+ }
10580
+
10581
+ /*
10582
+ * Package @donmahallem/lerna2codecov
10583
+ * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10584
+ */
10551
10585
  void updateCommand().parseAsync(process.argv);
10552
- // BUILD: Fri Jan 07 2022 14:36:08 GMT+0100 (Central European Standard Time)
10586
+ // BUILD: Sat Mar 26 2022 22:53:00 GMT+0000 (Coordinated Universal Time)
10553
10587
 
10554
10588
  //# sourceMappingURL=cli.js.map