node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


springbokjs-library NPM version

⚠️ After 9.0.0, springbokjs-library doesn't supports node < 3.1.0

Recommended version: node > 4.1.0 with --es_staging

How to install

With yo

npm install -g yo generator-springbokjs-library
yo springbokjs-library


Install dependencies

npm install --save-dev springbokjs-library && npm install --save babel-runtime

Edit Makefile:

Browser lib
include node_modules/springbokjs-library/
Node 5 lib
include node_modules/springbokjs-library/
Node 5 And Browser lib
include node_modules/springbokjs-library/

Init your package

make init
# is equals to: make install-config-files install-scripts install-githooks

Perfect !

You can now use make watch !

How this works

Babel and es6

Write code in es6 in the src directory, it's then transpiled with babel to lib. Use the task make build or make watch to transpile the code.

Coding Rules

Eslint and jscs are used to ensure a common coding style. I mostly follow the Airbnb coding style except for this points:

  • 4 spaces indentation (instead of 2)
  • Maximum line length is 120
  • Always use { } to delimit blocks
  • Don't use void
  • You can declare multiple var one the same line if there are all undefined (let i, j;)
  • " is allowed to escape ': "'hi'" is more readable than '\'hi\''

You can check the code by running the task make lint. With an editor, install the plugins to validate the code as you type !


jsdoc allows to document the code and generate the api. istanbul is used to generate the coverage. You can generate the documentation with make docs, a shortcut for make api tests-coverage


Tests are in the directory tests/src, transpiled with babel to tests/lib. Use the task make tests to run the tests. Compilation to tests/lib is done by make build or make watch. Prefer to follow the structure in tests/src like src and tests each file.

Available tasks with make

To package manager

  • install-config-files: install symbolic links to .jscsrc, .jshintrc, .eslintrc, .babelrc and .npmignore
  • install-scripts: modify package.json to install npm scripts and hooks
  • update: run npm prune and npm install

To code

  • clean: remove lib, tests/lib and dist directories.
  • build: clean the directory, build src to lib, tests/src to tests/lib and then lint the code
  • watch: clean then build and watch src and tests/src directories
  • lint: execute jshint (if .jshintrc exists), jscs and eslint (if .eslintrc exists)
  • lint-fix: execute jscs -x
  • tests: run tests with mocha (execute build/watch before if needed)
  • docs: run api and tests-coverage
  • api: generate api with jsdoc
  • tests-coverage: generate coverage documentation

Publish a new version

In the process, this will pre-generate a changelog based on the commits, then open nano so you can adapt it if you want.