Skip to content

Consider moving from yargs to node:util parseArgs #833

@vladfrangu

Description

@vladfrangu

This is a super low priority idea, but our CLI could be even smaller by dropping yargs and moving to https://nodejs.org/api/util.html#utilparseargsconfig that is native in node 18+ (and bun/deno). Most of the code is already more less easy to swap argument parsing around, so it should be an easy-ish task.

[partially regret not doing that from the get go but alas]

Realistically, what would need to change is:

  • in entrypoints/_shared.ts, handle the main process.argv.slice(2) to extract out -h / --help and -v / --version. Depending on remaining positionals, the messages would print.
  • Otherwise, try to get commands from the command registry and call _run accordingly.
  • ApifyCommand will need changes to build the options object for parseArgs per command (but that should be easy enough with minimal code changes)
  • ??? other things I don't know at 2am

Metadata

Metadata

Assignees

Labels

t-dxIssues owned by the DX team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions