@code-pushup/cli 0.16.6 → 0.16.7
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 +68 -49
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1564,7 +1564,7 @@ function link2(text) {
|
|
|
1564
1564
|
|
|
1565
1565
|
// packages/core/package.json
|
|
1566
1566
|
var name = "@code-pushup/core";
|
|
1567
|
-
var version = "0.16.
|
|
1567
|
+
var version = "0.16.7";
|
|
1568
1568
|
|
|
1569
1569
|
// packages/core/src/lib/implementation/execute-plugin.ts
|
|
1570
1570
|
import chalk5 from "chalk";
|
|
@@ -1814,84 +1814,103 @@ async function autoloadRc() {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
|
|
1816
1816
|
// packages/core/src/lib/upload.ts
|
|
1817
|
-
import {
|
|
1817
|
+
import {
|
|
1818
|
+
uploadToPortal
|
|
1819
|
+
} from "@code-pushup/portal-client";
|
|
1818
1820
|
|
|
1819
|
-
// packages/core/src/lib/implementation/
|
|
1821
|
+
// packages/core/src/lib/implementation/report-to-gql.ts
|
|
1820
1822
|
import {
|
|
1821
|
-
CategoryConfigRefType,
|
|
1822
|
-
|
|
1823
|
-
|
|
1823
|
+
CategoryConfigRefType as PortalCategoryRefType,
|
|
1824
|
+
IssueSeverity as PortalIssueSeverity,
|
|
1825
|
+
IssueSourceType as PortalIssueSourceType
|
|
1824
1826
|
} from "@code-pushup/portal-client";
|
|
1825
|
-
function
|
|
1827
|
+
function reportToGQL(report) {
|
|
1826
1828
|
return {
|
|
1827
1829
|
packageName: report.packageName,
|
|
1828
1830
|
packageVersion: report.version,
|
|
1829
1831
|
commandStartDate: report.date,
|
|
1830
1832
|
commandDuration: report.duration,
|
|
1831
|
-
plugins:
|
|
1832
|
-
categories:
|
|
1833
|
+
plugins: report.plugins.map(pluginToGQL),
|
|
1834
|
+
categories: report.categories.map(categoryToGQL)
|
|
1833
1835
|
};
|
|
1834
1836
|
}
|
|
1835
|
-
function
|
|
1836
|
-
return
|
|
1837
|
-
audits: auditReportsToGql(plugin.audits),
|
|
1838
|
-
description: plugin.description,
|
|
1839
|
-
docsUrl: plugin.docsUrl,
|
|
1840
|
-
groups: plugin.groups?.map((group) => ({
|
|
1841
|
-
slug: group.slug,
|
|
1842
|
-
title: group.title,
|
|
1843
|
-
description: group.description,
|
|
1844
|
-
refs: group.refs.map((ref) => ({ slug: ref.slug, weight: ref.weight }))
|
|
1845
|
-
})),
|
|
1846
|
-
icon: plugin.icon,
|
|
1837
|
+
function pluginToGQL(plugin) {
|
|
1838
|
+
return {
|
|
1847
1839
|
slug: plugin.slug,
|
|
1848
1840
|
title: plugin.title,
|
|
1841
|
+
icon: plugin.icon,
|
|
1842
|
+
description: plugin.description,
|
|
1843
|
+
docsUrl: plugin.docsUrl,
|
|
1844
|
+
audits: plugin.audits.map(auditToGQL),
|
|
1845
|
+
groups: plugin.groups?.map(groupToGQL),
|
|
1849
1846
|
packageName: plugin.packageName,
|
|
1850
1847
|
packageVersion: plugin.version,
|
|
1851
1848
|
runnerDuration: plugin.duration,
|
|
1852
1849
|
runnerStartDate: plugin.date
|
|
1853
|
-
}
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
function groupToGQL(group) {
|
|
1853
|
+
return {
|
|
1854
|
+
slug: group.slug,
|
|
1855
|
+
title: group.title,
|
|
1856
|
+
description: group.description,
|
|
1857
|
+
refs: group.refs.map((ref) => ({ slug: ref.slug, weight: ref.weight }))
|
|
1858
|
+
};
|
|
1854
1859
|
}
|
|
1855
|
-
function
|
|
1856
|
-
return
|
|
1860
|
+
function auditToGQL(audit) {
|
|
1861
|
+
return {
|
|
1862
|
+
slug: audit.slug,
|
|
1863
|
+
title: audit.title,
|
|
1857
1864
|
description: audit.description,
|
|
1858
|
-
details: {
|
|
1859
|
-
issues: issuesToGql(audit.details?.issues)
|
|
1860
|
-
},
|
|
1861
1865
|
docsUrl: audit.docsUrl,
|
|
1862
|
-
formattedValue: audit.displayValue,
|
|
1863
1866
|
score: audit.score,
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1867
|
+
value: audit.value,
|
|
1868
|
+
formattedValue: audit.displayValue,
|
|
1869
|
+
...audit.details && {
|
|
1870
|
+
details: {
|
|
1871
|
+
...audit.details.issues && {
|
|
1872
|
+
issues: audit.details.issues.map(issueToGQL)
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1868
1877
|
}
|
|
1869
|
-
function
|
|
1870
|
-
return
|
|
1878
|
+
function issueToGQL(issue) {
|
|
1879
|
+
return {
|
|
1871
1880
|
message: issue.message,
|
|
1872
|
-
severity:
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1881
|
+
severity: issueSeverityToGQL(issue.severity),
|
|
1882
|
+
...issue.source?.file && {
|
|
1883
|
+
sourceType: PortalIssueSourceType.SourceCode,
|
|
1884
|
+
sourceFilePath: issue.source.file,
|
|
1885
|
+
sourceStartLine: issue.source.position?.startLine,
|
|
1886
|
+
sourceStartColumn: issue.source.position?.startColumn,
|
|
1887
|
+
sourceEndLine: issue.source.position?.endLine,
|
|
1888
|
+
sourceEndColumn: issue.source.position?.endColumn
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function categoryToGQL(category) {
|
|
1893
|
+
return {
|
|
1883
1894
|
slug: category.slug,
|
|
1884
1895
|
title: category.title,
|
|
1885
1896
|
description: category.description,
|
|
1886
1897
|
refs: category.refs.map((ref) => ({
|
|
1887
1898
|
plugin: ref.plugin,
|
|
1888
|
-
type: ref.type
|
|
1899
|
+
type: categoryRefTypeToGQL(ref.type),
|
|
1889
1900
|
weight: ref.weight,
|
|
1890
1901
|
slug: ref.slug
|
|
1891
1902
|
}))
|
|
1892
|
-
}
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
function categoryRefTypeToGQL(type) {
|
|
1906
|
+
switch (type) {
|
|
1907
|
+
case "audit":
|
|
1908
|
+
return PortalCategoryRefType.Audit;
|
|
1909
|
+
case "group":
|
|
1910
|
+
return PortalCategoryRefType.Group;
|
|
1911
|
+
}
|
|
1893
1912
|
}
|
|
1894
|
-
function
|
|
1913
|
+
function issueSeverityToGQL(severity) {
|
|
1895
1914
|
switch (severity) {
|
|
1896
1915
|
case "info":
|
|
1897
1916
|
return PortalIssueSeverity.Info;
|
|
@@ -1921,7 +1940,7 @@ async function upload(options2, uploadFn = uploadToPortal) {
|
|
|
1921
1940
|
organization,
|
|
1922
1941
|
project,
|
|
1923
1942
|
commit: commitData.hash,
|
|
1924
|
-
...
|
|
1943
|
+
...reportToGQL(report)
|
|
1925
1944
|
};
|
|
1926
1945
|
return uploadFn({ apiKey, server, data, timeout });
|
|
1927
1946
|
}
|