arcanis / clipanion

Type-safe CLI library / framework with no runtime dependencies
https://mael.dev/clipanion/
1.12k stars 65 forks source link

refactor: move argument methods out of the Command class #56

Closed merceyz closed 4 years ago

merceyz commented 4 years ago

What's the problem this PR addresses?

It's currently impossible for rollup and webpack to treeshake methods from classes so even if you're only using Command.String arguments all the other types will be included in the bundle

How did you fix it?

Move the argument methods out of the Command class

arcanis commented 4 years ago

I'm still not fan of Argument (looks too much like arguments imo) 🤔 What about Option?

Apart from that it sounds good to me - perhaps a test to ensure that the tree shaking works would help potential regression (for example if we change the build system later on).

merceyz commented 4 years ago

I'm still not fan of Argument (looks too much like arguments imo) thinking What about Option?

Sounds better and I totally agree :+1:

perhaps a test to ensure that the tree shaking works would help potential regression (for example if we change the build system later on).

Test added :+1: