springbokjs-library v17.0.0
springbokjs-library
:warning: 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
Without
Install dependencies
npm install --save-dev springbokjs-library && npm install --save babel-runtime
Edit Makefile
:
Browser lib
include node_modules/springbokjs-library/lib-browser.mk
Node 5 lib
include node_modules/springbokjs-library/lib-node5.mk
Node 5 And Browser lib
include node_modules/springbokjs-library/lib-node5-browser.mk
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 !
Documentation
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
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 hooksupdate
: runnpm prune
andnpm install
To code
clean
: removelib
,tests/lib
anddist
directories.build
:clean
the directory, buildsrc
tolib
,tests/src
totests/lib
and thenlint
the codewatch
:clean
then build and watchsrc
andtests/src
directorieslint
: executejshint
(if .jshintrc exists),jscs
andeslint
(if .eslintrc exists)lint-fix
: executejscs -x
tests
: run tests with mocha (execute build/watch before if needed)docs
: runapi
andtests-coverage
api
: generate api with jsdoctests-coverage
: generate coverage documentation
Publish a new version
- npm version patch|minor|major
- npm publish
In the process, this will pre-generate a changelog based on the commits, then open nano so you can adapt it if you want.
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago