Node Developer Boilerplate

Node Developer Boilerplate

Javascript JavaScript Style Guide Commitizen friendly Standard Version Open Source Love Gitter Chat

Node / npm Boilerplate with Babel ES6 / ES7 Support, Testing, CI Integration, Code Coverage, JS Standard Style, Commit Guidelines, Git Hooks, Security Checks, Automatic Semantic Versioning, Benchmarking, Debugging, Monitoring, Source Map Generation, Auto Reload, Linting and more cool stuff ...

Project Status

Build Status codecov dependencies

Whats inside?

External Services

all used services are free to use for open source projects and quick super quick registration via github authentication

In case you have to pass some secure token to Travis-CI i recommend the travis-cli tool for decryption and lots of other features. You can read more about it here. Linux / OS X Installation via sudo gem install travis. You can also set Token on GitHub in the Repository Settings.

unicorn

Quickstart (npm)

git clone https://github.com/ellerbrock/node-developer-boilerplate
cd node-developer-boilerplate
npm install

Quickstart (yarn)

git clone https://github.com/ellerbrock/node-developer-boilerplate
cd node-developer-boilerplate
yarn

Scripts

"scripts": {
       "benchmark": "babel-node benchmark",
       "benchmark:watch": "nodemon $2 --exec babel-node benchmark",
       "pre-build": "npm run clean",
       "build": "cross-env NODE_ENV=production babel -s true src -d dist",
       "clean": "shx rm -rf dist",
       "coverage": "cross-env NODE_ENV=test babel-istanbul cover src/*.js _mocha --report lcovonly -- -R spec",
       "coverage:check": "cross-env NODE_ENV=test babel-istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
       "coverage:travis": "cross-env NODE_ENV=test npm run coverage && codecov",
       "debug": "nodemon $2 --exec babel-node --debug",
       "git:add": "git add --all && git status",
       "git:commit": "npm run git:add && git-cz",
       "git:push": "git push --follow-tags",
       "lint": "eslint src",
       "lint:fix": "eslint --fix src",
       "pre-monitor": "npm run build",
       "monitor": "nodejs-dashboard node dist",
       "pre-release": "npm update && npm run clean && npm run lint:fix && npm run scan:security && npm run setenv:prod && npm run test && npm run build",
       "release": "standard-version",
       "post-release": "npm run setenv:dev",
       "scan:security": "snyk test",
       "scan:updates": "ncu",
       "serve": "node dist",
       "setenv:dev": "npm config set production false",
       "setenv:prod": "npm config set production true",
       "start": "nodemon $2 --exec babel-node",
       "test": "cross-env NODE_ENV=test mocha -c -S -R spec --compilers js:babel-register --check-leaks",
       "test:watch": "cross-env NODE_ENV=test npm test -- -w",
       "test:export": "cross-env NODE_ENV=test mocha -S -R mochawesome --compilers js:babel-register --reporter-options reportDir=reports --check-leaks"
     }

ECMAScript 2015 / ES6

Node.js comes with a huge set of ES6 features out of the box. A detailed list of supported features can be found at http://node.green. To speed things up and avoid transpiling natively supported features i recommend to install only the missing parts in your current Node Version:

package.json

To avoid messing around with separate config files like .babelrc, .eslintrc.json and others we can put all that stuff directly in our package.json file:

{"files": [
     "dist",
     "readme.md"
   ],
   "config": {
     "commitizen": {
       "path": "./node_modules/standard-changelog"
     },
     "ghooks": {
       "pre-commit": "npm run clean && npm run lint:fix && npm test && npm run coverage && npm run build"
     }
   },
   "babel": {
     "presets": [
       "es2015-node6",
       "stage-0"
     ],
     "env": {
       "production": {
         "presets": [
           "babili"
         ]
       }
     }
   },
   "eslintConfig": {
     "extends": "standard",
     "installedESLint": true,
     "plugins": [
       "standard",
       "promise"
     ]
   },
   "snyk": true

Contact / Social Media

Get the latest News about Web Development, Open Source, Tooling, Server & Security

TwitterFacebookGoogle+GitterGithub

License

Copyright (c) 2016 Maik Ellerbrock

MIT Licence