@code-pushup/cli 0.5.2 → 0.5.3
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/index.js +26 -13
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -230,8 +230,7 @@ var persistConfigSchema = z3.object({
|
|
|
230
230
|
filename: fileNameSchema(
|
|
231
231
|
"Artifacts file name (without extension)"
|
|
232
232
|
).optional(),
|
|
233
|
-
format: z3.array(formatSchema).
|
|
234
|
-
// @TODO remove default or optional value and otherwise it will not set defaults.
|
|
233
|
+
format: z3.array(formatSchema).optional()
|
|
235
234
|
});
|
|
236
235
|
|
|
237
236
|
// packages/models/src/lib/plugin-config.ts
|
|
@@ -1499,18 +1498,18 @@ var PersistError = class extends Error {
|
|
|
1499
1498
|
};
|
|
1500
1499
|
async function persistReport(report, options2) {
|
|
1501
1500
|
const { outputDir, filename, format } = options2;
|
|
1502
|
-
|
|
1501
|
+
const scoredReport = scoreReport(report);
|
|
1503
1502
|
console.info(reportToStdout(scoredReport));
|
|
1504
|
-
const results = [
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1503
|
+
const results = [];
|
|
1504
|
+
if (format.includes("json")) {
|
|
1505
|
+
results.push({
|
|
1506
|
+
format: "json",
|
|
1507
|
+
content: JSON.stringify(report, null, 2)
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1508
1510
|
if (format.includes("md")) {
|
|
1509
|
-
scoredReport = scoredReport || scoreReport(report);
|
|
1510
1511
|
const commitData = await getLatestCommit();
|
|
1511
|
-
|
|
1512
|
-
console.warn("no commit data available");
|
|
1513
|
-
}
|
|
1512
|
+
validateCommitData(commitData);
|
|
1514
1513
|
results.push({
|
|
1515
1514
|
format: "md",
|
|
1516
1515
|
content: reportToMd(scoredReport, commitData)
|
|
@@ -1537,6 +1536,11 @@ async function persistReport(report, options2) {
|
|
|
1537
1536
|
function logPersistedResults(persistResults) {
|
|
1538
1537
|
logMultipleFileResults(persistResults, "Generated reports");
|
|
1539
1538
|
}
|
|
1539
|
+
function validateCommitData(commitData) {
|
|
1540
|
+
if (!commitData) {
|
|
1541
|
+
console.warn("no commit data available");
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1540
1544
|
|
|
1541
1545
|
// packages/core/src/lib/implementation/execute-plugin.ts
|
|
1542
1546
|
import chalk4 from "chalk";
|
|
@@ -1653,7 +1657,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1653
1657
|
|
|
1654
1658
|
// packages/core/package.json
|
|
1655
1659
|
var name = "@code-pushup/core";
|
|
1656
|
-
var version = "0.5.
|
|
1660
|
+
var version = "0.5.3";
|
|
1657
1661
|
|
|
1658
1662
|
// packages/core/src/lib/implementation/collect.ts
|
|
1659
1663
|
async function collect(options2) {
|
|
@@ -1837,7 +1841,16 @@ function yargsAutorunCommandObject() {
|
|
|
1837
1841
|
console.info(chalk5.bold(CLI_NAME));
|
|
1838
1842
|
console.info(chalk5.gray(`Run ${command}...`));
|
|
1839
1843
|
const options2 = args;
|
|
1840
|
-
|
|
1844
|
+
const optionsWithFormat = {
|
|
1845
|
+
...options2,
|
|
1846
|
+
persist: {
|
|
1847
|
+
...options2.persist,
|
|
1848
|
+
format: [
|
|
1849
|
+
.../* @__PURE__ */ new Set([...options2.persist.format, "json"])
|
|
1850
|
+
]
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1853
|
+
await collectAndPersistReports(optionsWithFormat);
|
|
1841
1854
|
if (!options2.upload) {
|
|
1842
1855
|
console.warn("Upload skipped because configuration is not set.");
|
|
1843
1856
|
} else {
|