generator-javascript-module
v0.3.0
Published
Scaffold modern, ES6 clientside JavaScript modules with Yeoman
Downloads
1
Maintainers
Readme
JavaScript Module Generator
Scaffold and develop modern clientside JavaScript libraries with Yeoman. This generator sets up an ES6-ready JavaScript workflow including:
- Rollup module bundler
- Babel browser-aware transpilation (via env preset)
- Gulp buildstep
- Clientside testing framework (using WCT)
- Browsersync for browser demos
- ES6 + CommonJS + UMD/Unpkg distribution
Installation
Install Yeoman and the module generator
$ npm install -g yo generator-javascript-module
Then use it
$ yo javascript-module
Developing your module
Your ES6 library lives in the src
directory and is automatically built into ES5 bundles in the root of your project - [module-name].js
and [module-name].min.js
.
Run gulp
to build your module, watch for changes, and serve a demo page. Or run gulp build
to just build the bundles.
There's a demo page setup in demo/index.html
for showing what your library does in a typical browser environment. It's served on localhost:3000
with Browsersync.
Tests are written in ES6 and kept in the test/
directory. Describe tests with Mocha and run assertions with Chai. Tests are run in the browser using Karma, via the Web Component Tester framework. Build and run tests with gulp test
.
This generator expects that your module will be published to NPM under the module name you provide. The following bundles are distributed in your package.json
:
- Main entrypoint (Node/Require):
[module-name].js
- ES6 entrypoint (ES6-aware bundlers):
src/[module-name].js
- Browser entrypoint (Unpkg):
[module-name].min.js
MIT © Sean King