I took some time to study some cli npm packages. We did many hacks and tricks to adopt commander.js and I think we should move to yargs (https://github.com/yargs/yargs). It seems promising and it is quite active.
Pro:
- It has support for sub commands
- We can have one file for each command or sub-command
- it has support for alias
Cons:
- It has not native support
yarn help
, but it has native support foryarn --help/-h
- For some command we still can’t force some flags (like we do for the global commands), but maybe we can resolved this with https://github.com/yargs/yargs#coerce.
Do someone see any other reasons why we should not move to this? Please let me know 🙂
@voxsim, feel free to give it a try and check if the code becomes more readable.
Would be great if there is a way around the CONS