@code-pushup/utils 0.53.0 → 0.53.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.
- package/index.js +7 -7
- package/package.json +23 -16
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var MAX_ISSUE_MESSAGE_LENGTH = 1024;
|
|
|
12
12
|
var slugRegex = /^[a-z\d]+(?:-[a-z\d]+)*$/;
|
|
13
13
|
var filenameRegex = /^(?!.*[ \\/:*?"<>|]).+$/;
|
|
14
14
|
function hasDuplicateStrings(strings) {
|
|
15
|
-
const sortedStrings =
|
|
15
|
+
const sortedStrings = strings.toSorted();
|
|
16
16
|
const duplStrings = sortedStrings.filter(
|
|
17
17
|
(item, index) => index !== 0 && item === sortedStrings[index - 1]
|
|
18
18
|
);
|
|
@@ -1873,7 +1873,7 @@ function getColumnAlignments(tableData) {
|
|
|
1873
1873
|
(_, idx) => getColumnAlignmentForIndex(idx, columns)
|
|
1874
1874
|
);
|
|
1875
1875
|
}
|
|
1876
|
-
const biggestRow =
|
|
1876
|
+
const biggestRow = rows.toSorted((a, b) => Object.keys(a).length - Object.keys(b).length).at(-1);
|
|
1877
1877
|
if (columns.length > 0) {
|
|
1878
1878
|
return columns.map(
|
|
1879
1879
|
(column, idx) => typeof column === "string" ? column : getColumnAlignmentForKeyAndIndex(
|
|
@@ -2083,7 +2083,7 @@ function getSortableGroupByRef({ plugin, slug, weight }, plugins) {
|
|
|
2083
2083
|
throwIsNotPresentError(`Group ${slug}`, groupPlugin.slug);
|
|
2084
2084
|
}
|
|
2085
2085
|
const sortedAudits = getSortedGroupAudits(group, groupPlugin.slug, plugins);
|
|
2086
|
-
const sortedAuditRefs =
|
|
2086
|
+
const sortedAuditRefs = group.refs.toSorted((a, b) => {
|
|
2087
2087
|
const aIndex = sortedAudits.findIndex((ref) => ref.slug === a.slug);
|
|
2088
2088
|
const bIndex = sortedAudits.findIndex((ref) => ref.slug === b.slug);
|
|
2089
2089
|
return aIndex - bIndex;
|
|
@@ -2112,7 +2112,7 @@ function sortReport(report) {
|
|
|
2112
2112
|
const sortedAuditsAndGroups = [...audits, ...groups].sort(
|
|
2113
2113
|
compareCategoryAuditsAndGroups
|
|
2114
2114
|
);
|
|
2115
|
-
const sortedRefs =
|
|
2115
|
+
const sortedRefs = category.refs.toSorted((a, b) => {
|
|
2116
2116
|
const aIndex = sortedAuditsAndGroups.findIndex(
|
|
2117
2117
|
(ref) => ref.slug === a.slug && ref.plugin === a.plugin
|
|
2118
2118
|
);
|
|
@@ -2132,12 +2132,12 @@ function sortReport(report) {
|
|
|
2132
2132
|
function sortPlugins(plugins) {
|
|
2133
2133
|
return plugins.map((plugin) => ({
|
|
2134
2134
|
...plugin,
|
|
2135
|
-
audits:
|
|
2135
|
+
audits: plugin.audits.toSorted(compareAudits).map(
|
|
2136
2136
|
(audit) => audit.details?.issues ? {
|
|
2137
2137
|
...audit,
|
|
2138
2138
|
details: {
|
|
2139
2139
|
...audit.details,
|
|
2140
|
-
issues:
|
|
2140
|
+
issues: audit.details.issues.toSorted(compareIssues)
|
|
2141
2141
|
}
|
|
2142
2142
|
} : audit
|
|
2143
2143
|
)
|
|
@@ -2414,7 +2414,7 @@ function formatPortalLink(portalUrl) {
|
|
|
2414
2414
|
return portalUrl && md5.link(portalUrl, "\u{1F575}\uFE0F See full comparison in Code PushUp portal \u{1F50D}");
|
|
2415
2415
|
}
|
|
2416
2416
|
function sortChanges(changes) {
|
|
2417
|
-
return
|
|
2417
|
+
return changes.toSorted(
|
|
2418
2418
|
(a, b) => Math.abs(b.scores.diff) - Math.abs(a.scores.diff) || Math.abs(b.values?.diff ?? 0) - Math.abs(a.values?.diff ?? 0)
|
|
2419
2419
|
);
|
|
2420
2420
|
}
|
package/package.json
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/utils",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.1",
|
|
4
4
|
"description": "Low-level utilities (helper functions, etc.) used by Code PushUp CLI",
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"@code-pushup/models": "0.53.0",
|
|
7
|
-
"@isaacs/cliui": "^8.0.2",
|
|
8
|
-
"@poppinss/cliui": "^6.4.0",
|
|
9
|
-
"ansis": "^3.3.0",
|
|
10
|
-
"build-md": "^0.4.2",
|
|
11
|
-
"bundle-require": "^4.0.1",
|
|
12
|
-
"esbuild": "^0.19.2",
|
|
13
|
-
"multi-progress-bars": "^5.0.3",
|
|
14
|
-
"semver": "^7.6.0",
|
|
15
|
-
"simple-git": "^3.20.0"
|
|
16
|
-
},
|
|
17
5
|
"license": "MIT",
|
|
18
6
|
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/utils#readme",
|
|
19
7
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/code-pushup/cli/issues"
|
|
8
|
+
"url": "https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\"🧩%20utils\""
|
|
21
9
|
},
|
|
22
10
|
"repository": {
|
|
23
11
|
"type": "git",
|
|
24
12
|
"url": "git+https://github.com/code-pushup/cli.git",
|
|
25
13
|
"directory": "packages/utils"
|
|
26
14
|
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"CLI",
|
|
17
|
+
"Code PushUp",
|
|
18
|
+
"developer tools",
|
|
19
|
+
"helpers",
|
|
20
|
+
"utils"
|
|
21
|
+
],
|
|
27
22
|
"publishConfig": {
|
|
28
23
|
"access": "public"
|
|
29
24
|
},
|
|
30
25
|
"type": "module",
|
|
31
26
|
"main": "./index.js",
|
|
32
|
-
"types": "./src/index.d.ts"
|
|
33
|
-
|
|
27
|
+
"types": "./src/index.d.ts",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@code-pushup/models": "0.53.1",
|
|
30
|
+
"@isaacs/cliui": "^8.0.2",
|
|
31
|
+
"@poppinss/cliui": "^6.4.0",
|
|
32
|
+
"ansis": "^3.3.0",
|
|
33
|
+
"build-md": "^0.4.2",
|
|
34
|
+
"bundle-require": "^4.0.1",
|
|
35
|
+
"esbuild": "^0.19.2",
|
|
36
|
+
"multi-progress-bars": "^5.0.3",
|
|
37
|
+
"semver": "^7.6.0",
|
|
38
|
+
"simple-git": "^3.20.0"
|
|
39
|
+
}
|
|
40
|
+
}
|