@code-pushup/cli 0.6.5 → 0.6.6

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
@@ -672,20 +672,18 @@ function logMultipleFileResults(fileResults, messagePrefix) {
672
672
  }
673
673
  var NoExportError = class extends Error {
674
674
  constructor(filepath) {
675
- super(`No export found in ${filepath}`);
675
+ super(`No default export found in ${filepath}`);
676
676
  }
677
677
  };
678
- async function importEsmModule(options2, parse) {
679
- parse = parse || ((v) => v);
680
- options2 = {
678
+ async function importEsmModule(options2) {
679
+ const { mod } = await bundleRequire({
681
680
  format: "esm",
682
681
  ...options2
683
- };
684
- const { mod } = await bundleRequire(options2);
685
- if (mod.default === void 0) {
682
+ });
683
+ if (!("default" in mod)) {
686
684
  throw new NoExportError(options2.filepath);
687
685
  }
688
- return parse(mod.default);
686
+ return mod.default;
689
687
  }
690
688
 
691
689
  // packages/utils/src/lib/report.ts
@@ -1290,29 +1288,6 @@ function reportToHeaderSection2(report) {
1290
1288
  const { packageName, version: version2 } = report;
1291
1289
  return `${chalk3.bold(reportHeadlineText)} - ${packageName}@${version2}`;
1292
1290
  }
1293
- function reportToOverviewSection2({
1294
- categories,
1295
- plugins
1296
- }) {
1297
- let output = addLine(chalk3.magentaBright.bold("Categories"));
1298
- output += addLine();
1299
- const table = new Table({
1300
- head: reportRawOverviewTableHeaders,
1301
- colAligns: ["left", "right", "right"],
1302
- style: {
1303
- head: ["cyan"]
1304
- }
1305
- });
1306
- table.push(
1307
- ...categories.map(({ title, score, refs }) => [
1308
- title,
1309
- withColor({ score }),
1310
- countCategoryAudits(refs, plugins)
1311
- ])
1312
- );
1313
- output += addLine(table.toString());
1314
- return output;
1315
- }
1316
1291
  function reportToDetailSection(report) {
1317
1292
  const { plugins } = report;
1318
1293
  let output = "";
@@ -1344,6 +1319,29 @@ function reportToDetailSection(report) {
1344
1319
  });
1345
1320
  return output;
1346
1321
  }
1322
+ function reportToOverviewSection2({
1323
+ categories,
1324
+ plugins
1325
+ }) {
1326
+ let output = addLine(chalk3.magentaBright.bold("Categories"));
1327
+ output += addLine();
1328
+ const table = new Table({
1329
+ head: reportRawOverviewTableHeaders,
1330
+ colAligns: ["left", "right", "right"],
1331
+ style: {
1332
+ head: ["cyan"]
1333
+ }
1334
+ });
1335
+ table.push(
1336
+ ...categories.map(({ title, score, refs }) => [
1337
+ title,
1338
+ withColor({ score }),
1339
+ countCategoryAudits(refs, plugins)
1340
+ ])
1341
+ );
1342
+ output += addLine(table.toString());
1343
+ return output;
1344
+ }
1347
1345
  function withColor({ score, text }) {
1348
1346
  const formattedScore = text ?? formatReportScore(score);
1349
1347
  const style2 = text ? chalk3 : chalk3.bold;
@@ -1633,7 +1631,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1633
1631
 
1634
1632
  // packages/core/package.json
1635
1633
  var name = "@code-pushup/core";
1636
- var version = "0.6.5";
1634
+ var version = "0.6.6";
1637
1635
 
1638
1636
  // packages/core/src/lib/implementation/collect.ts
1639
1637
  async function collect(options2) {
@@ -1782,18 +1780,10 @@ var ConfigPathError = class extends Error {
1782
1780
  }
1783
1781
  };
1784
1782
  async function readCodePushupConfig(filepath) {
1785
- if (!filepath.length) {
1786
- throw new Error("The configuration path is empty.");
1787
- }
1788
1783
  if (!await fileExists(filepath)) {
1789
1784
  throw new ConfigPathError(filepath);
1790
1785
  }
1791
- return importEsmModule(
1792
- {
1793
- filepath
1794
- },
1795
- (d) => coreConfigSchema.parse(d)
1796
- );
1786
+ return coreConfigSchema.parse(await importEsmModule({ filepath }));
1797
1787
  }
1798
1788
 
1799
1789
  // packages/cli/src/lib/implementation/only-plugins-options.ts
@@ -1803,6 +1793,11 @@ var onlyPluginsOption = {
1803
1793
  default: [],
1804
1794
  coerce: (arg) => arg.flatMap((v) => v.split(","))
1805
1795
  };
1796
+ function yargsOnlyPluginsOptionsDefinition() {
1797
+ return {
1798
+ onlyPlugins: onlyPluginsOption
1799
+ };
1800
+ }
1806
1801
 
1807
1802
  // packages/cli/src/lib/autorun/autorun-command.ts
1808
1803
  function yargsAutorunCommandObject() {
@@ -1810,9 +1805,7 @@ function yargsAutorunCommandObject() {
1810
1805
  return {
1811
1806
  command,
1812
1807
  describe: "Shortcut for running collect followed by upload",
1813
- builder: {
1814
- onlyPlugins: onlyPluginsOption
1815
- },
1808
+ builder: yargsOnlyPluginsOptionsDefinition(),
1816
1809
  handler: async (args) => {
1817
1810
  console.info(chalk5.bold(CLI_NAME));
1818
1811
  console.info(chalk5.gray(`Run ${command}...`));
@@ -1843,9 +1836,7 @@ function yargsCollectCommandObject() {
1843
1836
  return {
1844
1837
  command,
1845
1838
  describe: "Run Plugins and collect results",
1846
- builder: {
1847
- onlyPlugins: onlyPluginsOption
1848
- },
1839
+ builder: yargsOnlyPluginsOptionsDefinition(),
1849
1840
  handler: async (args) => {
1850
1841
  const options2 = args;
1851
1842
  console.info(chalk6.bold(CLI_NAME));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "bin": {
5
5
  "code-pushup": "index.js"
6
6
  },
@@ -2,8 +2,6 @@ import { ArgumentsCamelCase } from 'yargs';
2
2
  export declare function yargsAutorunCommandObject(): {
3
3
  command: string;
4
4
  describe: string;
5
- builder: {
6
- onlyPlugins: import("yargs").Options;
7
- };
5
+ builder: Record<"onlyPlugins", import("yargs").Options>;
8
6
  handler: <T>(args: ArgumentsCamelCase<T>) => Promise<void>;
9
7
  };