@jonloucks/badges-ts 1.2.0 → 1.4.0
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/README.md +2 -0
- package/api/Badge.d.ts +8 -0
- package/api/Badge.d.ts.map +1 -1
- package/api/Coverage.d.ts +8 -0
- package/api/Coverage.d.ts.map +1 -0
- package/api/Coverage.js +2 -0
- package/api/Coverage.js.map +1 -0
- package/api/Installer.d.ts +8 -0
- package/api/Installer.d.ts.map +1 -1
- package/api/Project.d.ts +4 -0
- package/api/Project.d.ts.map +1 -1
- package/api/Types.d.ts +21 -0
- package/api/Types.d.ts.map +1 -1
- package/api/Types.js.map +1 -1
- package/api/Variances.d.ts +20 -1
- package/api/Variances.d.ts.map +1 -1
- package/api/Variances.js +89 -11
- package/api/Variances.js.map +1 -1
- package/auxiliary/Command.d.ts +12 -8
- package/auxiliary/Command.d.ts.map +1 -1
- package/auxiliary/DiscoverCoverage.d.ts +27 -0
- package/auxiliary/DiscoverCoverage.d.ts.map +1 -0
- package/auxiliary/DiscoverCoverage.js +18 -0
- package/auxiliary/DiscoverCoverage.js.map +1 -0
- package/cli.d.ts.map +1 -1
- package/cli.js +21 -50
- package/cli.js.map +1 -1
- package/impl/Command.impl.d.ts.map +1 -1
- package/impl/Command.impl.js +8 -7
- package/impl/Command.impl.js.map +1 -1
- package/impl/DiscoverCoverage.impl.d.ts +15 -0
- package/impl/DiscoverCoverage.impl.d.ts.map +1 -0
- package/impl/DiscoverCoverage.impl.js +188 -0
- package/impl/DiscoverCoverage.impl.js.map +1 -0
- package/impl/DiscoverProject.impl.d.ts +5 -0
- package/impl/DiscoverProject.impl.d.ts.map +1 -1
- package/impl/DiscoverProject.impl.js +11 -17
- package/impl/DiscoverProject.impl.js.map +1 -1
- package/impl/Installer.impl.d.ts.map +1 -1
- package/impl/Installer.impl.js +3 -0
- package/impl/Installer.impl.js.map +1 -1
- package/impl/Internal.impl.d.ts +1 -0
- package/impl/Internal.impl.d.ts.map +1 -1
- package/impl/Internal.impl.js +5 -1
- package/impl/Internal.impl.js.map +1 -1
- package/impl/apply-version-command.js +1 -13
- package/impl/apply-version-command.js.map +1 -1
- package/impl/coverage-gate-command.d.ts +8 -0
- package/impl/coverage-gate-command.d.ts.map +1 -0
- package/impl/coverage-gate-command.js +59 -0
- package/impl/coverage-gate-command.js.map +1 -0
- package/impl/coverage-report-command.d.ts +3 -0
- package/impl/coverage-report-command.d.ts.map +1 -0
- package/impl/coverage-report-command.js +110 -0
- package/impl/coverage-report-command.js.map +1 -0
- package/impl/discover-command.d.ts +5 -5
- package/impl/discover-command.d.ts.map +1 -1
- package/impl/discover-command.js +29 -11
- package/impl/discover-command.js.map +1 -1
- package/impl/generate-command.d.ts.map +1 -1
- package/impl/generate-command.js +8 -119
- package/impl/generate-command.js.map +1 -1
- package/impl/help-command.d.ts +7 -0
- package/impl/help-command.d.ts.map +1 -0
- package/impl/help-command.js +24 -0
- package/impl/help-command.js.map +1 -0
- package/impl/version-command.d.ts +7 -0
- package/impl/version-command.d.ts.map +1 -0
- package/impl/version-command.js +15 -0
- package/impl/version-command.js.map +1 -0
- package/index.d.ts +1 -2
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/package.json +8 -4
- package/version.js +1 -1
- package/api/Badges.d.ts +0 -10
- package/api/Badges.d.ts.map +0 -1
- package/api/Badges.js +0 -2
- package/api/Badges.js.map +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { getLcovInfoPath, getCoverageReportFolder } from "@jonloucks/badges-ts/api/Variances";
|
|
2
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { Internal } from "./Internal.impl.js";
|
|
5
|
+
export const COMMAND = {
|
|
6
|
+
execute: async function (context) {
|
|
7
|
+
context.display.trace(`Running discover with: ${context.arguments.join(' ')}`);
|
|
8
|
+
const lcovPath = getLcovInfoPath(context);
|
|
9
|
+
const { totals, files } = parseLcovInfo(lcovPath);
|
|
10
|
+
const html = generateHtmlReport(totals, files);
|
|
11
|
+
const outputFolder = getCoverageReportFolder(context);
|
|
12
|
+
Internal.createFoldersIfNotExist(outputFolder);
|
|
13
|
+
const indexHtmlFile = resolve(outputFolder, "index.html");
|
|
14
|
+
writeFileSync(indexHtmlFile, html, "utf8");
|
|
15
|
+
console.log(`Coverage report generated: ${indexHtmlFile}`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function matchNumber(matches) {
|
|
19
|
+
return +(matches ?? 0);
|
|
20
|
+
}
|
|
21
|
+
function percent(part, total) {
|
|
22
|
+
return Internal.normalizePercent(total > 0 ? (part / total) * 100 : 100);
|
|
23
|
+
}
|
|
24
|
+
function parseLcovInfo(lcovPath) {
|
|
25
|
+
const content = readFileSync(lcovPath, "utf8");
|
|
26
|
+
const records = content.split("end_of_record");
|
|
27
|
+
let totals = {
|
|
28
|
+
lines: { found: 0, hit: 0 },
|
|
29
|
+
functions: { found: 0, hit: 0 },
|
|
30
|
+
branches: { found: 0, hit: 0 },
|
|
31
|
+
};
|
|
32
|
+
const files = [];
|
|
33
|
+
for (const rec of records) {
|
|
34
|
+
if (!rec.trim())
|
|
35
|
+
continue;
|
|
36
|
+
const fileMatch = rec.match(/SF:(.+)/);
|
|
37
|
+
const file = fileMatch ? fileMatch[1].trim() : "unknown";
|
|
38
|
+
const lf = matchNumber(rec.match(/LF:(\d+)/)?.[1]);
|
|
39
|
+
const lh = matchNumber(rec.match(/LH:(\d+)/)?.[1]);
|
|
40
|
+
const fnf = matchNumber(rec.match(/FNF:(\d+)/)?.[1]);
|
|
41
|
+
const fnh = matchNumber(rec.match(/FNH:(\d+)/)?.[1]);
|
|
42
|
+
const brf = matchNumber(rec.match(/BRF:(\d+)/)?.[1]);
|
|
43
|
+
const brh = matchNumber(rec.match(/BRH:(\d+)/)?.[1]);
|
|
44
|
+
totals.lines.found += lf;
|
|
45
|
+
totals.lines.hit += lh;
|
|
46
|
+
totals.functions.found += fnf;
|
|
47
|
+
totals.functions.hit += fnh;
|
|
48
|
+
totals.branches.found += brf;
|
|
49
|
+
totals.branches.hit += brh;
|
|
50
|
+
files.push({
|
|
51
|
+
file,
|
|
52
|
+
lines: percent(lh, lf),
|
|
53
|
+
functions: percent(fnh, fnf),
|
|
54
|
+
branches: percent(brh, brf),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return { totals, files };
|
|
58
|
+
}
|
|
59
|
+
function generateHtmlReport(totals, files) {
|
|
60
|
+
const totalLinesPct = percent(totals.lines.hit, totals.lines.found);
|
|
61
|
+
const totalFuncsPct = percent(totals.functions.hit, totals.functions.found);
|
|
62
|
+
const totalBranchesPct = percent(totals.branches.hit, totals.branches.found);
|
|
63
|
+
return `
|
|
64
|
+
<!DOCTYPE html>
|
|
65
|
+
<html lang="en">
|
|
66
|
+
<head>
|
|
67
|
+
<meta charset="UTF-8">
|
|
68
|
+
<title>Coverage Report</title>
|
|
69
|
+
<style>
|
|
70
|
+
body { font-family: system-ui, sans-serif; margin: 2em; }
|
|
71
|
+
table { border-collapse: collapse; width: 100%; margin-top: 1em; }
|
|
72
|
+
th, td { border: 1px solid #ddd; padding: 0.5em; text-align: left; }
|
|
73
|
+
th { background: #f4f4f4; }
|
|
74
|
+
.pct { font-weight: bold; }
|
|
75
|
+
</style>
|
|
76
|
+
</head>
|
|
77
|
+
<body>
|
|
78
|
+
<h1>Coverage Report</h1>
|
|
79
|
+
<h2>Totals</h2>
|
|
80
|
+
<ul>
|
|
81
|
+
<li>Lines: <span class="pct">${Internal.formatPercent(totalLinesPct)}</span></li>
|
|
82
|
+
<li>Functions: <span class="pct">${Internal.formatPercent(totalFuncsPct)}</span></li>
|
|
83
|
+
<li>Branches: <span class="pct">${Internal.formatPercent(totalBranchesPct)}</span></li>
|
|
84
|
+
</ul>
|
|
85
|
+
<h2>Per File</h2>
|
|
86
|
+
<table>
|
|
87
|
+
<thead>
|
|
88
|
+
<tr>
|
|
89
|
+
<th>File</th>
|
|
90
|
+
<th>Lines %</th>
|
|
91
|
+
<th>Functions %</th>
|
|
92
|
+
<th>Branches %</th>
|
|
93
|
+
</tr>
|
|
94
|
+
</thead>
|
|
95
|
+
<tbody>
|
|
96
|
+
${files.map(f => `
|
|
97
|
+
<tr>
|
|
98
|
+
<td>${f.file}</td>
|
|
99
|
+
<td>${Internal.formatPercent(f.lines)}</td>
|
|
100
|
+
<td>${Internal.formatPercent(f.functions)}</td>
|
|
101
|
+
<td>${Internal.formatPercent(f.branches)}</td>
|
|
102
|
+
</tr>
|
|
103
|
+
`).join("")}
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
</body>
|
|
107
|
+
</html>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=coverage-report-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-report-command.js","sourceRoot":"","sources":["../../src/impl/coverage-report-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE9F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,OAAO,EAAE,KAAK,WAAW,OAAgB;QACvC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,0BAA0B,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/E,MAAM,QAAQ,GAAW,eAAe,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,IAAI,GAAW,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CA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/Command";
|
|
3
2
|
/**
|
|
4
|
-
* Discovers the project information such as name and version.
|
|
5
|
-
* This command is typically used as a prerequisite for other commands that need project
|
|
6
|
-
*
|
|
3
|
+
* Discovers the project information (such as name and version) and code coverage.
|
|
4
|
+
* This command is typically used as a prerequisite for other commands that need project metadata
|
|
5
|
+
* and/or coverage information to function correctly.
|
|
6
|
+
* It relies on the DiscoverProject and DiscoverCoverage contracts to gather the necessary details.
|
|
7
7
|
*/
|
|
8
|
-
export declare const COMMAND: Command<
|
|
8
|
+
export declare const COMMAND: Command<void>;
|
|
9
9
|
//# sourceMappingURL=discover-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-command.d.ts","sourceRoot":"","sources":["../../src/impl/discover-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discover-command.d.ts","sourceRoot":"","sources":["../../src/impl/discover-command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAW,MAAM,wCAAwC,CAAC;AAI1E;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,IAAI,CAQjC,CAAC"}
|
package/impl/discover-command.js
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
import { CONTRACT as DISCOVER_PROJECT } from "@jonloucks/badges-ts/auxiliary/DiscoverProject";
|
|
2
|
+
import { CONTRACT as DISCOVER_COVERAGE } from "@jonloucks/badges-ts/auxiliary/DiscoverCoverage";
|
|
2
3
|
import { CONTRACTS } from "@jonloucks/contracts-ts";
|
|
4
|
+
import { Internal } from "./Internal.impl.js";
|
|
3
5
|
/**
|
|
4
|
-
* Discovers the project information such as name and version.
|
|
5
|
-
* This command is typically used as a prerequisite for other commands that need project
|
|
6
|
-
*
|
|
6
|
+
* Discovers the project information (such as name and version) and code coverage.
|
|
7
|
+
* This command is typically used as a prerequisite for other commands that need project metadata
|
|
8
|
+
* and/or coverage information to function correctly.
|
|
9
|
+
* It relies on the DiscoverProject and DiscoverCoverage contracts to gather the necessary details.
|
|
7
10
|
*/
|
|
8
11
|
export const COMMAND = {
|
|
9
12
|
execute: async function (context) {
|
|
10
|
-
context.display.trace(`Running discover
|
|
11
|
-
|
|
12
|
-
context
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
context.display.error(`Error during project detection: ${error.message}`);
|
|
16
|
-
throw error;
|
|
17
|
-
});
|
|
13
|
+
context.display.trace(`Running discover with: ${context.arguments.join(' ')}`);
|
|
14
|
+
await Promise.all([
|
|
15
|
+
discoverProject(context),
|
|
16
|
+
discoverCoverage(context)
|
|
17
|
+
]);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
async function discoverProject(context) {
|
|
21
|
+
return CONTRACTS.enforce(DISCOVER_PROJECT).discoverProject(context).then((project) => {
|
|
22
|
+
context.display.info(`Discovered project: ${project.name}, version: ${project.version}`);
|
|
23
|
+
return project;
|
|
24
|
+
}).catch((error) => {
|
|
25
|
+
context.display.error(error instanceof Error ? error.message : String(error));
|
|
26
|
+
return undefined;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function discoverCoverage(context) {
|
|
30
|
+
return CONTRACTS.enforce(DISCOVER_COVERAGE).discoverCoverage(context).then((coverage) => {
|
|
31
|
+
context.display.info(`Discovered code coverage: ${Internal.formatPercent(coverage.percentage)}`);
|
|
32
|
+
return coverage;
|
|
33
|
+
}).catch((error) => {
|
|
34
|
+
context.display.error(error instanceof Error ? error.message : String(error));
|
|
35
|
+
return undefined;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
20
38
|
//# sourceMappingURL=discover-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-command.js","sourceRoot":"","sources":["../../src/impl/discover-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD
|
|
1
|
+
{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AU,gBAAgB,CAAC,OAAgB;IAC9C,OAAO,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtF,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACjG,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;QACxB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-command.d.ts","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-command.d.ts","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AASvD,OAAO,EAAE,OAAO,EAAW,MAAM,wCAAwC,CAAC;AAQ1E,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAUpC,CAAC"}
|
package/impl/generate-command.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { CONTRACT as BADGE_FACTORY } from "@jonloucks/badges-ts/api/BadgeFactory";
|
|
2
|
-
import {
|
|
2
|
+
import { getCodeCoverageBadgePath, getNpmBadgePath, getTemplateBadgePath, getTypedocBadgePath } from "@jonloucks/badges-ts/api/Variances";
|
|
3
3
|
import { CONTRACT as DISCOVER_PROJECT } from "@jonloucks/badges-ts/auxiliary/DiscoverProject";
|
|
4
|
+
import { CONTRACT as DISCOVER_COVERAGE } from "@jonloucks/badges-ts/auxiliary/DiscoverCoverage";
|
|
4
5
|
import { CONTRACTS } from "@jonloucks/contracts-ts";
|
|
5
|
-
import { isPresent } from "@jonloucks/contracts-ts/api/Types";
|
|
6
6
|
import { used } from "@jonloucks/contracts-ts/auxiliary/Checks";
|
|
7
|
-
import { readFile } from "fs";
|
|
8
|
-
import { resolve } from "path";
|
|
9
7
|
import { Internal } from "./Internal.impl.js";
|
|
10
8
|
export const COMMAND = {
|
|
11
9
|
execute: async function (context) {
|
|
@@ -56,107 +54,27 @@ async function discoverProject(context) {
|
|
|
56
54
|
return await CONTRACTS.enforce(DISCOVER_PROJECT).discoverProject(context);
|
|
57
55
|
}
|
|
58
56
|
;
|
|
57
|
+
async function discoverCoverage(context) {
|
|
58
|
+
return await CONTRACTS.enforce(DISCOVER_COVERAGE).discoverCoverage(context);
|
|
59
|
+
}
|
|
59
60
|
/**
|
|
60
61
|
* Generates a code coverage summary badge based on the coverage summary JSON file.
|
|
61
62
|
* Reads the coverage percentage, determines the badge color, and generates the SVG badge.
|
|
62
63
|
*/
|
|
63
64
|
async function generateCodeCoverageBadge(context) {
|
|
64
|
-
const
|
|
65
|
+
const coverage = await discoverCoverage(context);
|
|
65
66
|
const badgeFactory = CONTRACTS.enforce(BADGE_FACTORY);
|
|
66
67
|
return await badgeFactory.createBadge({
|
|
67
68
|
name: "coverage-summary",
|
|
68
69
|
outputPath: getCodeCoverageBadgePath(context),
|
|
69
70
|
label: "coverage",
|
|
70
|
-
value: Internal.formatPercent(percentage),
|
|
71
|
-
color: Internal.colorFromPercentComplete(context, percentage),
|
|
71
|
+
value: Internal.formatPercent(coverage.percentage),
|
|
72
|
+
color: Internal.colorFromPercentComplete(context, coverage.percentage),
|
|
72
73
|
templatePath: getTemplateBadgePath(context),
|
|
73
74
|
flags: context.flags,
|
|
74
75
|
display: context.display
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
async function getCodeCoveragePercent(context) {
|
|
78
|
-
// various ways to determine the coverage percentage are attempted in parallel
|
|
79
|
-
// and the first successful result is used; this allows for flexibility in how the
|
|
80
|
-
// coverage percentage is provided and can accommodate different project setups
|
|
81
|
-
return await Promise.any([
|
|
82
|
-
getCodeCoverageFromEnvironment(context),
|
|
83
|
-
getCodeCoveragePercentFromCoverageSummary(context),
|
|
84
|
-
getCodeCoveragePercentFromLcovReport(context)
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
;
|
|
88
|
-
async function getCodeCoverageFromEnvironment(context) {
|
|
89
|
-
return await new Promise((deliver, reject) => {
|
|
90
|
-
const envValue = context.environment.findVariance(KIT_CODE_COVERAGE_PERCENT);
|
|
91
|
-
if (isPresent(envValue)) {
|
|
92
|
-
deliver(envValue);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
reject(new Error('Code coverage percentage not found in environment variables'));
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
async function getCodeCoveragePercentFromCoverageSummary(context) {
|
|
100
|
-
return await new Promise((deliver, reject) => {
|
|
101
|
-
const inputPath = getCoverageSummaryFilePath(context);
|
|
102
|
-
return readFile(inputPath, (err, data) => {
|
|
103
|
-
if (err) {
|
|
104
|
-
reject(err);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
try {
|
|
108
|
-
deliver(readPercentageFromCoverageSummary(data));
|
|
109
|
-
}
|
|
110
|
-
catch (parseError) {
|
|
111
|
-
reject(parseError);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
;
|
|
118
|
-
async function getCodeCoveragePercentFromLcovReport(context) {
|
|
119
|
-
return await new Promise((resolve, reject) => {
|
|
120
|
-
const inputPath = getLcovReportIndexPath(context);
|
|
121
|
-
return readFile(inputPath, 'utf8', (err, data) => {
|
|
122
|
-
if (err) {
|
|
123
|
-
reject(err);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
try {
|
|
127
|
-
resolve(readPercentageFromLcovReport(data));
|
|
128
|
-
}
|
|
129
|
-
catch (parseError) {
|
|
130
|
-
reject(parseError);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
;
|
|
137
|
-
function readPercentageFromLcovReport(data) {
|
|
138
|
-
const percentages = {};
|
|
139
|
-
const pattern = /<span class="strong">\s*([\d.]+)%\s*<\/span>\s*<span class="quiet">\s*(Statements|Branches|Functions|Lines)\s*<\/span>/g;
|
|
140
|
-
for (const match of data.matchAll(pattern)) {
|
|
141
|
-
const label = match[2];
|
|
142
|
-
const value = Number.parseFloat(match[1]);
|
|
143
|
-
if (Internal.isPercent(value)) {
|
|
144
|
-
percentages[label.toLowerCase()] = Internal.normalizePercent(value);
|
|
145
|
-
if (Object.keys(percentages).length >= 4) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const length = Object.keys(percentages).length;
|
|
151
|
-
if (length > 0) {
|
|
152
|
-
let totalPercent = 0;
|
|
153
|
-
for (const label of Object.keys(percentages)) {
|
|
154
|
-
totalPercent += percentages[label];
|
|
155
|
-
}
|
|
156
|
-
return totalPercent / length;
|
|
157
|
-
}
|
|
158
|
-
throw new Error('Unable to parse coverage percentages from lcov report index.html');
|
|
159
|
-
}
|
|
160
78
|
/**
|
|
161
79
|
* Generates a TypeDoc documentation badge with a fixed value of 100%.
|
|
162
80
|
* The badge indicates that the documentation is complete.
|
|
@@ -174,33 +92,4 @@ async function generateTypedocBadge(context) {
|
|
|
174
92
|
display: context.display
|
|
175
93
|
});
|
|
176
94
|
}
|
|
177
|
-
function readPercentageFromCoverageSummary(data) {
|
|
178
|
-
const text = data.toString('utf8');
|
|
179
|
-
const jsonData = JSON.parse(text);
|
|
180
|
-
return jsonData.total.lines.pct;
|
|
181
|
-
}
|
|
182
|
-
function getProjectFolder(context) {
|
|
183
|
-
return context.environment.getVariance(KIT_PROJECT_FOLDER);
|
|
184
|
-
}
|
|
185
|
-
function getCoverageSummaryFilePath(context) {
|
|
186
|
-
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_COVERAGE_SUMMARY_PATH));
|
|
187
|
-
}
|
|
188
|
-
function getTemplateBadgePath(context) {
|
|
189
|
-
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_TEMPLATE_BADGE_PATH));
|
|
190
|
-
}
|
|
191
|
-
function getLcovReportIndexPath(context) {
|
|
192
|
-
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_LCOV_REPORT_INDEX_PATH));
|
|
193
|
-
}
|
|
194
|
-
function getBadgesFolder(context) {
|
|
195
|
-
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_BADGES_FOLDER));
|
|
196
|
-
}
|
|
197
|
-
function getCodeCoverageBadgePath(context) {
|
|
198
|
-
return resolve(getBadgesFolder(context), context.environment.getVariance(KIT_COVERAGE_SUMMARY_BADGE_PATH));
|
|
199
|
-
}
|
|
200
|
-
function getTypedocBadgePath(context) {
|
|
201
|
-
return resolve(getBadgesFolder(context), context.environment.getVariance(KIT_TYPEDOC_BADGE_PATH));
|
|
202
|
-
}
|
|
203
|
-
function getNpmBadgePath(context) {
|
|
204
|
-
return resolve(getBadgesFolder(context), context.environment.getVariance(KIT_NPM_BADGE_PATH));
|
|
205
|
-
}
|
|
206
95
|
//# sourceMappingURL=generate-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-command.js","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAgB,MAAM,uCAAuC,CAAC;AAEhG,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"generate-command.js","source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AAC;IAC3D,MAAM,YAAY,GAAiB,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpE,OAAO,MAAM,YAAY,CAAC,WAAW,CAAC;QACpC,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,wBAAwB,CAAC,OAAO,CAAC;QAC7C,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;QAClD,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC;QACtE,YAAY,EAAE,oBAAoB,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,oBAAoB,CAAC,OAAgB;IAClD,MAAM,YAAY,GAAiB,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpE,OAAO,MAAM,YAAY,CAAC,WAAW,CAAC;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC;QACxC,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;QAClC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC;QACtD,YAAY,EAAE,oBAAoB,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from "@jonloucks/badges-ts/auxiliary/Command";
|
|
2
|
+
/**
|
|
3
|
+
* Command implementation for displaying help information about the Badges-TS CLI.
|
|
4
|
+
* This command provides usage instructions and details about available commands.
|
|
5
|
+
*/
|
|
6
|
+
export declare const COMMAND: Command<void>;
|
|
7
|
+
//# sourceMappingURL=help-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-command.d.ts","sourceRoot":"","sources":["../../src/impl/help-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,wCAAwC,CAAC;AAG1E;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,IAAI,CAmBjC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { VERSION } from "../version.js";
|
|
2
|
+
/**
|
|
3
|
+
* Command implementation for displaying help information about the Badges-TS CLI.
|
|
4
|
+
* This command provides usage instructions and details about available commands.
|
|
5
|
+
*/
|
|
6
|
+
export const COMMAND = {
|
|
7
|
+
execute: async function (context) {
|
|
8
|
+
context.display.trace(`Running help command with: ${context.arguments.join(' ')}`);
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
context.display.info(`Badges-TS CLI - Version ${VERSION}`);
|
|
11
|
+
context.display.info(`Usage:`);
|
|
12
|
+
context.display.info(` badges-ts discover Detect project information from the current directory`);
|
|
13
|
+
context.display.info(` badges-ts generate Generate badges for the current project`);
|
|
14
|
+
context.display.info(` badges-ts apply-version Apply version badges to the current project`);
|
|
15
|
+
context.display.info(` badges-ts version Display the current version of the CLI`);
|
|
16
|
+
context.display.info(` badges-ts coverage-report Generate a code coverage report based on discovered coverage information`);
|
|
17
|
+
context.display.info(` badges-ts coverage-gate Check if code coverage meets a specified gate threshold`);
|
|
18
|
+
context.display.info(` --required-coverage=<value> Specify the required code coverage percentage for the gate (default: 0)`);
|
|
19
|
+
context.display.info(` badges-ts help Display this help message`);
|
|
20
|
+
resolve();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=help-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-command.js","sourceRoot":"","sources":["../../src/impl/help-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,OAAO,EAAE,KAAK,WAAW,OAAgB;QACvC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;YAE3D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;YAC9G,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;YAChG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;YACpG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC;YAC/F,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,0GAA0G,CAAC,CAAC;YACjI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,yFAAyF,CAAC,CAAC;YAChH,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2GAA2G,CAAC,CAAC;YAClI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;YAElF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Command } from "@jonloucks/badges-ts/auxiliary/Command";
|
|
2
|
+
/**
|
|
3
|
+
* Command implementation for displaying help information about the Badges-TS CLI.
|
|
4
|
+
* This command provides usage instructions and details about available commands.
|
|
5
|
+
*/
|
|
6
|
+
export declare const COMMAND: Command<void>;
|
|
7
|
+
//# sourceMappingURL=version-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-command.d.ts","sourceRoot":"","sources":["../../src/impl/version-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,wCAAwC,CAAC;AAG1E;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,IAAI,CAQjC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VERSION } from "../version.js";
|
|
2
|
+
/**
|
|
3
|
+
* Command implementation for displaying help information about the Badges-TS CLI.
|
|
4
|
+
* This command provides usage instructions and details about available commands.
|
|
5
|
+
*/
|
|
6
|
+
export const COMMAND = {
|
|
7
|
+
execute: async function (context) {
|
|
8
|
+
context.display.trace(`Running version command with: ${context.arguments.join(' ')}`);
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
context.display.info(`Badges-TS CLI - Version ${VERSION}`);
|
|
11
|
+
resolve();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=version-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-command.js","sourceRoot":"","sources":["../../src/impl/version-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,OAAO,EAAE,KAAK,WAAW,OAAgB;QACvC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,iCAAiC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;YAC3D,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { VERSION } from "@jonloucks/badges-ts/version";
|
|
2
2
|
import type { OptionalType, RequiredType } from "@jonloucks/badges-ts/api/Types";
|
|
3
3
|
import type { Config as BadgeConfig, Badge } from "@jonloucks/badges-ts/api/Badge";
|
|
4
|
-
import type { Config as BadgesConfig, Badges } from "@jonloucks/badges-ts/api/Badges";
|
|
5
4
|
import { BadgeException } from "@jonloucks/badges-ts/api/BadgeException";
|
|
6
5
|
import type { Installer, Config as InstallerConfig } from "@jonloucks/badges-ts/api/Installer";
|
|
7
6
|
import { create as createInstaller } from "./impl/Installer.impl.js";
|
|
8
|
-
export { Badge, BadgeConfig,
|
|
7
|
+
export { Badge, BadgeConfig, RequiredType, OptionalType, Installer, InstallerConfig, VERSION, BadgeException, createInstaller };
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,OAAO,EACP,cAAc,EACd,eAAe,EAChB,CAAC"}
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAOL,OAAO,EACP,cAAc,EACd,eAAe,EAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jonloucks/badges-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Node.js badge creator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"build": "tsc",
|
|
47
47
|
"test": "tsx --test $(find src -name '*.test.ts')",
|
|
48
48
|
"test:watch": "tsx --test --watch $(find src -name '*.test.ts')",
|
|
49
|
-
"test:coverage": "
|
|
49
|
+
"test:coverage": "mkdir -p coverage && tsx --test --experimental-test-coverage --experimental-specifier-resolution=node --test-reporter=lcov $(find src -name '*.test.ts') > coverage/lcov.info",
|
|
50
|
+
"test:coverage-report": "npx tsx ./src/bin/badges-ts.js coverage-report",
|
|
51
|
+
"test:coverage-gate": "npx tsx ./src/bin/badges-ts.js coverage-gate",
|
|
50
52
|
"lint": "eslint . --ext .ts",
|
|
51
53
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
52
54
|
"prepublishOnly": "npm run build",
|
|
@@ -80,11 +82,13 @@
|
|
|
80
82
|
"publishConfig": {
|
|
81
83
|
"registry": "https://registry.npmjs.org/"
|
|
82
84
|
},
|
|
85
|
+
"overrides": {
|
|
86
|
+
"minimatch": "10.2.1"
|
|
87
|
+
},
|
|
83
88
|
"devDependencies": {
|
|
84
89
|
"@types/node": "^25.3.0",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "^8.56.
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
86
91
|
"@typescript-eslint/parser": "^8.56.0",
|
|
87
|
-
"c8": "^10.1.3",
|
|
88
92
|
"eslint": "^9.39.2",
|
|
89
93
|
"tsx": "^4.19.2",
|
|
90
94
|
"typedoc": "^0.28.17",
|
package/version.js
CHANGED
package/api/Badges.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Badge } from "@jonloucks/badges-ts/api/Badge";
|
|
2
|
-
export interface Config {
|
|
3
|
-
verbose?: boolean;
|
|
4
|
-
dryRun?: boolean;
|
|
5
|
-
createFolders?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface Badges {
|
|
8
|
-
createBadges(config: Config): Promise<Badge[]>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=Badges.d.ts.map
|
package/api/Badges.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badges.d.ts","sourceRoot":"","sources":["../../src/api/Badges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,MAAM;IACrB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAChD"}
|
package/api/Badges.js
DELETED
package/api/Badges.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badges.js","sourceRoot":"","sources":["../../src/api/Badges.ts"],"names":[],"mappings":""}
|