@code-pushup/cli 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.
Files changed (2) hide show
  1. package/index.js +19 -46
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -555,6 +555,12 @@ var reportSchema = packageVersionSchema({
555
555
  )
556
556
  );
557
557
 
558
+ // packages/utils/src/lib/constants.ts
559
+ var SCORE_COLOR_RANGE = {
560
+ GREEN_MIN: 0.9,
561
+ YELLOW_MIN: 0.5
562
+ };
563
+
558
564
  // packages/utils/src/lib/file-system.ts
559
565
  import { bundleRequire } from "bundle-require";
560
566
  import chalk from "chalk";
@@ -717,19 +723,19 @@ function formatReportScore(score) {
717
723
  return Math.round(score * 100).toString();
718
724
  }
719
725
  function getRoundScoreMarker(score) {
720
- if (score >= 0.9) {
726
+ if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
721
727
  return "\u{1F7E2}";
722
728
  }
723
- if (score >= 0.5) {
729
+ if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
724
730
  return "\u{1F7E1}";
725
731
  }
726
732
  return "\u{1F534}";
727
733
  }
728
734
  function getSquaredScoreMarker(score) {
729
- if (score >= 0.9) {
735
+ if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
730
736
  return "\u{1F7E9}";
731
737
  }
732
- if (score >= 0.5) {
738
+ if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
733
739
  return "\u{1F7E8}";
734
740
  }
735
741
  return "\u{1F7E5}";
@@ -934,38 +940,6 @@ function executeProcess(cfg) {
934
940
  });
935
941
  });
936
942
  }
937
- function objectToCliArgs(params) {
938
- if (!params) {
939
- return [];
940
- }
941
- return Object.entries(params).flatMap(([key, value]) => {
942
- if (key === "_") {
943
- if (Array.isArray(value)) {
944
- return value;
945
- } else {
946
- return [value + ""];
947
- }
948
- }
949
- const prefix = key.length === 1 ? "-" : "--";
950
- if (Array.isArray(value)) {
951
- return value.map((v) => `${prefix}${key}="${v}"`);
952
- }
953
- if (Array.isArray(value)) {
954
- return value.map((v) => `${prefix}${key}="${v}"`);
955
- }
956
- if (typeof value === "string") {
957
- return [`${prefix}${key}="${value}"`];
958
- }
959
- if (typeof value === "number") {
960
- return [`${prefix}${key}=${value}`];
961
- }
962
- if (typeof value === "boolean") {
963
- return [`${prefix}${value ? "" : "no-"}${key}`];
964
- }
965
- throw new Error(`Unsupported type ${typeof value} for key ${key}`);
966
- });
967
- }
968
- objectToCliArgs({ z: 5 });
969
943
 
970
944
  // packages/utils/src/lib/git.ts
971
945
  import simpleGit from "simple-git";
@@ -1371,19 +1345,18 @@ function reportToDetailSection(report) {
1371
1345
  return output;
1372
1346
  }
1373
1347
  function withColor({ score, text }) {
1374
- let str = text ?? formatReportScore(score);
1348
+ const formattedScore = text ?? formatReportScore(score);
1375
1349
  const style2 = text ? chalk3 : chalk3.bold;
1376
- if (score < 0.5) {
1377
- str = style2.red(str);
1378
- } else if (score < 0.9) {
1379
- str = style2.yellow(str);
1380
- } else {
1381
- str = style2.green(str);
1350
+ if (score >= SCORE_COLOR_RANGE.GREEN_MIN) {
1351
+ return style2.green(formattedScore);
1352
+ }
1353
+ if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) {
1354
+ return style2.yellow(formattedScore);
1382
1355
  }
1383
- return str;
1356
+ return style2.red(formattedScore);
1384
1357
  }
1385
1358
 
1386
- // packages/utils/src/lib/transformation.ts
1359
+ // packages/utils/src/lib/transform.ts
1387
1360
  function toArray(val) {
1388
1361
  return Array.isArray(val) ? val : [val];
1389
1362
  }
@@ -1660,7 +1633,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1660
1633
 
1661
1634
  // packages/core/package.json
1662
1635
  var name = "@code-pushup/core";
1663
- var version = "0.6.3";
1636
+ var version = "0.6.5";
1664
1637
 
1665
1638
  // packages/core/src/lib/implementation/collect.ts
1666
1639
  async function collect(options2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "bin": {
5
5
  "code-pushup": "index.js"
6
6
  },