@code-pushup/core
Advanced tools
Comparing version 0.6.5 to 0.6.6
72
index.js
@@ -667,16 +667,14 @@ // packages/core/src/lib/implementation/persist.ts | ||
constructor(filepath) { | ||
super(`No export found in ${filepath}`); | ||
super(`No default export found in ${filepath}`); | ||
} | ||
}; | ||
async function importEsmModule(options, parse) { | ||
parse = parse || ((v) => v); | ||
options = { | ||
async function importEsmModule(options) { | ||
const { mod } = await bundleRequire({ | ||
format: "esm", | ||
...options | ||
}; | ||
const { mod } = await bundleRequire(options); | ||
if (mod.default === void 0) { | ||
}); | ||
if (!("default" in mod)) { | ||
throw new NoExportError(options.filepath); | ||
} | ||
return parse(mod.default); | ||
return mod.default; | ||
} | ||
@@ -1286,25 +1284,2 @@ | ||
} | ||
function reportToOverviewSection2({ | ||
categories, | ||
plugins | ||
}) { | ||
let output = addLine(chalk3.magentaBright.bold("Categories")); | ||
output += addLine(); | ||
const table = new Table({ | ||
head: reportRawOverviewTableHeaders, | ||
colAligns: ["left", "right", "right"], | ||
style: { | ||
head: ["cyan"] | ||
} | ||
}); | ||
table.push( | ||
...categories.map(({ title, score, refs }) => [ | ||
title, | ||
withColor({ score }), | ||
countCategoryAudits(refs, plugins) | ||
]) | ||
); | ||
output += addLine(table.toString()); | ||
return output; | ||
} | ||
function reportToDetailSection(report) { | ||
@@ -1341,2 +1316,25 @@ const { plugins } = report; | ||
} | ||
function reportToOverviewSection2({ | ||
categories, | ||
plugins | ||
}) { | ||
let output = addLine(chalk3.magentaBright.bold("Categories")); | ||
output += addLine(); | ||
const table = new Table({ | ||
head: reportRawOverviewTableHeaders, | ||
colAligns: ["left", "right", "right"], | ||
style: { | ||
head: ["cyan"] | ||
} | ||
}); | ||
table.push( | ||
...categories.map(({ title, score, refs }) => [ | ||
title, | ||
withColor({ score }), | ||
countCategoryAudits(refs, plugins) | ||
]) | ||
); | ||
output += addLine(table.toString()); | ||
return output; | ||
} | ||
function withColor({ score, text }) { | ||
@@ -1628,3 +1626,3 @@ const formattedScore = text ?? formatReportScore(score); | ||
var name = "@code-pushup/core"; | ||
var version = "0.6.5"; | ||
var version = "0.6.6"; | ||
@@ -1778,14 +1776,6 @@ // packages/core/src/lib/implementation/collect.ts | ||
async function readCodePushupConfig(filepath) { | ||
if (!filepath.length) { | ||
throw new Error("The configuration path is empty."); | ||
} | ||
if (!await fileExists(filepath)) { | ||
throw new ConfigPathError(filepath); | ||
} | ||
return importEsmModule( | ||
{ | ||
filepath | ||
}, | ||
(d) => coreConfigSchema.parse(d) | ||
); | ||
return coreConfigSchema.parse(await importEsmModule({ filepath })); | ||
} | ||
@@ -1792,0 +1782,0 @@ export { |
{ | ||
"name": "@code-pushup/core", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@code-pushup/models": "*", |
76750
1951