@code-pushup/cli 0.5.3 → 0.5.4
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
|
@@ -1384,6 +1384,9 @@ function withColor({ score, text }) {
|
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
1386
|
// packages/utils/src/lib/transformation.ts
|
|
1387
|
+
function toArray(val) {
|
|
1388
|
+
return Array.isArray(val) ? val : [val];
|
|
1389
|
+
}
|
|
1387
1390
|
function deepClone(obj) {
|
|
1388
1391
|
if (obj == null || typeof obj !== "object") {
|
|
1389
1392
|
return obj;
|
|
@@ -1657,7 +1660,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1657
1660
|
|
|
1658
1661
|
// packages/core/package.json
|
|
1659
1662
|
var name = "@code-pushup/core";
|
|
1660
|
-
var version = "0.5.
|
|
1663
|
+
var version = "0.5.4";
|
|
1661
1664
|
|
|
1662
1665
|
// packages/core/src/lib/implementation/collect.ts
|
|
1663
1666
|
async function collect(options2) {
|
|
@@ -1952,14 +1955,17 @@ function filterPluginsByOnlyPluginsOption(plugins, { onlyPlugins }) {
|
|
|
1952
1955
|
}
|
|
1953
1956
|
return plugins.filter((plugin) => onlyPlugins.includes(plugin.slug));
|
|
1954
1957
|
}
|
|
1955
|
-
function filterCategoryByOnlyPluginsOption(categories, {
|
|
1958
|
+
function filterCategoryByOnlyPluginsOption(categories, {
|
|
1959
|
+
onlyPlugins,
|
|
1960
|
+
verbose = false
|
|
1961
|
+
}) {
|
|
1956
1962
|
if (!onlyPlugins?.length) {
|
|
1957
1963
|
return categories;
|
|
1958
1964
|
}
|
|
1959
1965
|
return categories.filter(
|
|
1960
1966
|
(category) => category.refs.every((ref) => {
|
|
1961
1967
|
const isNotSkipped = onlyPlugins.includes(ref.slug);
|
|
1962
|
-
if (!isNotSkipped) {
|
|
1968
|
+
if (!isNotSkipped && verbose) {
|
|
1963
1969
|
console.info(
|
|
1964
1970
|
`${chalk8.yellow("\u26A0")} Category "${category.title}" is ignored because it references audits from skipped plugin "${ref.slug}"`
|
|
1965
1971
|
);
|
|
@@ -1968,9 +1974,12 @@ function filterCategoryByOnlyPluginsOption(categories, { onlyPlugins }) {
|
|
|
1968
1974
|
})
|
|
1969
1975
|
);
|
|
1970
1976
|
}
|
|
1971
|
-
function validateOnlyPluginsOption(plugins, {
|
|
1977
|
+
function validateOnlyPluginsOption(plugins, {
|
|
1978
|
+
onlyPlugins,
|
|
1979
|
+
verbose = false
|
|
1980
|
+
}) {
|
|
1972
1981
|
const missingPlugins = onlyPlugins?.length ? onlyPlugins.filter((plugin) => !plugins.some(({ slug }) => slug === plugin)) : [];
|
|
1973
|
-
if (missingPlugins.length > 0) {
|
|
1982
|
+
if (missingPlugins.length > 0 && verbose) {
|
|
1974
1983
|
console.warn(
|
|
1975
1984
|
`${chalk8.yellow(
|
|
1976
1985
|
"\u26A0"
|
|
@@ -1981,6 +1990,24 @@ function validateOnlyPluginsOption(plugins, { onlyPlugins }) {
|
|
|
1981
1990
|
}
|
|
1982
1991
|
}
|
|
1983
1992
|
|
|
1993
|
+
// packages/cli/src/lib/implementation/utils.ts
|
|
1994
|
+
function logErrorBeforeThrow(fn) {
|
|
1995
|
+
return async (...args) => {
|
|
1996
|
+
try {
|
|
1997
|
+
return await fn(...args);
|
|
1998
|
+
} catch (err) {
|
|
1999
|
+
console.error(err);
|
|
2000
|
+
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
2001
|
+
throw err;
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
function coerceArray(param = []) {
|
|
2006
|
+
return [
|
|
2007
|
+
...new Set(toArray(param).flatMap((f) => f.split(",")) || [])
|
|
2008
|
+
];
|
|
2009
|
+
}
|
|
2010
|
+
|
|
1984
2011
|
// packages/cli/src/lib/implementation/config-middleware.ts
|
|
1985
2012
|
async function configMiddleware(processArgs) {
|
|
1986
2013
|
const args = processArgs;
|
|
@@ -2001,7 +2028,9 @@ async function configMiddleware(processArgs) {
|
|
|
2001
2028
|
persist: {
|
|
2002
2029
|
outputDir: cliOptions?.persist?.outputDir || importedRc?.persist?.outputDir || PERSIST_OUTPUT_DIR,
|
|
2003
2030
|
filename: cliOptions?.persist?.filename || importedRc?.persist?.filename || PERSIST_FILENAME,
|
|
2004
|
-
format:
|
|
2031
|
+
format: coerceArray(
|
|
2032
|
+
cliOptions?.persist?.format || importedRc?.persist?.format || PERSIST_FORMAT
|
|
2033
|
+
)
|
|
2005
2034
|
},
|
|
2006
2035
|
plugins: filterPluginsByOnlyPluginsOption(importedRc.plugins, cliOptions),
|
|
2007
2036
|
categories: filterCategoryByOnlyPluginsOption(
|
|
@@ -2096,21 +2125,6 @@ var options = {
|
|
|
2096
2125
|
// packages/cli/src/lib/yargs-cli.ts
|
|
2097
2126
|
import chalk9 from "chalk";
|
|
2098
2127
|
import yargs from "yargs";
|
|
2099
|
-
|
|
2100
|
-
// packages/cli/src/lib/implementation/utils.ts
|
|
2101
|
-
function logErrorBeforeThrow(fn) {
|
|
2102
|
-
return async (...args) => {
|
|
2103
|
-
try {
|
|
2104
|
-
return await fn(...args);
|
|
2105
|
-
} catch (err) {
|
|
2106
|
-
console.error(err);
|
|
2107
|
-
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
2108
|
-
throw err;
|
|
2109
|
-
}
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
// packages/cli/src/lib/yargs-cli.ts
|
|
2114
2128
|
function yargsCli(argv, cfg) {
|
|
2115
2129
|
const { usageMessage, scriptName, noExitProcess } = cfg;
|
|
2116
2130
|
let { commands: commands2, options: options2, middlewares: middlewares2 } = cfg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"bin": {
|
|
5
5
|
"code-pushup": "index.js"
|
|
6
6
|
},
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"@code-pushup/models": "*",
|
|
9
9
|
"@code-pushup/core": "*",
|
|
10
10
|
"yargs": "^17.7.2",
|
|
11
|
-
"chalk": "^5.3.0"
|
|
11
|
+
"chalk": "^5.3.0",
|
|
12
|
+
"@code-pushup/utils": "*"
|
|
12
13
|
},
|
|
13
14
|
"type": "module",
|
|
14
15
|
"main": "./index.js",
|
|
@@ -2,9 +2,11 @@ import { CoreConfig } from '@code-pushup/models';
|
|
|
2
2
|
export declare function filterPluginsByOnlyPluginsOption(plugins: CoreConfig['plugins'], { onlyPlugins }: {
|
|
3
3
|
onlyPlugins?: string[];
|
|
4
4
|
}): CoreConfig['plugins'];
|
|
5
|
-
export declare function filterCategoryByOnlyPluginsOption(categories: CoreConfig['categories'], { onlyPlugins }: {
|
|
5
|
+
export declare function filterCategoryByOnlyPluginsOption(categories: CoreConfig['categories'], { onlyPlugins, verbose, }: {
|
|
6
6
|
onlyPlugins?: string[];
|
|
7
|
+
verbose?: boolean;
|
|
7
8
|
}): CoreConfig['categories'];
|
|
8
|
-
export declare function validateOnlyPluginsOption(plugins: CoreConfig['plugins'], { onlyPlugins }: {
|
|
9
|
+
export declare function validateOnlyPluginsOption(plugins: CoreConfig['plugins'], { onlyPlugins, verbose, }: {
|
|
9
10
|
onlyPlugins?: string[];
|
|
11
|
+
verbose?: boolean;
|
|
10
12
|
}): void;
|
package/src/lib/options.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare const options: {
|
|
|
7
7
|
"upload.apiKey": import("yargs").Options;
|
|
8
8
|
"upload.server": import("yargs").Options;
|
|
9
9
|
progress: import("yargs").Options;
|
|
10
|
-
config: import("yargs").Options;
|
|
11
10
|
verbose: import("yargs").Options;
|
|
11
|
+
config: import("yargs").Options;
|
|
12
12
|
};
|