Webpack babel based boilerplate for producing libraries (Input: ES6, Output: universal library)
- Webpack 4.
- ES6 as a source.
- Exports in a [umd]
ES6 source files
|
|
(webpack + babel)
|
|
|
umd format and Module format
Result:
library
|
|__ src
| |__ index.js (es6)
|
|__ lib
| |__ library.js (es5)
|
|__ dist
|__ src
|__ index.js (es5)
-
Create your library project
npm init -
npm install git+http://github.com/StateTree/webpack-library-boilerplate.git- This will create src, lib,build, test, docs directory
- Creates babel and webpack config
- Updates your package.json properties
devDependenciesandscripts - Removes itself from your node_modules project
-
Open
webpack.config.jsfile and change the value oflibraryNamevariable
npm run start- webpack dev server executes demo.jsnpm run prebuild- Removes the dist and lib foldernpm run build- produces module version of your library under thelibfolder and UMD version in dist foldernpm run postbuild- buildconfig inside scripts is used to execute copy operationnpm run release:bugfix- execute npm versionpatchupdate and merge tomaster branchnpm run release:feature- execute npm versionminorupdate and merge tomaster branchnpm run release:breakingchange- execute npm versionminorupdate and merge tomaster branch
- Test Framework
- Doc support
- importing .gitignore file using copy operation
- coverage report generator