@code-pushup/core 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.
Files changed (2) hide show
  1. package/index.js +16 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -222,8 +222,7 @@ var persistConfigSchema = z3.object({
222
222
  filename: fileNameSchema(
223
223
  "Artifacts file name (without extension)"
224
224
  ).optional(),
225
- format: z3.array(formatSchema).default(["json"]).optional()
226
- // @TODO remove default or optional value and otherwise it will not set defaults.
225
+ format: z3.array(formatSchema).optional()
227
226
  });
228
227
 
229
228
  // packages/models/src/lib/plugin-config.ts
@@ -1491,18 +1490,18 @@ var PersistError = class extends Error {
1491
1490
  };
1492
1491
  async function persistReport(report, options) {
1493
1492
  const { outputDir, filename, format } = options;
1494
- let scoredReport = scoreReport(report);
1493
+ const scoredReport = scoreReport(report);
1495
1494
  console.info(reportToStdout(scoredReport));
1496
- const results = [
1497
- // JSON is always persisted
1498
- { format: "json", content: JSON.stringify(report, null, 2) }
1499
- ];
1495
+ const results = [];
1496
+ if (format.includes("json")) {
1497
+ results.push({
1498
+ format: "json",
1499
+ content: JSON.stringify(report, null, 2)
1500
+ });
1501
+ }
1500
1502
  if (format.includes("md")) {
1501
- scoredReport = scoredReport || scoreReport(report);
1502
1503
  const commitData = await getLatestCommit();
1503
- if (!commitData) {
1504
- console.warn("no commit data available");
1505
- }
1504
+ validateCommitData(commitData);
1506
1505
  results.push({
1507
1506
  format: "md",
1508
1507
  content: reportToMd(scoredReport, commitData)
@@ -1529,6 +1528,11 @@ async function persistReport(report, options) {
1529
1528
  function logPersistedResults(persistResults) {
1530
1529
  logMultipleFileResults(persistResults, "Generated reports");
1531
1530
  }
1531
+ function validateCommitData(commitData) {
1532
+ if (!commitData) {
1533
+ console.warn("no commit data available");
1534
+ }
1535
+ }
1532
1536
 
1533
1537
  // packages/core/src/lib/implementation/execute-plugin.ts
1534
1538
  import chalk4 from "chalk";
@@ -1645,7 +1649,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1645
1649
 
1646
1650
  // packages/core/package.json
1647
1651
  var name = "@code-pushup/core";
1648
- var version = "0.5.2";
1652
+ var version = "0.5.3";
1649
1653
 
1650
1654
  // packages/core/src/lib/implementation/collect.ts
1651
1655
  async function collect(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/core",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "@code-pushup/utils": "*",