open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
7k stars 228 forks source link

Switch from yargs to commander to remove 16 dependencies #418

Open greggman opened 1 year ago

greggman commented 1 year ago

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 commented 1 year ago

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 commented 8 months ago

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

shadowspawn commented 6 months ago

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:

(Disclaimer: I help maintain Commander and Yargs.)

gustavohenke commented 5 months ago

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.