@code-pushup/cli 0.52.0 → 0.53.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.
- package/index.js +44 -31
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1608,25 +1608,30 @@ import {
|
|
|
1608
1608
|
} from "build-md";
|
|
1609
1609
|
import { posix as pathPosix } from "node:path";
|
|
1610
1610
|
|
|
1611
|
-
// packages/utils/src/lib/reports/
|
|
1611
|
+
// packages/utils/src/lib/reports/types.ts
|
|
1612
|
+
var SUPPORTED_ENVIRONMENTS = [
|
|
1613
|
+
"vscode",
|
|
1614
|
+
"github",
|
|
1615
|
+
"gitlab",
|
|
1616
|
+
"other"
|
|
1617
|
+
];
|
|
1618
|
+
|
|
1619
|
+
// packages/utils/src/lib/reports/environment-type.ts
|
|
1620
|
+
var environmentChecks = {
|
|
1621
|
+
vscode: () => process.env["TERM_PROGRAM"] === "vscode",
|
|
1622
|
+
github: () => process.env["GITHUB_ACTIONS"] === "true",
|
|
1623
|
+
gitlab: () => process.env["GITLAB_CI"] === "true",
|
|
1624
|
+
other: () => true
|
|
1625
|
+
};
|
|
1612
1626
|
function getEnvironmentType() {
|
|
1613
|
-
|
|
1614
|
-
return "vscode";
|
|
1615
|
-
}
|
|
1616
|
-
if (isGitHub()) {
|
|
1617
|
-
return "github";
|
|
1618
|
-
}
|
|
1619
|
-
return "other";
|
|
1620
|
-
}
|
|
1621
|
-
function isVSCode() {
|
|
1622
|
-
return process.env["TERM_PROGRAM"] === "vscode";
|
|
1623
|
-
}
|
|
1624
|
-
function isGitHub() {
|
|
1625
|
-
return process.env["GITHUB_ACTIONS"] === "true";
|
|
1627
|
+
return SUPPORTED_ENVIRONMENTS.find((env) => environmentChecks[env]()) ?? "other";
|
|
1626
1628
|
}
|
|
1627
1629
|
function getGitHubBaseUrl() {
|
|
1628
1630
|
return `${process.env["GITHUB_SERVER_URL"]}/${process.env["GITHUB_REPOSITORY"]}/blob/${process.env["GITHUB_SHA"]}`;
|
|
1629
1631
|
}
|
|
1632
|
+
function getGitLabBaseUrl() {
|
|
1633
|
+
return `${process.env["CI_SERVER_URL"]}/${process.env["CI_PROJECT_PATH"]}/-/blob/${process.env["CI_COMMIT_SHA"]}`;
|
|
1634
|
+
}
|
|
1630
1635
|
|
|
1631
1636
|
// packages/utils/src/lib/reports/formatting.ts
|
|
1632
1637
|
function tableSection(tableData, options2) {
|
|
@@ -1692,6 +1697,15 @@ function formatGitHubLink(file, position) {
|
|
|
1692
1697
|
const lineRange = end && start !== end ? `${start}-${end}` : start;
|
|
1693
1698
|
return `${baseUrl}/${file}#${lineRange}`;
|
|
1694
1699
|
}
|
|
1700
|
+
function formatGitLabLink(file, position) {
|
|
1701
|
+
const baseUrl = getGitLabBaseUrl();
|
|
1702
|
+
if (!position) {
|
|
1703
|
+
return `${baseUrl}/${file}`;
|
|
1704
|
+
}
|
|
1705
|
+
const { startLine, endLine } = position;
|
|
1706
|
+
const lineRange = endLine && startLine !== endLine ? `${startLine}-${endLine}` : startLine;
|
|
1707
|
+
return `${baseUrl}/${file}#L${lineRange}`;
|
|
1708
|
+
}
|
|
1695
1709
|
function formatFileLink(file, position, outputDir) {
|
|
1696
1710
|
const relativePath = pathPosix.relative(outputDir, file);
|
|
1697
1711
|
const env = getEnvironmentType();
|
|
@@ -1700,6 +1714,8 @@ function formatFileLink(file, position, outputDir) {
|
|
|
1700
1714
|
return position ? `${relativePath}#L${position.startLine}` : relativePath;
|
|
1701
1715
|
case "github":
|
|
1702
1716
|
return formatGitHubLink(file, position);
|
|
1717
|
+
case "gitlab":
|
|
1718
|
+
return formatGitLabLink(file, position);
|
|
1703
1719
|
default:
|
|
1704
1720
|
return relativePath;
|
|
1705
1721
|
}
|
|
@@ -2548,7 +2564,7 @@ var verboseUtils = (verbose = false) => ({
|
|
|
2548
2564
|
|
|
2549
2565
|
// packages/core/package.json
|
|
2550
2566
|
var name = "@code-pushup/core";
|
|
2551
|
-
var version = "0.
|
|
2567
|
+
var version = "0.53.0";
|
|
2552
2568
|
|
|
2553
2569
|
// packages/core/src/lib/implementation/execute-plugin.ts
|
|
2554
2570
|
import { bold as bold5 } from "ansis";
|
|
@@ -3047,12 +3063,6 @@ async function fetchPortalComparisonLink(uploadConfig, commits) {
|
|
|
3047
3063
|
}
|
|
3048
3064
|
|
|
3049
3065
|
// packages/core/src/lib/implementation/report-to-gql.ts
|
|
3050
|
-
import {
|
|
3051
|
-
CategoryConfigRefType as PortalCategoryRefType,
|
|
3052
|
-
IssueSeverity as PortalIssueSeverity,
|
|
3053
|
-
IssueSourceType as PortalIssueSourceType,
|
|
3054
|
-
TableAlignment as PortalTableAlignment
|
|
3055
|
-
} from "@code-pushup/portal-client";
|
|
3056
3066
|
function reportToGQL(report) {
|
|
3057
3067
|
return {
|
|
3058
3068
|
packageName: report.packageName,
|
|
@@ -3119,7 +3129,7 @@ function issueToGQL(issue) {
|
|
|
3119
3129
|
message: issue.message,
|
|
3120
3130
|
severity: issueSeverityToGQL(issue.severity),
|
|
3121
3131
|
...issue.source?.file && {
|
|
3122
|
-
sourceType:
|
|
3132
|
+
sourceType: safeEnum("SourceCode"),
|
|
3123
3133
|
sourceFilePath: issue.source.file,
|
|
3124
3134
|
sourceStartLine: issue.source.position?.startLine,
|
|
3125
3135
|
sourceStartColumn: issue.source.position?.startColumn,
|
|
@@ -3165,31 +3175,34 @@ function categoryToGQL(category) {
|
|
|
3165
3175
|
function categoryRefTypeToGQL(type) {
|
|
3166
3176
|
switch (type) {
|
|
3167
3177
|
case "audit":
|
|
3168
|
-
return
|
|
3178
|
+
return safeEnum("Audit");
|
|
3169
3179
|
case "group":
|
|
3170
|
-
return
|
|
3180
|
+
return safeEnum("Group");
|
|
3171
3181
|
}
|
|
3172
3182
|
}
|
|
3173
3183
|
function issueSeverityToGQL(severity) {
|
|
3174
3184
|
switch (severity) {
|
|
3175
3185
|
case "info":
|
|
3176
|
-
return
|
|
3186
|
+
return safeEnum("Info");
|
|
3177
3187
|
case "error":
|
|
3178
|
-
return
|
|
3188
|
+
return safeEnum("Error");
|
|
3179
3189
|
case "warning":
|
|
3180
|
-
return
|
|
3190
|
+
return safeEnum("Warning");
|
|
3181
3191
|
}
|
|
3182
3192
|
}
|
|
3183
3193
|
function tableAlignmentToGQL(alignment) {
|
|
3184
3194
|
switch (alignment) {
|
|
3185
3195
|
case "left":
|
|
3186
|
-
return
|
|
3196
|
+
return safeEnum("Left");
|
|
3187
3197
|
case "center":
|
|
3188
|
-
return
|
|
3198
|
+
return safeEnum("Center");
|
|
3189
3199
|
case "right":
|
|
3190
|
-
return
|
|
3200
|
+
return safeEnum("Right");
|
|
3191
3201
|
}
|
|
3192
3202
|
}
|
|
3203
|
+
function safeEnum(value) {
|
|
3204
|
+
return value;
|
|
3205
|
+
}
|
|
3193
3206
|
|
|
3194
3207
|
// packages/core/src/lib/upload.ts
|
|
3195
3208
|
async function upload(options2) {
|
|
@@ -4094,7 +4107,7 @@ import { blue, dim as dim2, green as green4 } from "ansis";
|
|
|
4094
4107
|
import yargs2 from "yargs";
|
|
4095
4108
|
|
|
4096
4109
|
// packages/cli/package.json
|
|
4097
|
-
var version2 = "0.
|
|
4110
|
+
var version2 = "0.53.0";
|
|
4098
4111
|
|
|
4099
4112
|
// packages/cli/src/lib/implementation/formatting.ts
|
|
4100
4113
|
import { bold as bold13, dim, green as green3 } from "ansis";
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A CLI to run all kinds of code quality measurements to align your team with company goals",
|
|
6
6
|
"bin": {
|
|
7
7
|
"code-pushup": "index.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@code-pushup/models": "0.
|
|
11
|
-
"@code-pushup/core": "0.
|
|
12
|
-
"@code-pushup/utils": "0.
|
|
10
|
+
"@code-pushup/models": "0.53.0",
|
|
11
|
+
"@code-pushup/core": "0.53.0",
|
|
12
|
+
"@code-pushup/utils": "0.53.0",
|
|
13
13
|
"yargs": "^17.7.2",
|
|
14
14
|
"ansis": "^3.3.0",
|
|
15
15
|
"simple-git": "^3.20.0"
|