@code-pushup/cli 0.1.1 → 0.2.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.
Files changed (2) hide show
  1. package/index.js +63 -63
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -606,6 +606,14 @@ function logPromiseResults(results, logMessage, callback) {
606
606
  }
607
607
 
608
608
  // packages/utils/src/lib/file-system.ts
609
+ async function readTextFile(path) {
610
+ const buffer = await readFile(path);
611
+ return buffer.toString();
612
+ }
613
+ async function readJsonFile(path) {
614
+ const text = await readTextFile(path);
615
+ return JSON.parse(text);
616
+ }
609
617
  async function ensureDirectoryExists(baseDir) {
610
618
  try {
611
619
  await mkdir(baseDir, { recursive: true });
@@ -617,14 +625,6 @@ async function ensureDirectoryExists(baseDir) {
617
625
  }
618
626
  }
619
627
  }
620
- async function readTextFile(path) {
621
- const buffer = await readFile(path);
622
- return buffer.toString();
623
- }
624
- async function readJsonFile(path) {
625
- const text = await readTextFile(path);
626
- return JSON.parse(text);
627
- }
628
628
  function logMultipleFileResults(fileResults, messagePrefix) {
629
629
  const succeededCallback = (result) => {
630
630
  const [fileName, size] = result.value;
@@ -924,60 +924,6 @@ async function getLatestCommit() {
924
924
  return log?.latest;
925
925
  }
926
926
 
927
- // packages/utils/src/lib/progress.ts
928
- import chalk2 from "chalk";
929
- import { MultiProgressBars } from "multi-progress-bars";
930
- var barStyles = {
931
- active: (s) => chalk2.green(s),
932
- done: (s) => chalk2.gray(s),
933
- idle: (s) => chalk2.gray(s)
934
- };
935
- var messageStyles = {
936
- active: (s) => chalk2.black(s),
937
- done: (s) => chalk2.green(chalk2.bold(s)),
938
- idle: (s) => chalk2.gray(s)
939
- };
940
- var mpb;
941
- function getSingletonProgressBars(options2) {
942
- if (!mpb) {
943
- mpb = new MultiProgressBars({
944
- initMessage: "",
945
- border: true,
946
- ...options2
947
- });
948
- }
949
- return mpb;
950
- }
951
- function getProgressBar(taskName) {
952
- const tasks = getSingletonProgressBars();
953
- tasks.addTask(taskName, {
954
- type: "percentage",
955
- percentage: 0,
956
- message: "",
957
- barTransformFn: barStyles.idle
958
- });
959
- return {
960
- incrementInSteps: (numPlugins) => {
961
- tasks.incrementTask(taskName, {
962
- percentage: 1 / numPlugins,
963
- barTransformFn: barStyles.active
964
- });
965
- },
966
- updateTitle: (title) => {
967
- tasks.updateTask(taskName, {
968
- message: title,
969
- barTransformFn: barStyles.active
970
- });
971
- },
972
- endProgress: (message = "") => {
973
- tasks.done(taskName, {
974
- message: messageStyles.done(message),
975
- barTransformFn: barStyles.done
976
- });
977
- }
978
- };
979
- }
980
-
981
927
  // packages/utils/src/lib/md/details.ts
982
928
  function details(title, content, cfg = { open: false }) {
983
929
  return `<details${cfg.open ? " open" : ""}>
@@ -1055,6 +1001,60 @@ function li(text, order = "unordered") {
1055
1001
  return `${style2} ${text}`;
1056
1002
  }
1057
1003
 
1004
+ // packages/utils/src/lib/progress.ts
1005
+ import chalk2 from "chalk";
1006
+ import { MultiProgressBars } from "multi-progress-bars";
1007
+ var barStyles = {
1008
+ active: (s) => chalk2.green(s),
1009
+ done: (s) => chalk2.gray(s),
1010
+ idle: (s) => chalk2.gray(s)
1011
+ };
1012
+ var messageStyles = {
1013
+ active: (s) => chalk2.black(s),
1014
+ done: (s) => chalk2.green(chalk2.bold(s)),
1015
+ idle: (s) => chalk2.gray(s)
1016
+ };
1017
+ var mpb;
1018
+ function getSingletonProgressBars(options2) {
1019
+ if (!mpb) {
1020
+ mpb = new MultiProgressBars({
1021
+ initMessage: "",
1022
+ border: true,
1023
+ ...options2
1024
+ });
1025
+ }
1026
+ return mpb;
1027
+ }
1028
+ function getProgressBar(taskName) {
1029
+ const tasks = getSingletonProgressBars();
1030
+ tasks.addTask(taskName, {
1031
+ type: "percentage",
1032
+ percentage: 0,
1033
+ message: "",
1034
+ barTransformFn: barStyles.idle
1035
+ });
1036
+ return {
1037
+ incrementInSteps: (numPlugins) => {
1038
+ tasks.incrementTask(taskName, {
1039
+ percentage: 1 / numPlugins,
1040
+ barTransformFn: barStyles.active
1041
+ });
1042
+ },
1043
+ updateTitle: (title) => {
1044
+ tasks.updateTask(taskName, {
1045
+ message: title,
1046
+ barTransformFn: barStyles.active
1047
+ });
1048
+ },
1049
+ endProgress: (message = "") => {
1050
+ tasks.done(taskName, {
1051
+ message: messageStyles.done(message),
1052
+ barTransformFn: barStyles.done
1053
+ });
1054
+ }
1055
+ };
1056
+ }
1057
+
1058
1058
  // packages/utils/src/lib/report-to-md.ts
1059
1059
  function reportToMd(report, commitData) {
1060
1060
  let md = reportToHeaderSection() + NEW_LINE;
@@ -1596,7 +1596,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1596
1596
 
1597
1597
  // packages/core/package.json
1598
1598
  var name = "@code-pushup/core";
1599
- var version = "0.1.1";
1599
+ var version = "0.2.0";
1600
1600
 
1601
1601
  // packages/core/src/lib/implementation/collect.ts
1602
1602
  async function collect(options2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "bin": {
5
5
  "code-pushup": "index.js"
6
6
  },