@donmahallem/lerna2codecov 0.1.4 → 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
@@ -10465,124 +10465,124 @@ class Package {
10465
10465
 
10466
10466
  var Package_1 = Package;
10467
10467
 
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
- */
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
+ */
10585
10585
  void updateCommand().parseAsync(process.argv);
10586
- // BUILD: Sun Feb 06 2022 11:26:31 GMT+0100 (Central European Standard Time)
10586
+ // BUILD: Sat Mar 26 2022 22:53:00 GMT+0000 (Coordinated Universal Time)
10587
10587
 
10588
10588
  //# sourceMappingURL=cli.js.map