@donmahallem/lerna2codecov 0.1.3 → 0.1.6

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
@@ -7256,7 +7256,7 @@ function getChalk(options) {
7256
7256
  }
7257
7257
 
7258
7258
  function highlight(code, options = {}) {
7259
- if (shouldHighlight(options)) {
7259
+ if (code !== "" && shouldHighlight(options)) {
7260
7260
  const chalk = getChalk(options);
7261
7261
  const defs = getDefs$1(chalk);
7262
7262
  return highlightTokens(defs, code);
@@ -7728,7 +7728,9 @@ const processOk = function (process) {
7728
7728
  // some kind of non-node environment, just no-op
7729
7729
  /* istanbul ignore if */
7730
7730
  if (!processOk(process$1)) {
7731
- signalExit.exports = function () {};
7731
+ signalExit.exports = function () {
7732
+ return function () {}
7733
+ };
7732
7734
  } else {
7733
7735
  var assert = require$$5__default$1["default"];
7734
7736
  var signals = signals$1.exports;
@@ -7761,7 +7763,7 @@ if (!processOk(process$1)) {
7761
7763
  signalExit.exports = function (cb, opts) {
7762
7764
  /* istanbul ignore if */
7763
7765
  if (!processOk(commonjsGlobal.process)) {
7764
- return
7766
+ return function () {}
7765
7767
  }
7766
7768
  assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
7767
7769
 
@@ -10463,124 +10465,124 @@ class Package {
10463
10465
 
10464
10466
  var Package_1 = Package;
10465
10467
 
10466
- /*
10467
- * Package @donmahallem/lerna2codecov
10468
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10469
- */
10470
- /**
10471
- * Removes potential scopes from the package name
10472
- *
10473
- * @param {Package|string} packageName Package Name
10474
- * @returns {string} the striped package name
10475
- */
10476
- function stripScope(packageName) {
10477
- if (packageName instanceof Package_1) {
10478
- return stripScope(packageName.get('name'));
10479
- }
10480
- const sliced = packageName.split('/');
10481
- return sliced.length > 1 ? sliced.slice(1).join('/') : packageName;
10482
- }
10483
- /**
10484
- * @param {Project} project Lerna Project
10485
- * @param {import('./codecov-config').ICodecovConfig} codecovCfg parsed codecov config
10486
- * @param {IUpdateOptions} opts Options
10487
- * @returns {Promise<ICodecovConfig>} a promise which resolves with the updated Codecov config
10488
- */
10489
- async function updateConfig(project, codecovCfg, opts) {
10490
- var _a, _b;
10491
- const stripScopeInName = (opts === null || opts === void 0 ? void 0 : opts.stripScope) || true;
10492
- const packages = await project.getPackages();
10493
- if (packages.length === 0) {
10494
- return codecovCfg;
10495
- }
10496
- const codecovProjects = {};
10497
- 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) || {};
10498
- for (const pkg of packages) {
10499
- const stripedPackageName = stripScopeInName ? stripScope(pkg) : pkg.get('name');
10500
- if (stripedPackageName in sourcePackages) {
10501
- continue;
10502
- }
10503
- codecovProjects[stripedPackageName] = {
10504
- paths: [require$$3.relative(project.rootPath, pkg.location)],
10505
- };
10506
- }
10507
- return deepmerge__default["default"](codecovCfg, {
10508
- coverage: {
10509
- status: {
10510
- project: codecovProjects,
10511
- },
10512
- },
10513
- });
10514
- }
10515
-
10516
- /*
10517
- * Package @donmahallem/lerna2codecov
10518
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10519
- */
10520
- /**
10521
- * @param {string} lernaRoot path to lerna project root
10522
- * @param {string} codecovFile path to codecov file
10523
- * @returns {Promise<void>} a Promise which resolves on success
10524
- */
10525
- async function update(lernaRoot, codecovFile) {
10526
- let codecovSourceFile;
10527
- try {
10528
- codecovSourceFile = await require$$0$4.promises.readFile(codecovFile, 'utf-8');
10529
- }
10530
- catch (err) {
10531
- codecovSourceFile = '';
10532
- }
10533
- const parsedCodecovSource = yaml.parse(codecovSourceFile);
10534
- const updatedConfig = await updateConfig(new project.Project(lernaRoot), parsedCodecovSource);
10535
- const outputCodecovConfig = yaml.stringify(updatedConfig);
10536
- return await require$$0$4.promises.writeFile(codecovFile, outputCodecovConfig, 'utf-8');
10537
- }
10538
-
10539
- /*
10540
- * Package @donmahallem/lerna2codecov
10541
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10542
- */
10543
- /**
10544
- * @param path
10545
- */
10546
- function resolvePath(path) {
10547
- return require$$3.resolve(path);
10548
- }
10549
- /**
10550
- * @param opts
10551
- * @param opts.exitOverride
10552
- */
10553
- function updateCommand(opts) {
10554
- const program = new commander.Command('lerna2codecov');
10555
- program
10556
- /**
10557
- * version gets replaced by rollup
10558
- */
10559
- .version('undefined')
10560
- .addHelpText('beforeAll', 'Update script for codecov configs');
10561
- const updateCommand = new commander.Command('update');
10562
- if (opts === null || opts === void 0 ? void 0 : opts.exitOverride) {
10563
- program.exitOverride();
10564
- updateCommand.exitOverride();
10565
- }
10566
- updateCommand
10567
- .description('Updates the codecov.yml with information from lerna.json file')
10568
- .requiredOption('-l, --lerna <path>', 'path to lerna root folder', resolvePath)
10569
- .requiredOption('-c, --codecov <path>', 'path to codecov.yml', resolvePath)
10570
- .usage('-c <codecov file path> -l <lerna root folder>')
10571
- .action(async (opts, cmd) => {
10572
- await update(opts.lerna, opts.codecov);
10573
- })
10574
- .addHelpText('after', '\nExamples:\n update -l ./path/to/lerna -c codecov.yml');
10575
- program.addCommand(updateCommand);
10576
- return program;
10577
- }
10578
-
10579
- /*
10580
- * Package @donmahallem/lerna2codecov
10581
- * Source https://github.com/donmahallem/js-libs/tree/master/packages/lerna2codecov
10582
- */
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
+ */
10583
10585
  void updateCommand().parseAsync(process.argv);
10584
- // BUILD: Sun Jan 09 2022 16:10:15 GMT+0100 (Central European Standard Time)
10586
+ // BUILD: Mon Mar 28 2022 05:36:55 GMT+0000 (Coordinated Universal Time)
10585
10587
 
10586
10588
  //# sourceMappingURL=cli.js.map