My OSS workflow (part 1)

EGOIST
2 min readJan 22, 2017

--

You don’t need a custom workflow for creating OSS project, but you should. Since it boosts your productivity to another level ;)

For me I mostly make JavaScript libraries, some of them are for node.js and some others are for browsers.

If the library only has JS code and targets recent node.js versions (5,6,7), I might use the nm template, basically it’s similar to a yeoman generator but built with project sao, it provides following common features I use:

If the library targets browser environment, I would use Rollup to create a UMD bundle too. As you know Rollup is a general bundler for JavaScript apps, so I made a higher-level wrapper for it to make bundling even more convenient, which is called bili. To make a long story short, the following command would create cjs umd compressed bundles for you:

bili --format cjs --format umd --module-name React --compress

But when the need of CSS or others assets comes in, I switch to webpack instead, Rollup can still do the job but I find Webpack more powerful in this field.

I haven’t made that many browser libraries which have the need of CSS and other assets, mostly Vue components, so I just use vbuild (a wrapper for webpack and Vue) to finish the job quickly. What’s also worth noting, vue-cli got a vbuild-like feature recently!

Conclusions

For recent node versions, you can just write beautiful ES6 code and keep it the way it is.

For browser libraries or you want to bundle all modules in one file, use Rollup or Webpack, and I built bili and vbuild for the short-hand use.

Edit (2017/3/15): template-nm now has rollup support too, so I use it to create both browser and npm modules now.

--

--

EGOIST
EGOIST

No responses yet