ES6 library starter

A boilerplate for a universal (Node, web, UMD) ES6 library.
Quick usage
- Clone this repo.
- Change all relevant entries in
package.json and README.md, so they match your new shiny library.
- Run
npm install to install dev dependencies.
- Write your ES6 code in
src folder.
- Write your ES6 tests in
test folder.
- Run
npm build to build for node. This will output the result ES5 files to lib folder.
- Run
npm build-web to build and pack the files for the web. This will output the result to dist folder.
- Run
npm publish to pulish to the world.
Detailed overview
Installation
After cloning this repository, make sure to change all the relevant entries in package.json so they match your library.
npm install
Build for npm
npm run build
This will:
- Convert all files in
src folder from ES6 to ES5
- Output them to the
lib folder
Build for web
npm run build-web
This will:
- Run Webpack starting from the entry point file (
src/library.js, can be configured)
- Convert all files from ES6 to ES5
- Minify them, including all of their module dependencies as a UMD module (so the file will be self-contained)
- Output the file to the
dist folder
Test
npm run test
Configuration
In package.json, change all the relevant entries so they match your library.
Under the section library, you can configure:
- Library name (defaults to
"library")
- Webpack entry point (defaults to
src/library.js)
License
MIT