From a81f1d4bf2b65bf7f8197086c292d2c13d38ff6b Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 8 Apr 2026 00:03:33 +0100 Subject: [PATCH 1/8] feat: add argument parsers and CLI builders to preferred manifest --- docs/modules/README.md | 2 ++ docs/modules/commander.md | 33 +++++++++++++++++++++ docs/modules/parseargs.md | 24 ++++++++++++++++ manifests/preferred.json | 60 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 docs/modules/commander.md create mode 100644 docs/modules/parseargs.md diff --git a/docs/modules/README.md b/docs/modules/README.md index 5c8dda38..d7615b20 100644 --- a/docs/modules/README.md +++ b/docs/modules/README.md @@ -24,6 +24,7 @@ ESLint plugin. - [`chalk`](./chalk.md) - [`clean-webpack-plugin`](./clean-webpack-plugin.md) - [`clipboardy`](./clipboardy.md) +- [`commander`](./commander.md) - [`collection-map`](./collection-map.md) - [`core-util-is`](./core-util-is.md) - [`cosmiconfig`](./cosmiconfig.md) @@ -77,6 +78,7 @@ ESLint plugin. - [`md5`](./md5.md) - [`mkdirp`](./mkdirp.md) - [`moment.js`](./moment.md) +- [`mri`](./parseargs.md) - [`npm-run-all`](./npm-run-all.md) - [`node-fetch`](./fetch.md) - [`node-telegram-bot-api`](./node-telegram-bot-api.md) diff --git a/docs/modules/commander.md b/docs/modules/commander.md new file mode 100644 index 00000000..9fe80805 --- /dev/null +++ b/docs/modules/commander.md @@ -0,0 +1,33 @@ +--- +description: Modern alternatives to packages for building CLI applications +--- + +# Replacements for CLI builders + +## `sade` + +[`sade`](https://github.com/lukeed/sade) is a small but powerful tool for building CLI applications for Node.js + +```ts +import sade from 'sade' + +const prog = sade('my-cli') + +prog + .version('1.0.5') + .option('--global, -g', 'An example global flag') + .option('-c, --config', 'Provide path to custom config', 'foo.config.js') + +prog + .command('build ') + .describe('Build the source directory. Expects an `index.js` entry file.') + .option('-o, --output', 'Change the name of the output file', 'bundle.js') + .example('build src build --global --config my-conf.js') + .example('build app public -o main.js') + .action((src, dest, opts) => { + console.log(`> building from ${src} to ${dest}`) + console.log('> these are extra opts', opts) + }) + +prog.parse(process.argv) +``` diff --git a/docs/modules/parseargs.md b/docs/modules/parseargs.md new file mode 100644 index 00000000..51b3479b --- /dev/null +++ b/docs/modules/parseargs.md @@ -0,0 +1,24 @@ +--- +description: Modern alternatives to packages for CLI argument parsing +--- + +# Replacements for argument parsers + +## `util.parseArgs` (native, since Node.js 16.17.0) + +[`util.parseArgs`](https://nodejs.org/api/util.html#utilparseargsconfig) can replace many common CLI parsing libraries such as `arg`, `minimist`, `mri`, `yargs-parser`. + +Example: + +```ts +import { parseArgs } from 'node:util' + +const { values, positionals } = parseArgs({ + args: process.argv.slice(2), + options: { + force: { type: 'boolean', short: 'f' }, + output: { type: 'string', short: 'o' } + }, + allowPositionals: true +}) +``` diff --git a/manifests/preferred.json b/manifests/preferred.json index c06ac716..64e235d9 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -24,6 +24,12 @@ "replacements": ["fetch", "ofetch", "ky"], "url": {"type": "e18e", "id": "fetch"} }, + "arg": { + "type": "module", + "moduleName": "arg", + "replacements": ["util.parseArgs"], + "url": {"type": "e18e", "id": "parseargs"} + }, "axios": { "type": "module", "moduleName": "axios", @@ -108,6 +114,12 @@ "replacements": ["util.styleText", "picocolors", "ansis"], "url": {"type": "e18e", "id": "chalk"} }, + "commander": { + "type": "module", + "moduleName": "commander", + "replacements": ["sade"], + "url": {"type": "e18e", "id": "commander"} + }, "copy-text-to-clipboard": { "type": "module", "moduleName": "copy-text-to-clipboard", @@ -348,6 +360,12 @@ "replacements": ["dlv", "object-path"], "url": {"type": "e18e", "id": "dot-prop"} }, + "getopts": { + "type": "module", + "moduleName": "getopts", + "replacements": ["util.parseArgs"], + "url": {"type": "e18e", "id": "parseargs"} + }, "glob": { "type": "module", "moduleName": "glob", @@ -2388,6 +2406,18 @@ "replacements": ["node:crypto"], "url": {"type": "e18e", "id": "md5"} }, + "meow": { + "type": "module", + "moduleName": "meow", + "replacements": ["sade"], + "url": {"type": "e18e", "id": "commander"} + }, + "minimist": { + "type": "module", + "moduleName": "minimist", + "replacements": ["util.parseArgs"], + "url": {"type": "e18e", "id": "parseargs"} + }, "mkdirp": { "type": "module", "moduleName": "mkdirp", @@ -2400,6 +2430,12 @@ "replacements": ["day.js", "date-fns", "luxon", "Date"], "url": {"type": "e18e", "id": "moment"} }, + "mri": { + "type": "module", + "moduleName": "mri", + "replacements": ["util.parseArgs"], + "url": {"type": "e18e", "id": "parseargs"} + }, "node-fetch": { "type": "module", "moduleName": "node-fetch", @@ -2713,6 +2749,18 @@ "moduleName": "xmldom", "replacements": ["@xmldom/xmldom"], "url": {"type": "e18e", "id": "xmldom"} + }, + "yargs": { + "type": "module", + "moduleName": "yargs", + "replacements": ["sade"], + "url": {"type": "e18e", "id": "commander"} + }, + "yargs-parser": { + "type": "module", + "moduleName": "yargs-parser", + "replacements": ["util.parseArgs"], + "url": {"type": "e18e", "id": "parseargs"} } }, "replacements": { @@ -3390,6 +3438,12 @@ "url": {"type": "e18e", "id": "source-map-explorer"}, "replacementModule": "rollup-plugin-visualizer" }, + "sade": { + "id": "sade", + "type": "documented", + "url": {"type": "e18e", "id": "commander"}, + "replacementModule": "sade" + }, "smol-toml": { "id": "smol-toml", "type": "documented", @@ -3515,6 +3569,12 @@ "id": "api/util.html#utilisdeepstrictequalval1-val2-options" } }, + "util.parseArgs": { + "id": "util.parseArgs", + "type": "native", + "nodeFeatureId": {"moduleName": "node:util", "exportName": "parseArgs"}, + "url": {"type": "node", "id": "api/util.html#utilparseargsconfig"} + }, "util.stripVTControlCharacters": { "id": "util.stripVTControlCharacters", "type": "native", From b4a32303950ac8df7cd677ba4f7ef0b1dd4d39c5 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Sun, 12 Apr 2026 19:03:16 +0100 Subject: [PATCH 2/8] chore: drop args parsers --- docs/modules/parseargs.md | 24 ------------------------ manifests/preferred.json | 36 ------------------------------------ 2 files changed, 60 deletions(-) delete mode 100644 docs/modules/parseargs.md diff --git a/docs/modules/parseargs.md b/docs/modules/parseargs.md deleted file mode 100644 index 51b3479b..00000000 --- a/docs/modules/parseargs.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -description: Modern alternatives to packages for CLI argument parsing ---- - -# Replacements for argument parsers - -## `util.parseArgs` (native, since Node.js 16.17.0) - -[`util.parseArgs`](https://nodejs.org/api/util.html#utilparseargsconfig) can replace many common CLI parsing libraries such as `arg`, `minimist`, `mri`, `yargs-parser`. - -Example: - -```ts -import { parseArgs } from 'node:util' - -const { values, positionals } = parseArgs({ - args: process.argv.slice(2), - options: { - force: { type: 'boolean', short: 'f' }, - output: { type: 'string', short: 'o' } - }, - allowPositionals: true -}) -``` diff --git a/manifests/preferred.json b/manifests/preferred.json index 64e235d9..a693a09a 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -24,12 +24,6 @@ "replacements": ["fetch", "ofetch", "ky"], "url": {"type": "e18e", "id": "fetch"} }, - "arg": { - "type": "module", - "moduleName": "arg", - "replacements": ["util.parseArgs"], - "url": {"type": "e18e", "id": "parseargs"} - }, "axios": { "type": "module", "moduleName": "axios", @@ -360,12 +354,6 @@ "replacements": ["dlv", "object-path"], "url": {"type": "e18e", "id": "dot-prop"} }, - "getopts": { - "type": "module", - "moduleName": "getopts", - "replacements": ["util.parseArgs"], - "url": {"type": "e18e", "id": "parseargs"} - }, "glob": { "type": "module", "moduleName": "glob", @@ -2412,12 +2400,6 @@ "replacements": ["sade"], "url": {"type": "e18e", "id": "commander"} }, - "minimist": { - "type": "module", - "moduleName": "minimist", - "replacements": ["util.parseArgs"], - "url": {"type": "e18e", "id": "parseargs"} - }, "mkdirp": { "type": "module", "moduleName": "mkdirp", @@ -2430,12 +2412,6 @@ "replacements": ["day.js", "date-fns", "luxon", "Date"], "url": {"type": "e18e", "id": "moment"} }, - "mri": { - "type": "module", - "moduleName": "mri", - "replacements": ["util.parseArgs"], - "url": {"type": "e18e", "id": "parseargs"} - }, "node-fetch": { "type": "module", "moduleName": "node-fetch", @@ -2755,12 +2731,6 @@ "moduleName": "yargs", "replacements": ["sade"], "url": {"type": "e18e", "id": "commander"} - }, - "yargs-parser": { - "type": "module", - "moduleName": "yargs-parser", - "replacements": ["util.parseArgs"], - "url": {"type": "e18e", "id": "parseargs"} } }, "replacements": { @@ -3569,12 +3539,6 @@ "id": "api/util.html#utilisdeepstrictequalval1-val2-options" } }, - "util.parseArgs": { - "id": "util.parseArgs", - "type": "native", - "nodeFeatureId": {"moduleName": "node:util", "exportName": "parseArgs"}, - "url": {"type": "node", "id": "api/util.html#utilparseargsconfig"} - }, "util.stripVTControlCharacters": { "id": "util.stripVTControlCharacters", "type": "native", From b750d0cc01ece058f8d4a75695498e405810635c Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 26 Apr 2026 19:05:00 +0100 Subject: [PATCH 3/8] add missing mappings --- .../modules/{commander.md => cli-builders.md} | 0 manifests/preferred.json | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) rename docs/modules/{commander.md => cli-builders.md} (100%) diff --git a/docs/modules/commander.md b/docs/modules/cli-builders.md similarity index 100% rename from docs/modules/commander.md rename to docs/modules/cli-builders.md diff --git a/manifests/preferred.json b/manifests/preferred.json index 9114e7f2..f1da7b86 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -130,7 +130,7 @@ "type": "module", "moduleName": "commander", "replacements": ["sade"], - "url": {"type": "e18e", "id": "commander"} + "url": {"type": "e18e", "id": "cli-builders"} }, "copy-text-to-clipboard": { "type": "module", @@ -2430,6 +2430,12 @@ "replacements": ["node:crypto"], "url": {"type": "e18e", "id": "md5"} }, + "meow": { + "type": "module", + "moduleName": "meow", + "replacements": ["sade"], + "url": {"type": "e18e", "id": "cli-builders"} + }, "minimist": { "type": "module", "moduleName": "minimist", @@ -2786,6 +2792,12 @@ "replacements": ["@xmldom/xmldom"], "url": {"type": "e18e", "id": "xmldom"} }, + "yargs": { + "type": "module", + "moduleName": "yargs", + "replacements": ["sade"], + "url": {"type": "e18e", "id": "cli-builders"} + }, "yargs-parser": { "type": "module", "moduleName": "yargs-parser", @@ -3377,12 +3389,7 @@ "type": "documented", "replacementModule": "rollup-plugin-visualizer" }, - "sade": { - "id": "sade", - "type": "documented", - "url": {"type": "e18e", "id": "commander"}, - "replacementModule": "sade" - }, + "sade": {"id": "sade", "type": "documented", "replacementModule": "sade"}, "smol-toml": { "id": "smol-toml", "type": "documented", From bc89bc30736da6c5909e1571e329d64708f5ae7d Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 28 Apr 2026 08:04:29 +0100 Subject: [PATCH 4/8] add note about argument parsers --- docs/modules/cli-builders.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/modules/cli-builders.md b/docs/modules/cli-builders.md index 9fe80805..13422ed5 100644 --- a/docs/modules/cli-builders.md +++ b/docs/modules/cli-builders.md @@ -31,3 +31,7 @@ prog prog.parse(process.argv) ``` + +## Argument parsers + +If you only need an argument parser, check the [argument parsers page](https://e18e.dev/docs/replacements/parseargs). From 36e892b46619df8352c84c9c9d1cc209021cdb16 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 28 Apr 2026 08:05:46 +0100 Subject: [PATCH 5/8] link back --- docs/modules/parseargs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/modules/parseargs.md b/docs/modules/parseargs.md index 1e90070c..c3a942d4 100644 --- a/docs/modules/parseargs.md +++ b/docs/modules/parseargs.md @@ -43,3 +43,7 @@ const options = mri(process.argv.slice(2), { boolean: ['force'] }) ``` + +## CLI builders + +If you need a CLI builder, check the the [CLI builders page](https://e18e.dev/docs/replacements/cli-builders). From 43982280d2a59452491563747477a0311332914e Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 28 Apr 2026 08:32:17 +0100 Subject: [PATCH 6/8] add cleye --- docs/modules/cli-builders.md | 37 ++++++++++++++++++++++++++++++++++++ manifests/preferred.json | 15 ++++++++------- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/docs/modules/cli-builders.md b/docs/modules/cli-builders.md index 13422ed5..14196a6a 100644 --- a/docs/modules/cli-builders.md +++ b/docs/modules/cli-builders.md @@ -32,6 +32,43 @@ prog prog.parse(process.argv) ``` +## `cleye` + +[`cleye`](https://github.com/privatenumber/cleye) is a bigger, but more powerful tool for building CLI applications for Node.js + +```ts +import { cli } from 'cleye' + +// Parse argv +const argv = cli({ + name: 'greet.js', + + // Define parameters + parameters: [ + '', // First name is required + '[last name]' // Last name is optional + ], + + // Define flags/options + flags: { + // Parses `--time` as a string + time: { + type: String, + description: 'Time of day to greet (morning or evening)', + default: 'morning' + } + } +}) + +const name = [argv._.firstName, argv._.lastName].filter(Boolean).join(' ') + +if (argv.flags.time === 'morning') { + console.log(`Good morning ${name}!`) +} else { + console.log(`Good evening ${name}!`) +} +``` + ## Argument parsers If you only need an argument parser, check the [argument parsers page](https://e18e.dev/docs/replacements/parseargs). diff --git a/manifests/preferred.json b/manifests/preferred.json index 53d2e13f..282b0c65 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -2331,7 +2331,7 @@ "meow": { "type": "module", "moduleName": "meow", - "replacements": ["sade"], + "replacements": ["sade", "cleye"], "url": {"type": "e18e", "id": "cli-builders"} }, "minimist": { @@ -2711,7 +2711,7 @@ "yargs": { "type": "module", "moduleName": "yargs", - "replacements": ["sade"], + "replacements": ["sade", "cleye"], "url": {"type": "e18e", "id": "cli-builders"} }, "yargs-parser": { @@ -2942,6 +2942,11 @@ "type": "native", "url": "https://bun.com/docs/test" }, + "cleye": { + "id": "cleye", + "type": "documented", + "replacementModule": "cleye" + }, "concurrently": { "id": "concurrently", "type": "documented", @@ -3187,11 +3192,7 @@ "type": "documented", "replacementModule": "milliparsec" }, - "mri": { - "id": "mri", - "type": "documented", - "replacementModule": "mri" - }, + "mri": {"id": "mri", "type": "documented", "replacementModule": "mri"}, "nano-staged": { "id": "nano-staged", "type": "documented", From ace4a010862b2c297597386e537b031bd024223a Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 28 Apr 2026 09:30:12 +0100 Subject: [PATCH 7/8] Update manifests/preferred.json Co-authored-by: James Garbutt <43081j@users.noreply.github.com> --- manifests/preferred.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/preferred.json b/manifests/preferred.json index 282b0c65..3369b81c 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -135,7 +135,7 @@ "commander": { "type": "module", "moduleName": "commander", - "replacements": ["sade"], + "replacements": ["sade", "cleye"], "url": {"type": "e18e", "id": "cli-builders"} }, "copy-text-to-clipboard": { From 990c6b6839dd1fa4d7cbac94d7a829fab95c5c59 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 28 Apr 2026 17:32:35 +0100 Subject: [PATCH 8/8] update description --- docs/modules/cli-builders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/cli-builders.md b/docs/modules/cli-builders.md index 14196a6a..e806bc70 100644 --- a/docs/modules/cli-builders.md +++ b/docs/modules/cli-builders.md @@ -34,7 +34,7 @@ prog.parse(process.argv) ## `cleye` -[`cleye`](https://github.com/privatenumber/cleye) is a bigger, but more powerful tool for building CLI applications for Node.js +[`cleye`](https://github.com/privatenumber/cleye) is another powerful tool for building CLI applications for Node.js ```ts import { cli } from 'cleye'