SVGO has a lot of dependents - it would be nice to extract the CLI into a separate module so that consumers of the JS API don't have to download coa, mkdirp et al. :smile:
:+1:
Can you provide an example of such a package? How to provide CLI in such a way?
Essentially it means removing the binary and associated dependencies/code from this module, out to a new module, say svgo-cli. Then svgo-cli would depend on svgo, and be its own package with its own tests etc.
https://github.com/ben-eb/cssnano/commit/8f4db2268e57c2adfddbfd21420e5d0943342c8f
@GreLI Any thoughts?
That's a major change, and I'm not sure, that it really worth it.
@GreLI You can firstly just make svgo-cli which will be dependent on svgo. Dependencies will be deduped.
Why do you think that dependendecies are such a big problem? Perhaps, svgo will reutilize them in the future :stuck_out_tongue_winking_eye:.
Besides, users are got used to just do npm install svgo and I don't think that breaking this pattern is a good idea either.
After reading @sindresorhus' reasoning on this (https://github.com/sindresorhus/ama/issues/17#issuecomment-117860283) I thought it was a good practice to have a separate CLI. It makes sense for those wrapper modules that will not make use of the command line, and therefore don't need the dependencies. This way the package is leaner overall. :smile:
The why is simple; extra calls to npm & more to download means slower build times. Less is more.
:+1: In addition, it makes the readmes neater, as you don't have to fit both CLI and API docs into one readme.
Is it a big issue? I don't think so.
@GreLI For you it's not a big issue. For us yes. Web should be small in every ways.
Would you accept a PR for this?
I afraid this goes beyond a simple PR.
Sorry, a PR and an svgo-cli repository. Or a PR and an svgo-core repository. Whichever way it would be.
I'm hardly imagine such a request, but you can try make so.