Skip to content

Replace yargs-parser with Node.js built-in util.parseArgs#887

Open
mcollina wants to merge 1 commit into
mainfrom
replace-yargs-parser-with-util-parse-args
Open

Replace yargs-parser with Node.js built-in util.parseArgs#887
mcollina wants to merge 1 commit into
mainfrom
replace-yargs-parser-with-util-parse-args

Conversation

@mcollina
Copy link
Copy Markdown
Member

Removes the yargs-parser dependency in favor of Node.js native util.parseArgs, which is available in Node.js 18.3+ and 20.0+.

Changes

  • New lib/parse-args.js module wraps util.parseArgs with camel/kebab normalization, boolean flag consumption, short aliases, env prefix resolution (FASTIFY_\* environment variables), number coercion, and --` separator handling
  • All CLI argument parsing now uses this module instead of yargs-parser
  • Removed yargs-parser from package.json dependencies

Breaking Changes

  • --help / -h is now a boolean flag instead of consuming the next argument as its value. Previously -h true would set help to the string 'true'; now -h simply sets help to true and true becomes a positional argument.
  • Plugin options passed after -- separator: unknown --key value pairs now parse --key as a boolean (true) instead of taking value as its string value

Testing

All existing tests pass with updated expectations.

Removes the yargs-parser dependency in favor of Node.js native util.parseArgs.
Handles camel/kebab normalization, boolean flag consumption, short aliases,
env prefix resolution, number coercion, and -- separator handling.

Breaking: --help is now a boolean flag instead of consuming the next argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant