@code-pushup/cli 0.8.19 → 0.8.21
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
|
@@ -30,59 +30,48 @@ var MAX_DESCRIPTION_LENGTH = 65536;
|
|
|
30
30
|
var MAX_ISSUE_MESSAGE_LENGTH = 1024;
|
|
31
31
|
|
|
32
32
|
// packages/models/src/lib/implementation/utils.ts
|
|
33
|
-
var slugRegex = /^[a-
|
|
33
|
+
var slugRegex = /^[a-z\d]+(?:-[a-z\d]+)*$/;
|
|
34
34
|
var filenameRegex = /^(?!.*[ \\/:*?"<>|]).+$/;
|
|
35
35
|
function hasDuplicateStrings(strings) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
36
|
+
const sortedStrings = [...strings].sort();
|
|
37
|
+
const duplStrings = sortedStrings.filter(
|
|
38
|
+
(item, index) => index !== 0 && item === sortedStrings[index - 1]
|
|
39
39
|
);
|
|
40
|
-
return
|
|
40
|
+
return duplStrings.length === 0 ? false : [...new Set(duplStrings)];
|
|
41
41
|
}
|
|
42
42
|
function hasMissingStrings(toCheck, existing) {
|
|
43
43
|
const nonExisting = toCheck.filter((s) => !existing.includes(s));
|
|
44
44
|
return nonExisting.length === 0 ? false : nonExisting;
|
|
45
45
|
}
|
|
46
|
-
function errorItems(items, transform = (
|
|
47
|
-
|
|
48
|
-
return transform(paredItems);
|
|
46
|
+
function errorItems(items, transform = (itemArr) => itemArr.join(", ")) {
|
|
47
|
+
return transform(items || []);
|
|
49
48
|
}
|
|
50
49
|
function exists(value) {
|
|
51
50
|
return value != null;
|
|
52
51
|
}
|
|
53
52
|
function getMissingRefsForCategories(categories, plugins) {
|
|
54
|
-
const missingRefs = [];
|
|
55
53
|
const auditRefsFromCategory = categories.flatMap(
|
|
56
54
|
({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
|
|
57
55
|
);
|
|
58
56
|
const auditRefsFromPlugins = plugins.flatMap(
|
|
59
|
-
({ audits, slug: pluginSlug }) => {
|
|
60
|
-
return audits.map(({ slug }) => `${pluginSlug}/${slug}`);
|
|
61
|
-
}
|
|
57
|
+
({ audits, slug: pluginSlug }) => audits.map(({ slug }) => `${pluginSlug}/${slug}`)
|
|
62
58
|
);
|
|
63
59
|
const missingAuditRefs = hasMissingStrings(
|
|
64
60
|
auditRefsFromCategory,
|
|
65
61
|
auditRefsFromPlugins
|
|
66
62
|
);
|
|
67
|
-
if (Array.isArray(missingAuditRefs) && missingAuditRefs.length > 0) {
|
|
68
|
-
missingRefs.push(...missingAuditRefs);
|
|
69
|
-
}
|
|
70
63
|
const groupRefsFromCategory = categories.flatMap(
|
|
71
64
|
({ refs }) => refs.filter(({ type }) => type === "group").map(({ plugin, slug }) => `${plugin}#${slug} (group)`)
|
|
72
65
|
);
|
|
73
66
|
const groupRefsFromPlugins = plugins.flatMap(
|
|
74
|
-
({ groups, slug: pluginSlug }) => {
|
|
75
|
-
return Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : [];
|
|
76
|
-
}
|
|
67
|
+
({ groups, slug: pluginSlug }) => Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : []
|
|
77
68
|
);
|
|
78
69
|
const missingGroupRefs = hasMissingStrings(
|
|
79
70
|
groupRefsFromCategory,
|
|
80
71
|
groupRefsFromPlugins
|
|
81
72
|
);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
return missingRefs.length ? missingRefs : false;
|
|
73
|
+
const missingRefs = [missingAuditRefs, missingGroupRefs].filter((refs) => Array.isArray(refs) && refs.length > 0).flat();
|
|
74
|
+
return missingRefs.length > 0 ? missingRefs : false;
|
|
86
75
|
}
|
|
87
76
|
function missingRefsForCategoriesErrorMsg(categories, plugins) {
|
|
88
77
|
const missingRefs = getMissingRefsForCategories(categories, plugins);
|
|
@@ -126,7 +115,7 @@ function metaSchema(options2) {
|
|
|
126
115
|
titleDescription,
|
|
127
116
|
docsUrlDescription,
|
|
128
117
|
description
|
|
129
|
-
} = options2
|
|
118
|
+
} = options2 ?? {};
|
|
130
119
|
return z.object(
|
|
131
120
|
{
|
|
132
121
|
title: titleSchema(titleDescription),
|
|
@@ -1725,7 +1714,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1725
1714
|
|
|
1726
1715
|
// packages/core/package.json
|
|
1727
1716
|
var name = "@code-pushup/core";
|
|
1728
|
-
var version = "0.8.
|
|
1717
|
+
var version = "0.8.21";
|
|
1729
1718
|
|
|
1730
1719
|
// packages/core/src/lib/implementation/collect.ts
|
|
1731
1720
|
async function collect(options2) {
|
|
@@ -2059,13 +2048,13 @@ async function coreConfigMiddleware(processArgs) {
|
|
|
2059
2048
|
|
|
2060
2049
|
// packages/cli/src/lib/implementation/only-plugins.utils.ts
|
|
2061
2050
|
import chalk8 from "chalk";
|
|
2062
|
-
function
|
|
2051
|
+
function filterPluginsBySlug(plugins, { onlyPlugins }) {
|
|
2063
2052
|
if (!onlyPlugins?.length) {
|
|
2064
2053
|
return plugins;
|
|
2065
2054
|
}
|
|
2066
2055
|
return plugins.filter((plugin) => onlyPlugins.includes(plugin.slug));
|
|
2067
2056
|
}
|
|
2068
|
-
function
|
|
2057
|
+
function filterCategoryByPluginSlug(categories, {
|
|
2069
2058
|
onlyPlugins,
|
|
2070
2059
|
verbose = false
|
|
2071
2060
|
}) {
|
|
@@ -2107,11 +2096,8 @@ function onlyPluginsMiddleware(processArgs) {
|
|
|
2107
2096
|
validateOnlyPluginsOption(cliOptions.plugins, cliOptions);
|
|
2108
2097
|
const parsedProcessArgs = {
|
|
2109
2098
|
...cliOptions,
|
|
2110
|
-
plugins:
|
|
2111
|
-
categories:
|
|
2112
|
-
cliOptions.categories,
|
|
2113
|
-
cliOptions
|
|
2114
|
-
)
|
|
2099
|
+
plugins: filterPluginsBySlug(cliOptions.plugins, cliOptions),
|
|
2100
|
+
categories: filterCategoryByPluginSlug(cliOptions.categories, cliOptions)
|
|
2115
2101
|
};
|
|
2116
2102
|
return parsedProcessArgs;
|
|
2117
2103
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CoreConfig } from '@code-pushup/models';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function filterPluginsBySlug(plugins: CoreConfig['plugins'], { onlyPlugins }: {
|
|
3
3
|
onlyPlugins?: string[];
|
|
4
4
|
}): CoreConfig['plugins'];
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function filterCategoryByPluginSlug(categories: CoreConfig['categories'], { onlyPlugins, verbose, }: {
|
|
6
6
|
onlyPlugins?: string[];
|
|
7
7
|
verbose?: boolean;
|
|
8
8
|
}): CoreConfig['categories'];
|