/**
* @file bin/wpw-cli.js
* @copyright @spmhome @_2025
* @author Scott Meesseman @spmeesseman
*//** */
/**
* @type {ISpmhArgParserOptions}
*/
const cliOptions =
{
help: true,
version: true,
strict: false,
versionKind: "pretty"
};
/**
* @type {ISpmhArgParserMap}
*/
const cliArgMap =
{
analyze: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "-a", "--analyze" ],
{
help: "run bundle analyzer when build completes and open results using system default browser",
private: false
}
]),
analyzex: /** @type {SpmhArgParserStringDef} */([
true,
"string",
"",
[ "-ax", "--analyzex" ],
{
help: "run bundle analyzer when build completes and open results using specified path to browser executable",
private: false
}
]),
build: /** @type {SpmhArgParserStringDef} */([
true,
"string",
"",
[ "-b", "--build" ],
{
help: "Name of build to run, by default all defined builds in the wpwrc file are ran",
private: false
}
]),
clean: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "-c", "--clean" ],
{
help: "run bundle analyzer when build completes",
private: false
}
]),
examine: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "-e", "--examine" ],
{
help: "open source files that produced errors into the editor and scroll to " +
"the error location if possible when build completes",
private: false
}
]),
linebreaks: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "--linebreaks" ],
{
help: "add blank lines between the build results/stats of each build",
private: false
}
]),
logexec: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "--logexec" ],
{
help: "force logging of all output on stdout & stderr from external exec commands/scripts, " +
"regardless of the configured loglevel (logging of exec stdout/stderr is 'off' when " +
"configured loglevel is less than '3')",
private: false
}
]),
loglevel: /** @type {SpmhArgParserNumberDef} */([
true,
"number",
2,
[ "-l", "--loglevel" ],
{
help: "Logging level, possible values are 0-5",
private: false
}
]),
mode: /** @type {SpmhArgParserStringDef} */([
true,
"string",
"production",
[ "-m", "--mode" ],
{
help: "Webpack mode, i.e. \"production\", \"development\", or \"none\".",
private: false
}
]),
statsreset: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "--stats-reset" ],
{
help: "clear all persisted time elapsed stats and remove stats cache file @ node_modules/.cache/.wpwstats",
private: false
}
]),
statsresetfast: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "--stats-reset-fast" ],
{
help: "clear / reset fastest elapsed time stats for the active builds",
private: false
}
]),
statsresetslow: /** @type {SpmhArgParserBooleanDef} */([
true,
"boolean",
false,
[ "--stats-reset-slow" ],
{
help: "clear / reset slowest elapsed time stats for the active builds",
private: false
}
])
};
module.exports = { cliArgMap, cliOptions };