@code-pushup/core 0.3.0 → 0.3.1
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 +12 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -611,6 +611,14 @@ async function readJsonFile(path) {
|
|
|
611
611
|
const text = await readTextFile(path);
|
|
612
612
|
return JSON.parse(text);
|
|
613
613
|
}
|
|
614
|
+
async function fileExists(path) {
|
|
615
|
+
try {
|
|
616
|
+
const stats = await stat(path);
|
|
617
|
+
return stats.isFile();
|
|
618
|
+
} catch {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
614
622
|
async function ensureDirectoryExists(baseDir) {
|
|
615
623
|
try {
|
|
616
624
|
await mkdir(baseDir, { recursive: true });
|
|
@@ -1593,7 +1601,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1593
1601
|
|
|
1594
1602
|
// packages/core/package.json
|
|
1595
1603
|
var name = "@code-pushup/core";
|
|
1596
|
-
var version = "0.3.
|
|
1604
|
+
var version = "0.3.1";
|
|
1597
1605
|
|
|
1598
1606
|
// packages/core/src/lib/implementation/collect.ts
|
|
1599
1607
|
async function collect(options) {
|
|
@@ -1728,18 +1736,16 @@ async function collectAndPersistReports(options) {
|
|
|
1728
1736
|
}
|
|
1729
1737
|
|
|
1730
1738
|
// packages/core/src/lib/implementation/read-code-pushup-config.ts
|
|
1731
|
-
import { stat as stat3 } from "fs/promises";
|
|
1732
1739
|
var ConfigPathError = class extends Error {
|
|
1733
1740
|
constructor(configPath) {
|
|
1734
|
-
super(`
|
|
1741
|
+
super(`Provided path '${configPath}' is not valid.`);
|
|
1735
1742
|
}
|
|
1736
1743
|
};
|
|
1737
1744
|
async function readCodePushupConfig(filepath) {
|
|
1738
1745
|
if (!filepath.length) {
|
|
1739
|
-
throw new Error("
|
|
1746
|
+
throw new Error("The configuration path is empty.");
|
|
1740
1747
|
}
|
|
1741
|
-
|
|
1742
|
-
if (!isFile) {
|
|
1748
|
+
if (!await fileExists(filepath)) {
|
|
1743
1749
|
throw new ConfigPathError(filepath);
|
|
1744
1750
|
}
|
|
1745
1751
|
return importEsmModule(
|