@code-pushup/cli 0.42.1 → 0.44.1

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 +36 -9
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -2570,7 +2570,7 @@ var verboseUtils = (verbose = false) => ({
2570
2570
 
2571
2571
  // packages/core/package.json
2572
2572
  var name = "@code-pushup/core";
2573
- var version = "0.42.1";
2573
+ var version = "0.44.1";
2574
2574
 
2575
2575
  // packages/core/src/lib/implementation/execute-plugin.ts
2576
2576
  import chalk5 from "chalk";
@@ -3024,7 +3024,8 @@ import {
3024
3024
  import {
3025
3025
  CategoryConfigRefType as PortalCategoryRefType,
3026
3026
  IssueSeverity as PortalIssueSeverity,
3027
- IssueSourceType as PortalIssueSourceType
3027
+ IssueSourceType as PortalIssueSourceType,
3028
+ TableAlignment as PortalTableAlignment
3028
3029
  } from "@code-pushup/portal-client";
3029
3030
  function reportToGQL(report) {
3030
3031
  return {
@@ -3070,10 +3071,7 @@ function auditToGQL(audit) {
3070
3071
  displayValue: formattedValue,
3071
3072
  details: details4
3072
3073
  } = audit;
3073
- const {
3074
- issues
3075
- /*, table */
3076
- } = details4 ?? {};
3074
+ const { issues, table: table5 } = details4 ?? {};
3077
3075
  return {
3078
3076
  slug,
3079
3077
  title,
@@ -3084,9 +3082,8 @@ function auditToGQL(audit) {
3084
3082
  formattedValue,
3085
3083
  ...details4 && {
3086
3084
  details: {
3087
- ...issues && { issues: issues.map(issueToGQL) }
3088
- // @TODO add when https://github.com/code-pushup/cli/issues/530 is implemented
3089
- // ...(table ? {table} : {}),
3085
+ ...issues && { issues: issues.map(issueToGQL) },
3086
+ ...table5 && { tables: [tableToGQL(table5)] }
3090
3087
  }
3091
3088
  }
3092
3089
  };
@@ -3105,6 +3102,26 @@ function issueToGQL(issue) {
3105
3102
  }
3106
3103
  };
3107
3104
  }
3105
+ function tableToGQL(table5) {
3106
+ return {
3107
+ ...table5.title && { title: table5.title },
3108
+ ...table5.columns?.length && {
3109
+ columns: table5.columns.map(
3110
+ (column) => typeof column === "string" ? { alignment: tableAlignmentToGQL(column) } : {
3111
+ key: column.key,
3112
+ label: column.label,
3113
+ alignment: column.align && tableAlignmentToGQL(column.align)
3114
+ }
3115
+ )
3116
+ },
3117
+ rows: table5.rows.map(
3118
+ (row) => Array.isArray(row) ? row.map((content) => ({ content: content.toString() })) : Object.entries(row).map(([key, content]) => ({
3119
+ key,
3120
+ content: content.toString()
3121
+ }))
3122
+ )
3123
+ };
3124
+ }
3108
3125
  function categoryToGQL(category) {
3109
3126
  return {
3110
3127
  slug: category.slug,
@@ -3137,6 +3154,16 @@ function issueSeverityToGQL(severity) {
3137
3154
  return PortalIssueSeverity.Warning;
3138
3155
  }
3139
3156
  }
3157
+ function tableAlignmentToGQL(alignment) {
3158
+ switch (alignment) {
3159
+ case "left":
3160
+ return PortalTableAlignment.Left;
3161
+ case "center":
3162
+ return PortalTableAlignment.Center;
3163
+ case "right":
3164
+ return PortalTableAlignment.Right;
3165
+ }
3166
+ }
3140
3167
 
3141
3168
  // packages/core/src/lib/upload.ts
3142
3169
  async function upload(options2, uploadFn = uploadToPortal) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.42.1",
3
+ "version": "0.44.1",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "code-pushup": "index.js"
7
7
  },
8
8
  "dependencies": {
9
- "@code-pushup/models": "0.42.1",
10
- "@code-pushup/core": "0.42.1",
11
- "@code-pushup/utils": "0.42.1",
9
+ "@code-pushup/models": "0.44.1",
10
+ "@code-pushup/core": "0.44.1",
11
+ "@code-pushup/utils": "0.44.1",
12
12
  "yargs": "^17.7.2",
13
13
  "chalk": "^5.3.0",
14
14
  "simple-git": "^3.20.0"