casaval / nodeplate

A boilerplate for your rock-solid node.js projects. Includes static code analysis, development and building tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nodeplate

A boilerplate for your rock-solid node.js projects. Includes static code analysis, development and building tools.

What's included ?

  • Babel transpiling npm start (using babel)

    Write your code in ES6.

  • Watch files and reload npm run dev (using nodemon)

    Run your script and watch for changes.

  • Debugging npm run debug (using babel-node-debug)

    Debug your application using a babel-compatible version of node-inspector.

  • Test runner npm test (using lab)

    Write your tests in the test folder and run them with npm test.

  • Code coverage npm run coverage (using lab)

    Lab can also calculate the code coverage.

  • Code linting npm run lint (using xo)

    Lint your code (even ES6/7 and JSX).

  • Code format npm run format (using xo)

    Beautify and format you code. Fix errors found by xo

  • Recognize duplicate code npm run inspect (using jsinspect)

    Recognize duplicate, copy-pasted and similar code.

  • License checker npm run licenses (using license-checker)

    Print the link and the license type of each dependency

  • Package building npm run build (using nar)

    You can build an executable file out of your project including all dependencies.

    Please refer to nar's documentation if you like to include a custom node.js version or to build a package for a different system-architecture/OS. You should simple edit the buildproperty in the scripts section of package.json to something like:

    nar create --executable --os darwin --arch x64 --node 0.12.0
  • Find vulnerabilities npm run deps:sec (using nsp)

    nsp (Node Security Project) will check if any dependency is affected by a known vulnerability.

  • Keep dependencies up-to-date npm run deps:updates (using david)

    David keeps dependencies up-to-date and will help you to update them.

  • README generator npm run readme (using node-readme)

    Generate a README like this from an ES6 template extracting data from package.json. Edit the .README.md template and run the command. Check the node-readme documentation for all available variables/functions.

    Do not edit the README.md in your project folder, since this will be overwritten running the npm run readme command.

  • Git hooks (using husky)

    Custom precommit and prepush are defined in order to run tests (and vulnerabilities discovery) on commit and push. You can define your own in the package.json

  • npm-run-all

Install

git clone https://github.com/g-div/nodeplate
cd nodeplate
npm install

Usage

Use npm commands listed above as following:

npm run lint
npm run test:deps

or use npm-run-all:

npm-run-all --parallel lint test:deps test --sequential build

Scripts

  • npm run readme : node-readme
  • npm run precommit : npm test
  • npm run prepush : npm-run-all lint test test:deps
  • npm run start : npm run boot
  • npm run boot : babel-node $npm_package_main
  • npm run dev : nodemon --exec babel-node -- $npm_package_main
  • npm run debug : babel-node-debug $npm_package_main
  • npm run lint : xo
  • npm run format : xo --fix
  • npm run inspect : jsinspect
  • npm run test : lab
  • npm run coverage : lab -r lcov
  • npm run build : nar create --executable
  • npm run deps:sec : nsp audit-package
  • npm run deps:updates : david
  • npm run test:deps : npm-run-all deps:sec deps:updates
  • npm run licenses : license-checker

Dependencies

Package Version Dev
babel ^5.8.29
babel-node-debug ^1.3.0
david ^6.4.0
husky ^0.10.1
jsinspect ^0.7.0
lab ^7.0.0
license-checker ^4.2.0
nar ^0.3.20
node-readme ^0.1.9
nodemon ^1.8.0
npm-run-all ^1.2.12
nsp ^1.1.0
xo ^0.10.1

TODOs:

Contributing

Contributions welcome; Please submit all pull requests the against master branch.

Author

g-div http://github.com/g-div

License

About

A boilerplate for your rock-solid node.js projects. Includes static code analysis, development and building tools.