Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from yargs to commander to remove 16 dependencies #418

Open
greggman opened this issue Apr 8, 2023 · 4 comments
Open

Switch from yargs to commander to remove 16 dependencies #418

greggman opened this issue Apr 8, 2023 · 4 comments

Comments

@greggman
Copy link

greggman commented Apr 8, 2023

Description: switching from yargs to commander would reduce dependencies. commander has 0, yargs has 16

Every downstream dependency adds work as all of them need updates and all of them may have vulnerabilities. Lowering dependencies is generally a win.

If there's nothing special about yargs, would it be ok to provide a PR to remove it and replace with commander?

note: commander is more popular than yargs. Not that popularity has anything to do with quality, only that lots of people are relying on it.

@gustavohenke
Copy link
Member

gustavohenke commented Apr 9, 2023

We used to be on commander prior to v4.0.0: https://github.com/open-cli-tools/concurrently/blob/3.6.1/src/main.js

I briefly looked at its API these days, and it hasn't improved much since.
But to be honest, I don't remember why I made the switch, although I overall like using yargs.

I wouldn't mind seeing a PR that ditches yargs for some other CLI library, but it would need, at least, to

  1. keep full compatibility
  2. have decent typescript types

Anyways, we should discuss first which library that'd be, as I'd like to reduce the chances of not merging the many hours of work one can easily pour into such a PR.

@greggman
Copy link
Author

Saw meow. Not sure if it's better or worse the commander. it has typescript types.

@shadowspawn
Copy link

I stumbled across this issue and had a light look at compatibility of Yargs and Commander in this project. Two Yargs features that are being used that that would require extra work to match behaviour in Commander are:

  • global env prefix: .env('CONCURRENTLY')
  • option grouping in help: .group(['p', 'c', 'l', 't'], 'Prefix styling')

(Disclaimer: I help maintain Commander and Yargs.)

@gustavohenke
Copy link
Member

So there was a discussion at work about using a CLI builder different from yargs because its API is a bit annoying, and now it's getting to me 😄

I looked into meow, but... it's ES modules only. I'm not ready to ditch CJS users yet.

So I found that yet another option to consider is to just use pure NodeJS, with util.parseArgs(), starting from Node 18+.
Sure, it'd mean implementing a few things from scratch, but maybe that's not a lot of work.

Something important to note is that --help can't be autogenerated, but I think I'd like it this way more. concurrently's help state is unwieldy.

gustavohenke added a commit that referenced this issue Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants