This is a starter boilerplate for writing javascript libraries. It uses Webpack as a bundler and Jest as a testing tool.
- Bundler - Webpack
- Testing - Jest, Codecov and Travis
- Compiler - Babel
- Linter - ESLint
- Styling - Sass & PostCSS(Autoprefixer)
./src/js
- Javasscript source folder./src/js/__test__
- Javasscript test folder./src/scss
- CSS assosiated with the library (SCSS)./example
- Example folder where you can test your library./dist
- Compiled JS, CSS
In order to use this boilerplate you need to have npm or yarn installed.
yarn install
npm install
-
yarn run dev
Sets up a webpack dev server with hot module replacemnet. This is the
index.html
in./example/index.html
and can be accessed athttp://localhost:8080
-
yarn run test
Runs jest to test all the files located in
./src/js/__test_/
folder. -
yarn run test:watch
Runs jest watch and continously track the changes on test files
-
yarn run build
Compiles all the source files and creates a minified version in
./dist
folder -
yarn run production
Runs
yarn run build
andyarn run test
-
yarn run report-coverage
Runs codecov. for more information on code coverage please visit codecov.io
Please make sure to change the project name in package.json
file. This also changes the name of the compiled js and css file.