Open jamonholmgren opened 6 years ago
I played with it some tonight, but am not finding much info online about making Rollup work with a Node-powered CLI. I was able to get it to run, but it just copied the src/cli.js
into the build folder and didn't actually roll anything up.
Do you have some code I can look at?
I deleted it. No git backup.
I can pretty easily recreate what I had, though. I'll do that and throw it into a repo for you, @skellock .
What I’m thinking is perhaps we start the roll up bundle at the 2nd file and not the cli entry point.
We have our bin/{brand} file and then our {bundle}.
Not sure if that will matter.
I’ve used rollup on several libs and it’s awesome. But never on a cli before.
That’s actually what I did, started at the second file (cli.js). It just only included that file, though. Not sure what I’m doing wrong. I’ll post code next week.
Shipped gluegun with Rollup! However, it doesn't close this issue, as we don't include Rollup in generated CLIs. Keeping this zombie caged.
@jamonholmgren I would add as part of this improvement the TypeScript definitions to the output.
Even when you are using the JavaScript version, by adding the TypeScript spec some editors could give you an analysis of gluegun
dependency.
Also, disable removeComments
from the tsconfig
since that will remove the inline documentation of the code.
Coming from Elixir, I would love to see npm packages shipping with the inline documentation in the source code. Especially if the package is meant to be used in NodeJS ecosystem where the file sizes do not matter as much as the browser (in any case, your build pipeline could remove the documentation).
I am suffering from this details since either I have to go to Github to figure out the code or I have to put console.log
and hopefully I can find the info that I need.
Instead of shipping Rollup by itself to all gluegun CLI creators, might I suggest using https://github.com/developit/microbundle, or something like it, to reduce the burden of users to configure Rollup?
microbundle
looks really cool @jthegedus. I'd definitely consider it.
By adding Rollup to our generated CLIs, it would allow us to tree-shake and bundle only the code that is used into one (smaller) shipped bundle.