@code-pushup/core 0.6.3 → 0.6.5
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 +19 -46
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -547,6 +547,12 @@ var reportSchema = packageVersionSchema({
|
|
|
547
547
|
)
|
|
548
548
|
);
|
|
549
549
|
|
|
550
|
+
// packages/utils/src/lib/constants.ts
|
|
551
|
+
var SCORE_COLOR_RANGE = {
|
|
552
|
+
GREEN_MIN: 0.9,
|
|
553
|
+
YELLOW_MIN: 0.5
|
|
554
|
+
};
|
|
555
|
+
|
|
550
556
|
// packages/utils/src/lib/file-system.ts
|
|
551
557
|
import { bundleRequire } from "bundle-require";
|
|
552
558
|
import chalk from "chalk";
|
|
@@ -709,19 +715,19 @@ function formatReportScore(score) {
|
|
|
709
715
|
return Math.round(score * 100).toString();
|
|
710
716
|
}
|
|
711
717
|
function getRoundScoreMarker(score) {
|
|
712
|
-
if (score >=
|
|
718
|
+
if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
|
|
713
719
|
return "\u{1F7E2}";
|
|
714
720
|
}
|
|
715
|
-
if (score >=
|
|
721
|
+
if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
|
|
716
722
|
return "\u{1F7E1}";
|
|
717
723
|
}
|
|
718
724
|
return "\u{1F534}";
|
|
719
725
|
}
|
|
720
726
|
function getSquaredScoreMarker(score) {
|
|
721
|
-
if (score >=
|
|
727
|
+
if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
|
|
722
728
|
return "\u{1F7E9}";
|
|
723
729
|
}
|
|
724
|
-
if (score >=
|
|
730
|
+
if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
|
|
725
731
|
return "\u{1F7E8}";
|
|
726
732
|
}
|
|
727
733
|
return "\u{1F7E5}";
|
|
@@ -926,38 +932,6 @@ function executeProcess(cfg) {
|
|
|
926
932
|
});
|
|
927
933
|
});
|
|
928
934
|
}
|
|
929
|
-
function objectToCliArgs(params) {
|
|
930
|
-
if (!params) {
|
|
931
|
-
return [];
|
|
932
|
-
}
|
|
933
|
-
return Object.entries(params).flatMap(([key, value]) => {
|
|
934
|
-
if (key === "_") {
|
|
935
|
-
if (Array.isArray(value)) {
|
|
936
|
-
return value;
|
|
937
|
-
} else {
|
|
938
|
-
return [value + ""];
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
const prefix = key.length === 1 ? "-" : "--";
|
|
942
|
-
if (Array.isArray(value)) {
|
|
943
|
-
return value.map((v) => `${prefix}${key}="${v}"`);
|
|
944
|
-
}
|
|
945
|
-
if (Array.isArray(value)) {
|
|
946
|
-
return value.map((v) => `${prefix}${key}="${v}"`);
|
|
947
|
-
}
|
|
948
|
-
if (typeof value === "string") {
|
|
949
|
-
return [`${prefix}${key}="${value}"`];
|
|
950
|
-
}
|
|
951
|
-
if (typeof value === "number") {
|
|
952
|
-
return [`${prefix}${key}=${value}`];
|
|
953
|
-
}
|
|
954
|
-
if (typeof value === "boolean") {
|
|
955
|
-
return [`${prefix}${value ? "" : "no-"}${key}`];
|
|
956
|
-
}
|
|
957
|
-
throw new Error(`Unsupported type ${typeof value} for key ${key}`);
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
objectToCliArgs({ z: 5 });
|
|
961
935
|
|
|
962
936
|
// packages/utils/src/lib/git.ts
|
|
963
937
|
import simpleGit from "simple-git";
|
|
@@ -1363,19 +1337,18 @@ function reportToDetailSection(report) {
|
|
|
1363
1337
|
return output;
|
|
1364
1338
|
}
|
|
1365
1339
|
function withColor({ score, text }) {
|
|
1366
|
-
|
|
1340
|
+
const formattedScore = text ?? formatReportScore(score);
|
|
1367
1341
|
const style2 = text ? chalk3 : chalk3.bold;
|
|
1368
|
-
if (score
|
|
1369
|
-
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
str = style2.green(str);
|
|
1342
|
+
if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
|
|
1343
|
+
return style2.green(formattedScore);
|
|
1344
|
+
}
|
|
1345
|
+
if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
|
|
1346
|
+
return style2.yellow(formattedScore);
|
|
1374
1347
|
}
|
|
1375
|
-
return
|
|
1348
|
+
return style2.red(formattedScore);
|
|
1376
1349
|
}
|
|
1377
1350
|
|
|
1378
|
-
// packages/utils/src/lib/
|
|
1351
|
+
// packages/utils/src/lib/transform.ts
|
|
1379
1352
|
function deepClone(obj) {
|
|
1380
1353
|
if (obj == null || typeof obj !== "object") {
|
|
1381
1354
|
return obj;
|
|
@@ -1649,7 +1622,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1649
1622
|
|
|
1650
1623
|
// packages/core/package.json
|
|
1651
1624
|
var name = "@code-pushup/core";
|
|
1652
|
-
var version = "0.6.
|
|
1625
|
+
var version = "0.6.5";
|
|
1653
1626
|
|
|
1654
1627
|
// packages/core/src/lib/implementation/collect.ts
|
|
1655
1628
|
async function collect(options) {
|