@code-pushup/utils 0.8.10 → 0.8.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  // packages/utils/src/lib/execute-process.ts
2
2
  import { spawn } from "node:child_process";
3
3
 
4
- // packages/utils/src/lib/report.ts
4
+ // packages/utils/src/lib/reports/utils.ts
5
5
  import { join as join2 } from "node:path";
6
6
 
7
7
  // packages/models/src/lib/audit.ts
@@ -38,6 +38,46 @@ function errorItems(items, transform = (items2) => items2.join(", ")) {
38
38
  function exists(value) {
39
39
  return value != null;
40
40
  }
41
+ function getMissingRefsForCategories(categories, plugins) {
42
+ const missingRefs = [];
43
+ const auditRefsFromCategory = categories.flatMap(
44
+ ({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
45
+ );
46
+ const auditRefsFromPlugins = plugins.flatMap(
47
+ ({ audits, slug: pluginSlug }) => {
48
+ return audits.map(({ slug }) => `${pluginSlug}/${slug}`);
49
+ }
50
+ );
51
+ const missingAuditRefs = hasMissingStrings(
52
+ auditRefsFromCategory,
53
+ auditRefsFromPlugins
54
+ );
55
+ if (Array.isArray(missingAuditRefs) && missingAuditRefs.length > 0) {
56
+ missingRefs.push(...missingAuditRefs);
57
+ }
58
+ const groupRefsFromCategory = categories.flatMap(
59
+ ({ refs }) => refs.filter(({ type }) => type === "group").map(({ plugin, slug }) => `${plugin}#${slug} (group)`)
60
+ );
61
+ const groupRefsFromPlugins = plugins.flatMap(
62
+ ({ groups, slug: pluginSlug }) => {
63
+ return Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : [];
64
+ }
65
+ );
66
+ const missingGroupRefs = hasMissingStrings(
67
+ groupRefsFromCategory,
68
+ groupRefsFromPlugins
69
+ );
70
+ if (Array.isArray(missingGroupRefs) && missingGroupRefs.length > 0) {
71
+ missingRefs.push(...missingGroupRefs);
72
+ }
73
+ return missingRefs.length ? missingRefs : false;
74
+ }
75
+ function missingRefsForCategoriesErrorMsg(categories, plugins) {
76
+ const missingRefs = getMissingRefsForCategories(categories, plugins);
77
+ return `The following category references need to point to an audit or group: ${errorItems(
78
+ missingRefs
79
+ )}`;
80
+ }
41
81
 
42
82
  // packages/models/src/lib/implementation/schemas.ts
43
83
  function executionMetaSchema(options = {
@@ -96,15 +136,13 @@ function positiveIntSchema(description) {
96
136
  return z.number({ description }).int().nonnegative();
97
137
  }
98
138
  function packageVersionSchema(options) {
99
- let { versionDescription, optional } = options || {};
100
- versionDescription = versionDescription || "NPM version of the package";
101
- optional = !!optional;
139
+ const { versionDescription = "NPM version of the package", required } = options ?? {};
102
140
  const packageSchema = z.string({ description: "NPM package name" });
103
141
  const versionSchema = z.string({ description: versionDescription });
104
142
  return z.object(
105
143
  {
106
- packageName: optional ? packageSchema.optional() : packageSchema,
107
- version: optional ? versionSchema.optional() : versionSchema
144
+ packageName: required ? packageSchema : packageSchema.optional(),
145
+ version: required ? versionSchema : versionSchema.optional()
108
146
  },
109
147
  { description: "NPM package name and version of a published package" }
110
148
  );
@@ -166,7 +204,7 @@ var pluginAuditsSchema = z2.array(auditSchema, {
166
204
  );
167
205
  function duplicateSlugsInAuditsErrorMsg(audits) {
168
206
  const duplicateRefs = getDuplicateSlugsInAudits(audits);
169
- return `In plugin audits the slugs are not unique: ${errorItems(
207
+ return `In plugin audits the following slugs are not unique: ${errorItems(
170
208
  duplicateRefs
171
209
  )}`;
172
210
  }
@@ -355,7 +393,9 @@ function getDuplicateRefsInGroups(groups) {
355
393
  }
356
394
  function duplicateSlugsInGroupsErrorMsg(groups) {
357
395
  const duplicateRefs = getDuplicateSlugsInGroups(groups);
358
- return `In groups the slugs are not unique: ${errorItems(duplicateRefs)}`;
396
+ return `In groups the following slugs are not unique: ${errorItems(
397
+ duplicateRefs
398
+ )}`;
359
399
  }
360
400
  function getDuplicateSlugsInGroups(groups) {
361
401
  return Array.isArray(groups) ? hasDuplicateStrings(groups.map(({ slug }) => slug)) : false;
@@ -381,9 +421,7 @@ var onProgressSchema = z8.function().args(z8.unknown()).returns(z8.void());
381
421
  var runnerFunctionSchema = z8.function().args(onProgressSchema.optional()).returns(z8.union([auditOutputsSchema, z8.promise(auditOutputsSchema)]));
382
422
 
383
423
  // packages/models/src/lib/plugin-config.ts
384
- var pluginMetaSchema = packageVersionSchema({
385
- optional: true
386
- }).merge(
424
+ var pluginMetaSchema = packageVersionSchema().merge(
387
425
  metaSchema({
388
426
  titleDescription: "Descriptive name",
389
427
  descriptionDescription: "Description (markdown)",
@@ -392,7 +430,7 @@ var pluginMetaSchema = packageVersionSchema({
392
430
  })
393
431
  ).merge(
394
432
  z9.object({
395
- slug: slugSchema("References plugin. ID (unique within core config)"),
433
+ slug: slugSchema("Unique plugin slug within core config"),
396
434
  icon: materialIconSchema
397
435
  })
398
436
  );
@@ -409,20 +447,17 @@ var pluginConfigSchema = pluginMetaSchema.merge(pluginDataSchema).refine(
409
447
  );
410
448
  function missingRefsFromGroupsErrorMsg(pluginCfg) {
411
449
  const missingRefs = getMissingRefsFromGroups(pluginCfg);
412
- return `In the groups, the following audit ref's needs to point to a audit in this plugin config: ${errorItems(
450
+ return `The following group references need to point to an existing audit in this plugin config: ${errorItems(
413
451
  missingRefs
414
452
  )}`;
415
453
  }
416
454
  function getMissingRefsFromGroups(pluginCfg) {
417
- if (pluginCfg?.groups?.length && pluginCfg?.audits?.length) {
418
- const groups = pluginCfg?.groups || [];
419
- const audits = pluginCfg?.audits || [];
420
- return hasMissingStrings(
421
- groups.flatMap(({ refs: audits2 }) => audits2.map(({ slug: ref }) => ref)),
422
- audits.map(({ slug }) => slug)
423
- );
424
- }
425
- return false;
455
+ return hasMissingStrings(
456
+ pluginCfg.groups?.flatMap(
457
+ ({ refs: audits }) => audits.map(({ slug: ref }) => ref)
458
+ ) ?? [],
459
+ pluginCfg.audits.map(({ slug }) => slug)
460
+ );
426
461
  }
427
462
 
428
463
  // packages/models/src/lib/upload-config.ts
@@ -432,19 +467,15 @@ var uploadConfigSchema = z10.object({
432
467
  apiKey: z10.string({
433
468
  description: "API key with write access to portal (use `process.env` for security)"
434
469
  }),
435
- organization: z10.string({
436
- description: "Organization in code versioning system"
437
- }),
438
- project: z10.string({
439
- description: "Project in code versioning system"
440
- })
470
+ organization: slugSchema("Organization slug from Code PushUp portal"),
471
+ project: slugSchema("Project slug from Code PushUp portal")
441
472
  });
442
473
 
443
474
  // packages/models/src/lib/core-config.ts
444
475
  var unrefinedCoreConfigSchema = z11.object({
445
476
  plugins: z11.array(pluginConfigSchema, {
446
477
  description: "List of plugins to be used (official, community-provided, or custom)"
447
- }),
478
+ }).min(1),
448
479
  /** portal configuration for persisting results */
449
480
  persist: persistConfigSchema.optional(),
450
481
  /** portal configuration for uploading results */
@@ -454,52 +485,15 @@ var unrefinedCoreConfigSchema = z11.object({
454
485
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
455
486
  function refineCoreConfig(schema) {
456
487
  return schema.refine(
457
- (coreCfg) => !getMissingRefsForCategories(coreCfg),
488
+ (coreCfg) => !getMissingRefsForCategories(coreCfg.categories, coreCfg.plugins),
458
489
  (coreCfg) => ({
459
- message: missingRefsForCategoriesErrorMsg(coreCfg)
490
+ message: missingRefsForCategoriesErrorMsg(
491
+ coreCfg.categories,
492
+ coreCfg.plugins
493
+ )
460
494
  })
461
495
  );
462
496
  }
463
- function missingRefsForCategoriesErrorMsg(coreCfg) {
464
- const missingRefs = getMissingRefsForCategories(coreCfg);
465
- return `In the categories, the following plugin refs do not exist in the provided plugins: ${errorItems(
466
- missingRefs
467
- )}`;
468
- }
469
- function getMissingRefsForCategories(coreCfg) {
470
- const missingRefs = [];
471
- const auditRefsFromCategory = coreCfg.categories.flatMap(
472
- ({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
473
- );
474
- const auditRefsFromPlugins = coreCfg.plugins.flatMap(
475
- ({ audits, slug: pluginSlug }) => {
476
- return audits.map(({ slug }) => `${pluginSlug}/${slug}`);
477
- }
478
- );
479
- const missingAuditRefs = hasMissingStrings(
480
- auditRefsFromCategory,
481
- auditRefsFromPlugins
482
- );
483
- if (Array.isArray(missingAuditRefs) && missingAuditRefs.length > 0) {
484
- missingRefs.push(...missingAuditRefs);
485
- }
486
- const groupRefsFromCategory = coreCfg.categories.flatMap(
487
- ({ refs }) => refs.filter(({ type }) => type === "group").map(({ plugin, slug }) => `${plugin}#${slug} (group)`)
488
- );
489
- const groupRefsFromPlugins = coreCfg.plugins.flatMap(
490
- ({ groups, slug: pluginSlug }) => {
491
- return Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : [];
492
- }
493
- );
494
- const missingGroupRefs = hasMissingStrings(
495
- groupRefsFromCategory,
496
- groupRefsFromPlugins
497
- );
498
- if (Array.isArray(missingGroupRefs) && missingGroupRefs.length > 0) {
499
- missingRefs.push(...missingGroupRefs);
500
- }
501
- return missingRefs.length ? missingRefs : false;
502
- }
503
497
 
504
498
  // packages/models/src/lib/report.ts
505
499
  import { z as z12 } from "zod";
@@ -514,9 +508,32 @@ var pluginReportSchema = pluginMetaSchema.merge(
514
508
  audits: z12.array(auditReportSchema),
515
509
  groups: z12.array(groupSchema).optional()
516
510
  })
511
+ ).refine(
512
+ (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
513
+ (pluginReport) => ({
514
+ message: missingRefsFromGroupsErrorMsg2(
515
+ pluginReport.audits,
516
+ pluginReport.groups ?? []
517
+ )
518
+ })
517
519
  );
520
+ function missingRefsFromGroupsErrorMsg2(audits, groups) {
521
+ const missingRefs = getMissingRefsFromGroups2(audits, groups);
522
+ return `group references need to point to an existing audit in this plugin report: ${errorItems(
523
+ missingRefs
524
+ )}`;
525
+ }
526
+ function getMissingRefsFromGroups2(audits, groups) {
527
+ return hasMissingStrings(
528
+ groups.flatMap(
529
+ ({ refs: auditRefs }) => auditRefs.map(({ slug: ref }) => ref)
530
+ ),
531
+ audits.map(({ slug }) => slug)
532
+ );
533
+ }
518
534
  var reportSchema = packageVersionSchema({
519
- versionDescription: "NPM version of the CLI"
535
+ versionDescription: "NPM version of the CLI",
536
+ required: true
520
537
  }).merge(
521
538
  executionMetaSchema({
522
539
  descriptionDate: "Start date and time of the collect run",
@@ -526,18 +543,20 @@ var reportSchema = packageVersionSchema({
526
543
  z12.object(
527
544
  {
528
545
  categories: z12.array(categoryConfigSchema),
529
- plugins: z12.array(pluginReportSchema)
546
+ plugins: z12.array(pluginReportSchema).min(1)
530
547
  },
531
548
  { description: "Collect output data" }
532
549
  )
550
+ ).refine(
551
+ (report) => !getMissingRefsForCategories(report.categories, report.plugins),
552
+ (report) => ({
553
+ message: missingRefsForCategoriesErrorMsg(
554
+ report.categories,
555
+ report.plugins
556
+ )
557
+ })
533
558
  );
534
559
 
535
- // packages/utils/src/lib/constants.ts
536
- var SCORE_COLOR_RANGE = {
537
- GREEN_MIN: 0.9,
538
- YELLOW_MIN: 0.5
539
- };
540
-
541
560
  // packages/utils/src/lib/file-system.ts
542
561
  import { bundleRequire } from "bundle-require";
543
562
  import chalk from "chalk";
@@ -721,7 +740,14 @@ function findLineNumberInText(content, pattern) {
721
740
  return lineNumber === 0 ? null : lineNumber;
722
741
  }
723
742
 
724
- // packages/utils/src/lib/report.ts
743
+ // packages/utils/src/lib/reports/constants.ts
744
+ var NEW_LINE = "\n";
745
+ var SCORE_COLOR_RANGE = {
746
+ GREEN_MIN: 0.9,
747
+ YELLOW_MIN: 0.5
748
+ };
749
+
750
+ // packages/utils/src/lib/reports/utils.ts
725
751
  var FOOTER_PREFIX = "Made with \u2764 by";
726
752
  var CODE_PUSHUP_DOMAIN = "code-pushup.dev";
727
753
  var README_LINK = "https://github.com/flowup/quality-metrics-cli#readme";
@@ -1004,83 +1030,6 @@ function groupByStatus(results) {
1004
1030
  );
1005
1031
  }
1006
1032
 
1007
- // packages/utils/src/lib/md/details.ts
1008
- function details(title, content, cfg = { open: false }) {
1009
- return `<details${cfg.open ? " open" : ""}>
1010
- <summary>${title}</summary>
1011
- ${content}
1012
- </details>
1013
- `;
1014
- }
1015
-
1016
- // packages/utils/src/lib/md/headline.ts
1017
- function headline(text, hierarchy = 1) {
1018
- return `${new Array(hierarchy).fill("#").join("")} ${text}`;
1019
- }
1020
- function h2(text) {
1021
- return headline(text, 2);
1022
- }
1023
- function h3(text) {
1024
- return headline(text, 3);
1025
- }
1026
-
1027
- // packages/utils/src/lib/md/constants.ts
1028
- var NEW_LINE = "\n";
1029
-
1030
- // packages/utils/src/lib/md/table.ts
1031
- var alignString = /* @__PURE__ */ new Map([
1032
- ["l", ":--"],
1033
- ["c", ":--:"],
1034
- ["r", "--:"]
1035
- ]);
1036
- function tableMd(data, align) {
1037
- if (data.length === 0) {
1038
- throw new Error("Data can't be empty");
1039
- }
1040
- align = align || data[0]?.map(() => "c");
1041
- const _data = data.map((arr) => "|" + arr.join("|") + "|");
1042
- const secondRow = "|" + align?.map((s) => alignString.get(s)).join("|") + "|";
1043
- return _data.shift() + NEW_LINE + secondRow + NEW_LINE + _data.join(NEW_LINE);
1044
- }
1045
- function tableHtml(data) {
1046
- if (data.length === 0) {
1047
- throw new Error("Data can't be empty");
1048
- }
1049
- const _data = data.map((arr, index) => {
1050
- if (index === 0) {
1051
- return "<tr>" + arr.map((s) => `<th>${s}</th>`).join("") + "</tr>";
1052
- }
1053
- return "<tr>" + arr.map((s) => `<td>${s}</td>`).join("") + "</tr>";
1054
- });
1055
- return "<table>" + _data.join("") + "</table>";
1056
- }
1057
-
1058
- // packages/utils/src/lib/md/font-style.ts
1059
- var stylesMap = {
1060
- i: "_",
1061
- // italic
1062
- b: "**",
1063
- // bold
1064
- s: "~",
1065
- // strike through
1066
- c: "`"
1067
- // code
1068
- };
1069
- function style(text, styles = ["b"]) {
1070
- return styles.reduce((t, s) => `${stylesMap[s]}${t}${stylesMap[s]}`, text);
1071
- }
1072
-
1073
- // packages/utils/src/lib/md/link.ts
1074
- function link(href, text) {
1075
- return `[${text || href}](${href})`;
1076
- }
1077
-
1078
- // packages/utils/src/lib/md/list.ts
1079
- function li(text, order = "unordered") {
1080
- const style2 = order === "unordered" ? "-" : "- [ ]";
1081
- return `${style2} ${text}`;
1082
- }
1083
-
1084
1033
  // packages/utils/src/lib/progress.ts
1085
1034
  import chalk2 from "chalk";
1086
1035
  import { MultiProgressBars } from "multi-progress-bars";
@@ -1135,8 +1084,82 @@ function getProgressBar(taskName) {
1135
1084
  };
1136
1085
  }
1137
1086
 
1138
- // packages/utils/src/lib/report-to-md.ts
1139
- function reportToMd(report, commitData) {
1087
+ // packages/utils/src/lib/reports/md/details.ts
1088
+ function details(title, content, cfg = { open: false }) {
1089
+ return `<details${cfg.open ? " open" : ""}>
1090
+ <summary>${title}</summary>
1091
+ ${content}
1092
+ </details>
1093
+ `;
1094
+ }
1095
+
1096
+ // packages/utils/src/lib/reports/md/font-style.ts
1097
+ var stylesMap = {
1098
+ i: "_",
1099
+ // italic
1100
+ b: "**",
1101
+ // bold
1102
+ s: "~",
1103
+ // strike through
1104
+ c: "`"
1105
+ // code
1106
+ };
1107
+ function style(text, styles = ["b"]) {
1108
+ return styles.reduce((t, s) => `${stylesMap[s]}${t}${stylesMap[s]}`, text);
1109
+ }
1110
+
1111
+ // packages/utils/src/lib/reports/md/headline.ts
1112
+ function headline(text, hierarchy = 1) {
1113
+ return `${new Array(hierarchy).fill("#").join("")} ${text}`;
1114
+ }
1115
+ function h2(text) {
1116
+ return headline(text, 2);
1117
+ }
1118
+ function h3(text) {
1119
+ return headline(text, 3);
1120
+ }
1121
+
1122
+ // packages/utils/src/lib/reports/md/link.ts
1123
+ function link(href, text) {
1124
+ return `[${text || href}](${href})`;
1125
+ }
1126
+
1127
+ // packages/utils/src/lib/reports/md/list.ts
1128
+ function li(text, order = "unordered") {
1129
+ const style2 = order === "unordered" ? "-" : "- [ ]";
1130
+ return `${style2} ${text}`;
1131
+ }
1132
+
1133
+ // packages/utils/src/lib/reports/md/table.ts
1134
+ var alignString = /* @__PURE__ */ new Map([
1135
+ ["l", ":--"],
1136
+ ["c", ":--:"],
1137
+ ["r", "--:"]
1138
+ ]);
1139
+ function tableMd(data, align) {
1140
+ if (data.length === 0) {
1141
+ throw new Error("Data can't be empty");
1142
+ }
1143
+ align = align || data[0]?.map(() => "c");
1144
+ const _data = data.map((arr) => "|" + arr.join("|") + "|");
1145
+ const secondRow = "|" + align?.map((s) => alignString.get(s)).join("|") + "|";
1146
+ return _data.shift() + NEW_LINE + secondRow + NEW_LINE + _data.join(NEW_LINE);
1147
+ }
1148
+ function tableHtml(data) {
1149
+ if (data.length === 0) {
1150
+ throw new Error("Data can't be empty");
1151
+ }
1152
+ const _data = data.map((arr, index) => {
1153
+ if (index === 0) {
1154
+ return "<tr>" + arr.map((s) => `<th>${s}</th>`).join("") + "</tr>";
1155
+ }
1156
+ return "<tr>" + arr.map((s) => `<td>${s}</td>`).join("") + "</tr>";
1157
+ });
1158
+ return "<table>" + _data.join("") + "</table>";
1159
+ }
1160
+
1161
+ // packages/utils/src/lib/reports/generate-md-report.ts
1162
+ function generateMdReport(report, commitData) {
1140
1163
  let md = reportToHeaderSection() + NEW_LINE;
1141
1164
  md += reportToOverviewSection(report) + NEW_LINE + NEW_LINE;
1142
1165
  md += reportToCategoriesSection(report) + NEW_LINE + NEW_LINE;
@@ -1317,14 +1340,14 @@ function getAuditResult(audit, isHtml = false) {
1317
1340
  return isHtml ? `<b>${displayValue || value}</b>` : style(String(displayValue || value));
1318
1341
  }
1319
1342
 
1320
- // packages/utils/src/lib/report-to-stdout.ts
1343
+ // packages/utils/src/lib/reports/generate-stdout-summary.ts
1321
1344
  import cliui from "@isaacs/cliui";
1322
1345
  import chalk3 from "chalk";
1323
1346
  import Table from "cli-table3";
1324
1347
  function addLine(line = "") {
1325
1348
  return line + NEW_LINE;
1326
1349
  }
1327
- function reportToStdout(report) {
1350
+ function generateStdoutSummary(report) {
1328
1351
  let output = "";
1329
1352
  output += addLine(reportToHeaderSection2(report));
1330
1353
  output += addLine();
@@ -1481,7 +1504,7 @@ function toUnixPath(path, options) {
1481
1504
  return unixPath;
1482
1505
  }
1483
1506
 
1484
- // packages/utils/src/lib/scoring.ts
1507
+ // packages/utils/src/lib/reports/scoring.ts
1485
1508
  function calculateScore(refs, scoreFn) {
1486
1509
  const { numerator, denominator } = refs.reduce(
1487
1510
  (acc, ref) => {
@@ -1549,27 +1572,7 @@ function scoreReport(report) {
1549
1572
  return scoredReport;
1550
1573
  }
1551
1574
 
1552
- // packages/utils/src/lib/verbose-utils.ts
1553
- function getLogVerbose(verbose) {
1554
- return (...args) => {
1555
- if (verbose) {
1556
- console.info(...args);
1557
- }
1558
- };
1559
- }
1560
- function getExecVerbose(verbose) {
1561
- return (fn) => {
1562
- if (verbose) {
1563
- fn();
1564
- }
1565
- };
1566
- }
1567
- var verboseUtils = (verbose) => ({
1568
- log: getLogVerbose(verbose),
1569
- exec: getExecVerbose(verbose)
1570
- });
1571
-
1572
- // packages/utils/src/lib/sort-report.ts
1575
+ // packages/utils/src/lib/reports/sorting.ts
1573
1576
  function sortReport(report) {
1574
1577
  const { categories, plugins } = report;
1575
1578
  const sortedCategories = categories.map((category) => {
@@ -1618,10 +1621,29 @@ function sortReport(report) {
1618
1621
  plugins: sortedPlugins
1619
1622
  };
1620
1623
  }
1624
+
1625
+ // packages/utils/src/lib/verbose-utils.ts
1626
+ function getLogVerbose(verbose) {
1627
+ return (...args) => {
1628
+ if (verbose) {
1629
+ console.info(...args);
1630
+ }
1631
+ };
1632
+ }
1633
+ function getExecVerbose(verbose) {
1634
+ return (fn) => {
1635
+ if (verbose) {
1636
+ fn();
1637
+ }
1638
+ };
1639
+ }
1640
+ var verboseUtils = (verbose) => ({
1641
+ log: getLogVerbose(verbose),
1642
+ exec: getExecVerbose(verbose)
1643
+ });
1621
1644
  export {
1622
1645
  CODE_PUSHUP_DOMAIN,
1623
1646
  FOOTER_PREFIX,
1624
- NEW_LINE,
1625
1647
  ProcessError,
1626
1648
  README_LINK,
1627
1649
  calcDuration,
@@ -1636,6 +1658,8 @@ export {
1636
1658
  findLineNumberInText,
1637
1659
  formatBytes,
1638
1660
  formatDuration,
1661
+ generateMdReport,
1662
+ generateStdoutSummary,
1639
1663
  getLatestCommit,
1640
1664
  getProgressBar,
1641
1665
  git,
@@ -1654,8 +1678,6 @@ export {
1654
1678
  pluralizeToken,
1655
1679
  readJsonFile,
1656
1680
  readTextFile,
1657
- reportToMd,
1658
- reportToStdout,
1659
1681
  scoreReport,
1660
1682
  slugify,
1661
1683
  sortReport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/utils",
3
- "version": "0.8.10",
3
+ "version": "0.8.12",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "bundle-require": "^4.0.1",
package/src/index.d.ts CHANGED
@@ -5,12 +5,11 @@ export { getLatestCommit, git } from './lib/git';
5
5
  export { groupByStatus } from './lib/group-by-status';
6
6
  export { isPromiseFulfilledResult, isPromiseRejectedResult, } from './lib/guards';
7
7
  export { logMultipleResults } from './lib/log-results';
8
- export { NEW_LINE } from './lib/md';
9
8
  export { ProgressBar, getProgressBar } from './lib/progress';
10
- export { CODE_PUSHUP_DOMAIN, FOOTER_PREFIX, README_LINK, calcDuration, compareIssueSeverity, loadReport, } from './lib/report';
11
- export { reportToMd } from './lib/report-to-md';
12
- export { reportToStdout } from './lib/report-to-stdout';
13
- export { ScoredReport, scoreReport } from './lib/scoring';
9
+ export { generateMdReport } from './lib/reports/generate-md-report';
10
+ export { generateStdoutSummary } from './lib/reports/generate-stdout-summary';
11
+ export { ScoredReport, scoreReport } from './lib/reports/scoring';
12
+ export { sortReport } from './lib/reports/sorting';
13
+ export { CODE_PUSHUP_DOMAIN, FOOTER_PREFIX, README_LINK, calcDuration, compareIssueSeverity, loadReport, } from './lib/reports/utils';
14
14
  export { CliArgsObject, countOccurrences, distinct, factorOf, objectToCliArgs, objectToEntries, objectToKeys, toArray, toUnixPath, } from './lib/transform';
15
15
  export { verboseUtils } from './lib/verbose-utils';
16
- export { sortReport } from './lib/sort-report';
@@ -1,3 +1,4 @@
1
+ export declare const NEW_LINE = "\n";
1
2
  export declare const SCORE_COLOR_RANGE: {
2
3
  GREEN_MIN: number;
3
4
  YELLOW_MIN: number;
@@ -0,0 +1,3 @@
1
+ import { CommitData } from '../git';
2
+ import { ScoredReport } from './scoring';
3
+ export declare function generateMdReport(report: ScoredReport, commitData: CommitData | null): string;
@@ -0,0 +1,2 @@
1
+ import { ScoredReport } from './scoring';
2
+ export declare function generateStdoutSummary(report: ScoredReport): string;
@@ -1,7 +1,6 @@
1
1
  export * from './details';
2
- export * from './headline';
3
- export * from './table';
4
- export * from './constants';
5
2
  export * from './font-style';
3
+ export * from './headline';
6
4
  export * from './link';
7
5
  export * from './list';
6
+ export * from './table';
@@ -1 +0,0 @@
1
- export declare const NEW_LINE = "\n";
@@ -1,3 +0,0 @@
1
- import { CommitData } from './git';
2
- import { ScoredReport } from './scoring';
3
- export declare function reportToMd(report: ScoredReport, commitData: CommitData | null): string;
@@ -1,2 +0,0 @@
1
- import { ScoredReport } from './scoring';
2
- export declare function reportToStdout(report: ScoredReport): string;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes