@code-pushup/cli 0.8.12 → 0.8.14
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 +30 -39
- package/package.json +1 -1
- package/src/lib/cli.d.ts +0 -2
- package/src/lib/constants.d.ts +2 -0
package/index.js
CHANGED
|
@@ -1713,7 +1713,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
|
|
|
1713
1713
|
|
|
1714
1714
|
// packages/core/package.json
|
|
1715
1715
|
var name = "@code-pushup/core";
|
|
1716
|
-
var version = "0.8.
|
|
1716
|
+
var version = "0.8.14";
|
|
1717
1717
|
|
|
1718
1718
|
// packages/core/src/lib/implementation/collect.ts
|
|
1719
1719
|
async function collect(options2) {
|
|
@@ -1868,6 +1868,10 @@ async function readCodePushupConfig(filepath) {
|
|
|
1868
1868
|
return coreConfigSchema.parse(await importEsmModule({ filepath }));
|
|
1869
1869
|
}
|
|
1870
1870
|
|
|
1871
|
+
// packages/cli/src/lib/constants.ts
|
|
1872
|
+
var CLI_NAME = "Code PushUp CLI";
|
|
1873
|
+
var CLI_SCRIPT_NAME = "code-pushup";
|
|
1874
|
+
|
|
1871
1875
|
// packages/cli/src/lib/implementation/only-plugins-options.ts
|
|
1872
1876
|
var onlyPluginsOption = {
|
|
1873
1877
|
describe: "List of plugins to run. If not set all plugins are run.",
|
|
@@ -1902,10 +1906,10 @@ function yargsAutorunCommandObject() {
|
|
|
1902
1906
|
}
|
|
1903
1907
|
};
|
|
1904
1908
|
await collectAndPersistReports(optionsWithFormat);
|
|
1905
|
-
if (
|
|
1906
|
-
console.warn("Upload skipped because configuration is not set.");
|
|
1907
|
-
} else {
|
|
1909
|
+
if (options2.upload) {
|
|
1908
1910
|
await upload(options2);
|
|
1911
|
+
} else {
|
|
1912
|
+
console.warn("Upload skipped because configuration is not set.");
|
|
1909
1913
|
}
|
|
1910
1914
|
}
|
|
1911
1915
|
};
|
|
@@ -1930,19 +1934,13 @@ function yargsCollectCommandObject() {
|
|
|
1930
1934
|
|
|
1931
1935
|
// packages/cli/src/lib/implementation/filter-kebab-case-keys.ts
|
|
1932
1936
|
function filterKebabCaseKeys(obj) {
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
}
|
|
1941
|
-
if (typeof obj[key] === "object" && !Array.isArray(obj[key]) && obj[key] != null) {
|
|
1942
|
-
newObj[key] = filterKebabCaseKeys(obj[key]);
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
return newObj;
|
|
1937
|
+
return Object.entries(obj).filter(([key]) => !key.includes("-")).reduce(
|
|
1938
|
+
(acc, [key, value]) => typeof value === "string" || typeof value === "object" && Array.isArray(obj[key]) ? { ...acc, [key]: value } : typeof value === "object" && !Array.isArray(value) && value != null ? {
|
|
1939
|
+
...acc,
|
|
1940
|
+
[key]: filterKebabCaseKeys(value)
|
|
1941
|
+
} : { ...acc, [key]: value },
|
|
1942
|
+
{}
|
|
1943
|
+
);
|
|
1946
1944
|
}
|
|
1947
1945
|
|
|
1948
1946
|
// packages/cli/src/lib/print-config/print-config-command.ts
|
|
@@ -2041,10 +2039,10 @@ function logErrorBeforeThrow(fn) {
|
|
|
2041
2039
|
return async (...args) => {
|
|
2042
2040
|
try {
|
|
2043
2041
|
return await fn(...args);
|
|
2044
|
-
} catch (
|
|
2045
|
-
console.error(
|
|
2042
|
+
} catch (error) {
|
|
2043
|
+
console.error(error);
|
|
2046
2044
|
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
2047
|
-
throw
|
|
2045
|
+
throw error;
|
|
2048
2046
|
}
|
|
2049
2047
|
};
|
|
2050
2048
|
}
|
|
@@ -2072,10 +2070,10 @@ async function configMiddleware(processArgs) {
|
|
|
2072
2070
|
// therefore this can't live in option defaults as the order would be `config`->`provided options`->default
|
|
2073
2071
|
// so we have to manually implement the order
|
|
2074
2072
|
persist: {
|
|
2075
|
-
outputDir: cliOptions
|
|
2076
|
-
filename: cliOptions
|
|
2073
|
+
outputDir: cliOptions.persist?.outputDir || importedRc.persist?.outputDir || PERSIST_OUTPUT_DIR,
|
|
2074
|
+
filename: cliOptions.persist?.filename || importedRc.persist?.filename || PERSIST_FILENAME,
|
|
2077
2075
|
format: coerceArray(
|
|
2078
|
-
cliOptions
|
|
2076
|
+
cliOptions.persist?.format ?? importedRc.persist?.format ?? PERSIST_FORMAT
|
|
2079
2077
|
)
|
|
2080
2078
|
},
|
|
2081
2079
|
plugins: filterPluginsByOnlyPluginsOption(importedRc.plugins, cliOptions),
|
|
@@ -2173,19 +2171,16 @@ import chalk9 from "chalk";
|
|
|
2173
2171
|
import yargs from "yargs";
|
|
2174
2172
|
function yargsCli(argv, cfg) {
|
|
2175
2173
|
const { usageMessage, scriptName, noExitProcess } = cfg;
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
options2 = options2 || {};
|
|
2174
|
+
const commands2 = cfg.commands ?? [];
|
|
2175
|
+
const middlewares2 = cfg.middlewares ?? [];
|
|
2176
|
+
const options2 = cfg.options ?? {};
|
|
2180
2177
|
const cli2 = yargs(argv);
|
|
2181
2178
|
cli2.help().version(false).alias("h", "help").parserConfiguration({
|
|
2182
2179
|
"strip-dashed": true
|
|
2183
|
-
}).array("persist.format").coerce(
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
return config;
|
|
2188
|
-
}).options(options2);
|
|
2180
|
+
}).array("persist.format").coerce(
|
|
2181
|
+
"config",
|
|
2182
|
+
(config) => Array.isArray(config) ? config.at(-1) : config
|
|
2183
|
+
).options(options2);
|
|
2189
2184
|
if (usageMessage) {
|
|
2190
2185
|
cli2.usage(chalk9.bold(usageMessage));
|
|
2191
2186
|
}
|
|
@@ -2201,9 +2196,7 @@ function yargsCli(argv, cfg) {
|
|
|
2201
2196
|
commands2.forEach((commandObj) => {
|
|
2202
2197
|
cli2.command({
|
|
2203
2198
|
...commandObj,
|
|
2204
|
-
|
|
2205
|
-
handler: logErrorBeforeThrow(commandObj.handler)
|
|
2206
|
-
},
|
|
2199
|
+
handler: logErrorBeforeThrow(commandObj.handler),
|
|
2207
2200
|
...typeof commandObj.builder === "function" && {
|
|
2208
2201
|
builder: logErrorBeforeThrow(commandObj.builder)
|
|
2209
2202
|
}
|
|
@@ -2216,8 +2209,6 @@ function yargsCli(argv, cfg) {
|
|
|
2216
2209
|
}
|
|
2217
2210
|
|
|
2218
2211
|
// packages/cli/src/lib/cli.ts
|
|
2219
|
-
var CLI_NAME = "Code PushUp CLI";
|
|
2220
|
-
var CLI_SCRIPT_NAME = "code-pushup";
|
|
2221
2212
|
var cli = (args) => yargsCli(args, {
|
|
2222
2213
|
usageMessage: CLI_NAME,
|
|
2223
2214
|
scriptName: CLI_SCRIPT_NAME,
|
|
@@ -2227,4 +2218,4 @@ var cli = (args) => yargsCli(args, {
|
|
|
2227
2218
|
});
|
|
2228
2219
|
|
|
2229
2220
|
// packages/cli/src/index.ts
|
|
2230
|
-
cli(hideBin(process.argv)).argv;
|
|
2221
|
+
await cli(hideBin(process.argv)).argv;
|
package/package.json
CHANGED
package/src/lib/cli.d.ts
CHANGED