Boilerplate for creating javascript libraries in ES6 with tests.
- Source files written in ES6 and transpiled with Babel.
- Build file bundled with webpack.
- Exported in UMD format for use in all environments (including AMD / RequireJS and CommonJS / NodeJS / npm).
- Unit tests written with jasmine and run with karma.
- Unit test coverage with isparta & istanbul.
- Configuration managed by node-config and environment variables (development, production, test).
- Reports generated for unit test and coverage in HTML, txt, and json files.
- Environment variables to enable debugging and continuous integration support.
- Git hooks with husky ensure tests and builds pass.
- Change log adhering to Semantic Versioning and Keep a CHANGELOG.
npm run build
- Build
/src/index.js
to/index.js
using webpack.
- Build
npm run clean
- Clean files generated by scripts.
npm run develop
- Build
/src/index.js
(with sourcemaps). - Automatically re-build when source files change.
- Build
npm run reset-deps
- Reset dependencies.
npm run test
- Run unit tests and end to end tests.
- Reports generated in
/reports/
.
npm run test:e2e
- Placeholder command for end to end tests.
npm run test:unit
- Launch karma and run jasmine
*.spec.js
files.
- Launch karma and run jasmine
npm run test:unit:watch
- Automatically re-run unit tests when source files change.
npm run test:unit:fast
- Run unit tests without code coverage or reports.
npm run test:unit:fast:watch
- Automatically re-run fast unit tests when source files change.
development
production
test
The appropriate configuration file is loaded from /config/node/
.
Set to 1
to;
- Increase console logging.
- Launch tests in a browser.
Set to 1
to optimize commands for continuous integration servers, including reducing command line visuals.
Clone this repository, and update the following;
./package.json
name
description
author
./README.md
- Module name and description
- Remove most sections
./CHANGELOG.md
- Remove releases
./src/index.js
- Banner (name, description, example usage)
reports/unit-test/html/index.html
reports/unit-test/json/summary.json
reports/unit-test/json/detail.json
reports/unit-test-coverage/html/index.html
reports/unit-test-coverage/txt/summary.txt
reports/unit-test-coverage/txt/detail.txt
- Implement ESLint with eslint-config-airbnb
- Banner at the top of the built javascript file
- Webpack dev server or BrowserSync integration
- E2E tests
- Docker
Matt Turnbull <matt@iamturns.com>
Open sourced under the MIT license.