@code-pushup/cli 0.2.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 +21 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -24,6 +24,11 @@ import { z as z2 } from "zod";
|
|
|
24
24
|
import { z } from "zod";
|
|
25
25
|
import { MATERIAL_ICONS } from "@code-pushup/portal-client";
|
|
26
26
|
|
|
27
|
+
// packages/models/src/lib/implementation/limits.ts
|
|
28
|
+
var MAX_SLUG_LENGTH = 128;
|
|
29
|
+
var MAX_TITLE_LENGTH = 256;
|
|
30
|
+
var MAX_DESCRIPTION_LENGTH = 65536;
|
|
31
|
+
|
|
27
32
|
// packages/models/src/lib/implementation/utils.ts
|
|
28
33
|
var slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
29
34
|
var filenameRegex = /^(?!.*[ \\/:*?"<>|]).+$/;
|
|
@@ -59,12 +64,12 @@ function executionMetaSchema(options2 = {
|
|
|
59
64
|
function slugSchema(description = "Unique ID (human-readable, URL-safe)") {
|
|
60
65
|
return z.string({ description }).regex(slugRegex, {
|
|
61
66
|
message: "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug"
|
|
62
|
-
}).max(
|
|
63
|
-
message:
|
|
67
|
+
}).max(MAX_SLUG_LENGTH, {
|
|
68
|
+
message: `slug can be max ${MAX_SLUG_LENGTH} characters long`
|
|
64
69
|
});
|
|
65
70
|
}
|
|
66
71
|
function descriptionSchema(description = "Description (markdown)") {
|
|
67
|
-
return z.string({ description }).max(
|
|
72
|
+
return z.string({ description }).max(MAX_DESCRIPTION_LENGTH).optional();
|
|
68
73
|
}
|
|
69
74
|
function docsUrlSchema(description = "Documentation site") {
|
|
70
75
|
return urlSchema(description).optional().or(z.string().max(0));
|
|
@@ -73,7 +78,7 @@ function urlSchema(description) {
|
|
|
73
78
|
return z.string({ description }).url();
|
|
74
79
|
}
|
|
75
80
|
function titleSchema(description = "Descriptive name") {
|
|
76
|
-
return z.string({ description }).max(
|
|
81
|
+
return z.string({ description }).max(MAX_TITLE_LENGTH);
|
|
77
82
|
}
|
|
78
83
|
function metaSchema(options2) {
|
|
79
84
|
const {
|
|
@@ -614,6 +619,14 @@ async function readJsonFile(path) {
|
|
|
614
619
|
const text = await readTextFile(path);
|
|
615
620
|
return JSON.parse(text);
|
|
616
621
|
}
|
|
622
|
+
async function fileExists(path) {
|
|
623
|
+
try {
|
|
624
|
+
const stats = await stat(path);
|
|
625
|
+
return stats.isFile();
|
|
626
|
+
} catch {
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
617
630
|
async function ensureDirectoryExists(baseDir) {
|
|
618
631
|
try {
|
|
619
632
|
await mkdir(baseDir, { recursive: true });
|
|
@@ -1596,7 +1609,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1596
1609
|
|
|
1597
1610
|
// packages/core/package.json
|
|
1598
1611
|
var name = "@code-pushup/core";
|
|
1599
|
-
var version = "0.
|
|
1612
|
+
var version = "0.3.1";
|
|
1600
1613
|
|
|
1601
1614
|
// packages/core/src/lib/implementation/collect.ts
|
|
1602
1615
|
async function collect(options2) {
|
|
@@ -1731,18 +1744,16 @@ async function collectAndPersistReports(options2) {
|
|
|
1731
1744
|
}
|
|
1732
1745
|
|
|
1733
1746
|
// packages/core/src/lib/implementation/read-code-pushup-config.ts
|
|
1734
|
-
import { stat as stat3 } from "fs/promises";
|
|
1735
1747
|
var ConfigPathError = class extends Error {
|
|
1736
1748
|
constructor(configPath) {
|
|
1737
|
-
super(`
|
|
1749
|
+
super(`Provided path '${configPath}' is not valid.`);
|
|
1738
1750
|
}
|
|
1739
1751
|
};
|
|
1740
1752
|
async function readCodePushupConfig(filepath) {
|
|
1741
1753
|
if (!filepath.length) {
|
|
1742
|
-
throw new Error("
|
|
1754
|
+
throw new Error("The configuration path is empty.");
|
|
1743
1755
|
}
|
|
1744
|
-
|
|
1745
|
-
if (!isFile) {
|
|
1756
|
+
if (!await fileExists(filepath)) {
|
|
1746
1757
|
throw new ConfigPathError(filepath);
|
|
1747
1758
|
}
|
|
1748
1759
|
return importEsmModule(
|