@code-pushup/cli 0.46.0 → 0.47.0
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 +44 -39
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function missingRefsForCategoriesErrorMsg(categories, plugins) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// packages/models/src/lib/implementation/schemas.ts
|
|
74
|
-
var
|
|
74
|
+
var tableCellValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]).default(null);
|
|
75
75
|
function executionMetaSchema(options2 = {
|
|
76
76
|
descriptionDate: "Execution start date and time",
|
|
77
77
|
descriptionDuration: "Execution duration in ms"
|
|
@@ -235,10 +235,10 @@ var tableColumnObjectSchema = z4.object({
|
|
|
235
235
|
label: z4.string().optional(),
|
|
236
236
|
align: tableAlignmentSchema.optional()
|
|
237
237
|
});
|
|
238
|
-
var tableRowObjectSchema = z4.record(
|
|
238
|
+
var tableRowObjectSchema = z4.record(tableCellValueSchema, {
|
|
239
239
|
description: "Object row"
|
|
240
240
|
});
|
|
241
|
-
var tableRowPrimitiveSchema = z4.array(
|
|
241
|
+
var tableRowPrimitiveSchema = z4.array(tableCellValueSchema, {
|
|
242
242
|
description: "Primitive row"
|
|
243
243
|
});
|
|
244
244
|
var tableSharedSchema = z4.object({
|
|
@@ -793,9 +793,9 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
793
793
|
function pluralizeToken(token, times) {
|
|
794
794
|
return `${times} ${Math.abs(times) === 1 ? token : pluralize(token)}`;
|
|
795
795
|
}
|
|
796
|
-
function formatDuration(duration) {
|
|
796
|
+
function formatDuration(duration, granularity = 0) {
|
|
797
797
|
if (duration < 1e3) {
|
|
798
|
-
return `${duration} ms`;
|
|
798
|
+
return `${granularity ? duration.toFixed(granularity) : duration} ms`;
|
|
799
799
|
}
|
|
800
800
|
return `${(duration / 1e3).toFixed(2)} s`;
|
|
801
801
|
}
|
|
@@ -981,20 +981,12 @@ function logMultipleFileResults(fileResults, messagePrefix) {
|
|
|
981
981
|
failedTransform
|
|
982
982
|
);
|
|
983
983
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
async function importModule(options2) {
|
|
985
|
+
const { mod } = await bundleRequire(options2);
|
|
986
|
+
if (typeof mod === "object" && "default" in mod) {
|
|
987
|
+
return mod.default;
|
|
987
988
|
}
|
|
988
|
-
|
|
989
|
-
async function importEsmModule(options2) {
|
|
990
|
-
const { mod } = await bundleRequire({
|
|
991
|
-
format: "esm",
|
|
992
|
-
...options2
|
|
993
|
-
});
|
|
994
|
-
if (!("default" in mod)) {
|
|
995
|
-
throw new NoExportError(options2.filepath);
|
|
996
|
-
}
|
|
997
|
-
return mod.default;
|
|
989
|
+
return mod;
|
|
998
990
|
}
|
|
999
991
|
|
|
1000
992
|
// packages/utils/src/lib/text-formats/constants.ts
|
|
@@ -1027,7 +1019,7 @@ function code(text) {
|
|
|
1027
1019
|
|
|
1028
1020
|
// packages/utils/src/lib/text-formats/html/link.ts
|
|
1029
1021
|
function link2(href, text) {
|
|
1030
|
-
return `<a href="${href}">${text || href}
|
|
1022
|
+
return `<a href="${href}">${text || href}</a>`;
|
|
1031
1023
|
}
|
|
1032
1024
|
|
|
1033
1025
|
// packages/utils/src/lib/transform.ts
|
|
@@ -1049,7 +1041,7 @@ function capitalize(text) {
|
|
|
1049
1041
|
)}`;
|
|
1050
1042
|
}
|
|
1051
1043
|
|
|
1052
|
-
// packages/utils/src/lib/table.ts
|
|
1044
|
+
// packages/utils/src/lib/text-formats/table.ts
|
|
1053
1045
|
function rowToStringArray({ rows, columns = [] }) {
|
|
1054
1046
|
if (Array.isArray(rows.at(0)) && typeof columns.at(0) === "object") {
|
|
1055
1047
|
throw new TypeError(
|
|
@@ -1062,14 +1054,19 @@ function rowToStringArray({ rows, columns = [] }) {
|
|
|
1062
1054
|
}
|
|
1063
1055
|
const objectRow = row;
|
|
1064
1056
|
if (columns.length === 0 || typeof columns.at(0) === "string") {
|
|
1065
|
-
return Object.values(objectRow).map(
|
|
1057
|
+
return Object.values(objectRow).map(
|
|
1058
|
+
(value) => value == null ? "" : String(value)
|
|
1059
|
+
);
|
|
1066
1060
|
}
|
|
1067
1061
|
return columns.map(
|
|
1068
|
-
({ key }) => String(objectRow[key])
|
|
1062
|
+
({ key }) => objectRow[key] == null ? "" : String(objectRow[key])
|
|
1069
1063
|
);
|
|
1070
1064
|
});
|
|
1071
1065
|
}
|
|
1072
|
-
function columnsToStringArray({
|
|
1066
|
+
function columnsToStringArray({
|
|
1067
|
+
rows,
|
|
1068
|
+
columns = []
|
|
1069
|
+
}) {
|
|
1073
1070
|
const firstRow = rows.at(0);
|
|
1074
1071
|
const primitiveRows = Array.isArray(firstRow);
|
|
1075
1072
|
if (typeof columns.at(0) === "string" && !primitiveRows) {
|
|
@@ -1109,10 +1106,8 @@ function getColumnAlignmentForIndex(targetIdx, columns = []) {
|
|
|
1109
1106
|
return "center";
|
|
1110
1107
|
}
|
|
1111
1108
|
}
|
|
1112
|
-
function getColumnAlignments({
|
|
1113
|
-
rows,
|
|
1114
|
-
columns = []
|
|
1115
|
-
}) {
|
|
1109
|
+
function getColumnAlignments(tableData) {
|
|
1110
|
+
const { rows, columns = [] } = tableData;
|
|
1116
1111
|
if (rows.at(0) == null) {
|
|
1117
1112
|
throw new Error("first row can`t be undefined.");
|
|
1118
1113
|
}
|
|
@@ -1122,10 +1117,17 @@ function getColumnAlignments({
|
|
|
1122
1117
|
(_, idx) => getColumnAlignmentForIndex(idx, columns)
|
|
1123
1118
|
);
|
|
1124
1119
|
}
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1120
|
+
const biggestRow = [...rows].sort((a, b) => Object.keys(a).length - Object.keys(b).length).at(-1);
|
|
1121
|
+
if (columns.length > 0) {
|
|
1122
|
+
return columns.map(
|
|
1123
|
+
(column, idx) => typeof column === "string" ? column : getColumnAlignmentForKeyAndIndex(
|
|
1124
|
+
column.key,
|
|
1125
|
+
idx,
|
|
1126
|
+
columns
|
|
1127
|
+
)
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
return Object.keys(biggestRow ?? {}).map((_) => "center");
|
|
1129
1131
|
}
|
|
1130
1132
|
|
|
1131
1133
|
// packages/utils/src/lib/text-formats/html/table.ts
|
|
@@ -1222,7 +1224,10 @@ function section(...contents) {
|
|
|
1222
1224
|
return `${lines(...contents)}${NEW_LINE}`;
|
|
1223
1225
|
}
|
|
1224
1226
|
function lines(...contents) {
|
|
1225
|
-
|
|
1227
|
+
const filteredContent = contents.filter(
|
|
1228
|
+
(value) => value != null && value !== "" && value !== false
|
|
1229
|
+
);
|
|
1230
|
+
return `${filteredContent.join(NEW_LINE)}`;
|
|
1226
1231
|
}
|
|
1227
1232
|
|
|
1228
1233
|
// packages/utils/src/lib/text-formats/md/table.ts
|
|
@@ -2134,8 +2139,8 @@ function formatDiffCategoriesSection(diff) {
|
|
|
2134
2139
|
}
|
|
2135
2140
|
const columns = [
|
|
2136
2141
|
{ key: "category", label: "\u{1F3F7}\uFE0F Category", align: "left" },
|
|
2137
|
-
{ key: "after", label: hasChanges ? "\u2B50 Current score" : "\u2B50 Score" },
|
|
2138
2142
|
{ key: "before", label: "\u2B50 Previous score" },
|
|
2143
|
+
{ key: "after", label: hasChanges ? "\u2B50 Current score" : "\u2B50 Score" },
|
|
2139
2144
|
{ key: "change", label: "\u{1F504} Score change" }
|
|
2140
2145
|
];
|
|
2141
2146
|
return lines5(
|
|
@@ -2180,8 +2185,8 @@ function formatDiffGroupsSection(diff) {
|
|
|
2180
2185
|
columns: [
|
|
2181
2186
|
{ key: "plugin", label: "\u{1F50C} Plugin", align: "left" },
|
|
2182
2187
|
{ key: "group", label: "\u{1F5C3}\uFE0F Group", align: "left" },
|
|
2183
|
-
{ key: "after", label: "\u2B50 Current score" },
|
|
2184
2188
|
{ key: "before", label: "\u2B50 Previous score" },
|
|
2189
|
+
{ key: "after", label: "\u2B50 Current score" },
|
|
2185
2190
|
{ key: "change", label: "\u{1F504} Score change" }
|
|
2186
2191
|
],
|
|
2187
2192
|
rows: sortChanges(diff.groups.changed).map((group) => ({
|
|
@@ -2201,8 +2206,8 @@ function formatDiffAuditsSection(diff) {
|
|
|
2201
2206
|
columns: [
|
|
2202
2207
|
{ key: "plugin", label: "\u{1F50C} Plugin", align: "left" },
|
|
2203
2208
|
{ key: "audit", label: "\u{1F6E1}\uFE0F Audit", align: "left" },
|
|
2204
|
-
{ key: "after", label: "\u{1F4CF} Current value" },
|
|
2205
2209
|
{ key: "before", label: "\u{1F4CF} Previous value" },
|
|
2210
|
+
{ key: "after", label: "\u{1F4CF} Current value" },
|
|
2206
2211
|
{ key: "change", label: "\u{1F504} Value change" }
|
|
2207
2212
|
],
|
|
2208
2213
|
rows: sortChanges(diff.audits.changed).map((audit) => ({
|
|
@@ -2573,7 +2578,7 @@ var verboseUtils = (verbose = false) => ({
|
|
|
2573
2578
|
|
|
2574
2579
|
// packages/core/package.json
|
|
2575
2580
|
var name = "@code-pushup/core";
|
|
2576
|
-
var version = "0.
|
|
2581
|
+
var version = "0.47.0";
|
|
2577
2582
|
|
|
2578
2583
|
// packages/core/src/lib/implementation/execute-plugin.ts
|
|
2579
2584
|
import chalk5 from "chalk";
|
|
@@ -3118,9 +3123,9 @@ function tableToGQL(table5) {
|
|
|
3118
3123
|
)
|
|
3119
3124
|
},
|
|
3120
3125
|
rows: table5.rows.map(
|
|
3121
|
-
(row) => Array.isArray(row) ? row.map((content) => ({ content: content
|
|
3126
|
+
(row) => Array.isArray(row) ? row.map((content) => ({ content: content?.toString() ?? "" })) : Object.entries(row).map(([key, content]) => ({
|
|
3122
3127
|
key,
|
|
3123
|
-
content: content
|
|
3128
|
+
content: content?.toString() ?? ""
|
|
3124
3129
|
}))
|
|
3125
3130
|
)
|
|
3126
3131
|
};
|
|
@@ -3238,7 +3243,7 @@ async function readRcByPath(filepath, tsconfig) {
|
|
|
3238
3243
|
if (!await fileExists(filepath)) {
|
|
3239
3244
|
throw new ConfigPathError(filepath);
|
|
3240
3245
|
}
|
|
3241
|
-
const cfg = await
|
|
3246
|
+
const cfg = await importModule({ filepath, tsconfig, format: "esm" });
|
|
3242
3247
|
return coreConfigSchema.parse(cfg);
|
|
3243
3248
|
}
|
|
3244
3249
|
async function autoloadRc(tsconfig) {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"code-pushup": "index.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@code-pushup/models": "0.
|
|
10
|
-
"@code-pushup/core": "0.
|
|
11
|
-
"@code-pushup/utils": "0.
|
|
9
|
+
"@code-pushup/models": "0.47.0",
|
|
10
|
+
"@code-pushup/core": "0.47.0",
|
|
11
|
+
"@code-pushup/utils": "0.47.0",
|
|
12
12
|
"yargs": "^17.7.2",
|
|
13
13
|
"chalk": "^5.3.0",
|
|
14
14
|
"simple-git": "^3.20.0"
|