docs: add util.parseArgs replacements for CLI argument parsers#274
docs: add util.parseArgs replacements for CLI argument parsers#274
Conversation
|
Also worth suggesting as an alternative is https://npmgraph.js.org/?q=pargs, which is built on top of util.parseArgs, has no deps, is written in ESM, and adds a number of helpful features when migrating from the listed packages. |
|
sorry its taken me a while to get to this i think we need some 2nd opinions here as this diverges from the usual structure we have we follow one of two paths so far:
in this case, it is listing the things being replaced along with their migrations. which is different to all other docs @Fuzzyma thoughts? |
|
hm, so would you rather have x documents that all have one migration "x to fetch" and then in the fetch document link to all migrations? I think that would be cumbersome. Is there a reason we usually dont have migrations in the "fetch-like" documents? |
|
Thanks for the great work on this project and for taking the time to I was loosely modeling off of Happy to restructure to better fit the project — just let me know what |
|
i more meant that the way im finding it difficult to find the right words to explain this 😂 the fetch document explains fetch and alternative packages. this document explains packages being replaced. i.e. the focus/context in the fetch doc is the alternatives, but the focus in this one is the replaced modules. EDIT: like the title of the page is |
This comment was marked as resolved.
This comment was marked as resolved.
|
@bjnewman would you like to continue with this or prefer me to take over? |
|
i think its fine to have one doc here, as we do that for some other packages (e.g. fetch-like packages). but the headings need to be the things we're replacing these modules with. currently this PR has this structure: # Replacements for argument parsers
...
## minimist
...but that doesn't make sense because minimist isn't a replacement for an argument parser. it is the thing being replaced. it needs to be a much simpler doc i think, following the same pattern as all other docs: # Replacements for argument parsers
## `util.parseArgs` (native, Node.js)
... |
This comment was marked as resolved.
This comment was marked as resolved.
|
I still think we should have a separate doc for each, like we have for glob packages, as some packages have very different behaviours And for packages that have similar behaviour we can combine into one |
0482b28 to
7147eee
Compare
|
Sorry for the delay in responding to the feedback. I updated the doc page to follow the patterns from the rest of the pages. @gameroman if you want to separately open a PR with a single page for each of the targeted replacements please feel free I won't be offended. |
No worries, thank you very much for contributing! |
7147eee to
c5d5762
Compare
| "replacements": ["fs.rm", "fs.rmdir", "premove"], | ||
| "url": {"type": "e18e", "id": "rimraf"} | ||
| }, | ||
| "sade": { |
There was a problem hiding this comment.
I'm not sure sade should be in here.
From what I remember it uses mri under the hood to do arguments parsing. But it exists to provide help text etc on top of that.
In a future pr, we should probably add sade as a replacement itself for some packages in fact
There was a problem hiding this comment.
that's why it shouldn't really be here.
sade exists to provide a CLI args parser and help text generator (the former being provided by mri under the hood).
parseArgs replaces mri, but doesn't replace sade.
|
|
i think we need to rework this a bit. these packages parse args and generate help text:
this means they can't really be replaced by i think we should mark those (minus sade) as replaceable by sade, stricli, and cleye. |
|
i'd basically expect we end up with 3 categories/sets of replacements:
and any that do a bit of everything should really be documented as being replaced by a builder + renderer rather than a catch all package somehow. |
Summary
Adds migration documentation for replacing CLI argument parsing packages with Node.js built-in
util.parseArgs(available in Node 18.3+/16.17+).Packages covered
minimistmriargmeowyargs-parseryargscommandersadeChanges
docs/modules/parseargs.mdwith migration examples for each packagemanifests/preferred.jsonNotes
??) for defaults instead ofparseArgs'sdefaultoption to ensure compatibility with all Node 18.3+ versions