@donmahallem/lerna2codecov 0.1.4 → 0.1.7
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 +49 -49
- package/dist/cjs/index.js.map +1 -1
- package/dist/cli/cli.js +118 -118
- package/dist/cli/cli.js.map +1 -1
- package/dist/esm/index.js +49 -49
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cli.d.ts +1 -1
- package/dist/types/codecov-config.d.ts +13 -13
- package/dist/types/index.d.ts +2 -2
- package/dist/types/update-command.d.ts +8 -8
- package/dist/types/update-config.d.ts +12 -12
- package/dist/types/update.d.ts +6 -6
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -10447,57 +10447,57 @@ class Package {
|
|
|
10447
10447
|
|
|
10448
10448
|
var Package_1 = Package;
|
|
10449
10449
|
|
|
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
|
-
});
|
|
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
|
+
});
|
|
10498
10498
|
}
|
|
10499
10499
|
|
|
10500
10500
|
export { updateConfig };
|
|
10501
|
-
// BUILD:
|
|
10501
|
+
// BUILD: Fri Apr 01 2022 23:22:47 GMT+0000 (Coordinated Universal Time)
|
|
10502
10502
|
|
|
10503
10503
|
//# sourceMappingURL=index.js.map
|