├── .gitattributes ├── .gitignore ├── .markdownlint.json ├── src └── index.js ├── .editorconfig ├── test └── index.js ├── benchmark └── index.js ├── licence.txt ├── .travis.yml ├── package.json └── readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | changelog.md 3 | CHANGELOG.md 4 | tmp.md 5 | todo.md 6 | /.idea 7 | /coverage 8 | /dist 9 | /local 10 | /reports 11 | /node_modules 12 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD013": false, 4 | "MD036": false, 5 | "MD041": false, 6 | "no-hard-tabs": false, 7 | "whitespace": false 8 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import pkg from '../package.json' 4 | 5 | console.log(pkg.description) 6 | console.log(`Version: ${pkg.version}`) 7 | console.log(`Author: ${pkg.author}`) 8 | console.log(`Licence: ${pkg.license}`) 9 | console.log(`Repository: ${pkg.homepage}`) 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.{json,yml}] 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.md] 16 | insert_final_newline = false 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | import chai from 'chai' 2 | import sinon from 'sinon' 3 | import sinonChai from 'sinon-chai' 4 | 5 | const expect = chai.expect 6 | 7 | chai.use(sinonChai); 8 | 9 | describe('Main Test Description', function () { 10 | let a 11 | 12 | // beforeEach(function () { 13 | // a = 1 14 | // }) 15 | 16 | it('Test Description', function () { 17 | // expect().to.be ... 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /benchmark/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import benchmark from 'benchmark' 4 | 5 | const suite = new benchmark.Suite 6 | 7 | const a = 1000 8 | const b = 2000 9 | 10 | let result = 0 11 | 12 | suite 13 | .add('Benchmark Description 1', function () { 14 | result = a + b 15 | }) 16 | .add('Benchmark Description 2', function () { 17 | result = ((a * 1000) / 1000) + ((b * 1000) / 1000) 18 | }) 19 | // add listeners 20 | .on('cycle', function (event) { 21 | console.log(String(event.target)) 22 | }) 23 | .on('complete', function () { 24 | console.log('Fastest is ' + this.filter('fastest').map('name')); 25 | }) 26 | // run async 27 | .run({ 'async': true }) 28 | -------------------------------------------------------------------------------- /licence.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016 Maik Ellerbrock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - '6' 5 | - '5' 6 | branches: 7 | only: 8 | - master 9 | cache: 10 | directories: 11 | - node_modules 12 | notifications: 13 | email: 14 | on_success: never 15 | on_failure: always 16 | slack: 17 | secure: wZl/xMpwqL3IXJ4+VagLkUWITYGkcop2hEqaQOQZ4qUf32IgxTfjkecd20/YOM1LrW79NWTJyeCv7Y4HX64AnTic0l99Ibg/QSTHG+5tksWS32o1fFy2j4GbmEBED67LjEiJuNgL911qm2LLtxzQ+rZojIr1W8VXziLyGE5Zlb3WAtVJOowHAOT23X1OrS/nX7mgOmDYeDh8Xvhcogb7Rk/ZauUAu1tVJvGM4g+KznVJh+N42WGAKZo94vxLGogpN5Gsfyt/HROlo35iT7+WS3W9prVQSispEyDQfIueXcy/np+XTpOGIscgSCz602HAq3/jYlw+aHFpa6fSPjk8K2wx6ZWewQfWhSKXwomFsQaGLbLYWn5HTMwiikGHsD4riysF9bOEE3Ez8xOOYOn551h/RPUmKIDkINILId6AuYHxad+6D2mwTa8sSniXexZ3WlyQGZ7rvso1RMEGxTtfoJyxlte9TFOc73bQ3JG+vrFY7q3YKsG+04h1dTOun0xJsIejI/vaV16DMSc/+BZSmztDUTGjWsYWPygk92nfYULEUFA6vdQXQjjmyOun0YNxcRGsmZnF/JURE28Pu0wXKq9WwpiU7ZR2AazO4c9txz2IxlK+AwAhkkOfZLYWGqdmwwP/vnyI06CQZEAzQdE9GC/7RDJh+GTg52xCL2ubpbY= 18 | before_install: 19 | - npm update 20 | install: 21 | - npm install 22 | before_script: 23 | - npm run clean 24 | script: 25 | - npm run lint 26 | - npm test 27 | - npm run coverage:ci 28 | after_success: 29 | - bash <(curl -s https://codecov.io/bash) 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-developer-boilerplate", 3 | "version": "0.6.0", 4 | "description": "Boilerplate for ES6+ Node.js Developers", 5 | "author": "Maik Ellerbrock", 6 | "main": "dist/index.js", 7 | "license": "MIT", 8 | "repository": { 9 | "url": "git@github.com:ellerbrock/node-developer-boilerplate.git", 10 | "type": "git" 11 | }, 12 | "homepage": "https://ellerbrock.github.io/node-developer-boilerplate", 13 | "bugs": { 14 | "url": "https://github.com/ellerbrock/node-developer-boilerplate/issues" 15 | }, 16 | "scripts": { 17 | "benchmark": "babel-node benchmark", 18 | "benchmark:watch": "nodemon src/index.js --exec babel-node benchmark", 19 | "prebuild": "yarn run clean:dist", 20 | "build": "cross-env NODE_ENV=production babel -s true src -d dist", 21 | "clean": "yarn run clean:dist && yarn run clean:reports && yarn run clean:coverage", 22 | "clean:coverage": "shx rm -rf coverage", 23 | "clean:dist": "shx rm -rf dist", 24 | "clean:reports": "shx rm -rf reports", 25 | "precoverage": "yarn run clean:coverage", 26 | "coverage": "cross-env NODE_ENV=test babel-istanbul cover src/*.js _mocha --report lcovonly -- -R spec", 27 | "postcoverage": "cross-env NODE_ENV=test babel-istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100", 28 | "coverage:ci": "cross-env NODE_ENV=test yarn run coverage && codecov", 29 | "debug": "nodemon src/index.js --exec babel-node --debug", 30 | "precommit": "yarn run clean && yarn run update-dependencies && yarn run build && yarn run lint:fix && yarn test && yarn run coverage && yarn run lint:travis && yarn run lint:markdown && yarn run lint:markdown-links", 31 | "commit": "git add --all && git status && git-cz", 32 | "postcommit": "yarn run lint:git && yarn run changelog", 33 | "changelog": "standard-changelog --preset angular-emoji --outfile changelog.md", 34 | "lint": "eslint src", 35 | "lint:fix": "eslint --fix src", 36 | "lint:git": "conventional-changelog-lint -e", 37 | "lint:travis": "travis-lint .travis.yml", 38 | "lint:markdown": "markdownlint readme.md", 39 | "lint:markdown-links": "markdown-link-check readme.md", 40 | "premonitor": "yarn run clean:dist && yarn run build", 41 | "monitor": "nodejs-dashboard node dist", 42 | "prerelease": "yarn run setenv:prod && yarn run clean && yarn run build && yarn run update-dependencies && yarn run lint && yarn run test && yarn run coverage", 43 | "release": "standard-version --no-verify", 44 | "postrelease": "greenkeeper-postpublish && yarn run setenv:dev", 45 | "security:test": "snyk test", 46 | "security:wizard": "snyk wizard", 47 | "security:protect": "snyk protect", 48 | "security:monitor": "snyk monitor", 49 | "update-dependencies": "yarn upgrade", 50 | "serve": "node dist", 51 | "setenv:dev": "yarn config set production false", 52 | "setenv:prod": "yarn config set production true", 53 | "start": "nodemon src/index.js --exec babel-node", 54 | "tasks": "ntl", 55 | "pretest": "yarn run clean:coverage && yarn run clean:reports", 56 | "test": "cross-env NODE_ENV=test mocha -c -S -R spec --compilers js:babel-register --check-leaks", 57 | "posttest": "cross-env NODE_ENV=test mocha -S -R mochawesome --compilers js:babel-register --reporter-options reportDir=reports --check-leaks", 58 | "test:watch": "cross-env NODE_ENV=test yarn test -- -w", 59 | "online": "git push --follow-tags origin master; yarn publish" 60 | }, 61 | "files": [ 62 | "dist" 63 | ], 64 | "config": { 65 | "commitizen": { 66 | "path": "cz-conventional-changelog-emoji" 67 | } 68 | }, 69 | "babel": { 70 | "presets": [ 71 | "es2015-node6", 72 | "stage-0" 73 | ], 74 | "env": { 75 | "production": { 76 | "plugins": [ 77 | "add-module-exports" 78 | ], 79 | "presets": [ 80 | "babili", 81 | "es2015" 82 | ] 83 | } 84 | } 85 | }, 86 | "eslintConfig": { 87 | "extends": "standard", 88 | "installedESLint": true, 89 | "plugins": [ 90 | "standard", 91 | "promise" 92 | ] 93 | }, 94 | "snyk": true, 95 | "devDependencies": { 96 | "babel-cli": "^6.23.0", 97 | "babel-istanbul": "0.12.2", 98 | "babel-node-debug": "^2.0.0", 99 | "babel-plugin-add-module-exports": "0.2.1", 100 | "babel-preset-babili": "^0.0.12", 101 | "babel-preset-env": "1.2.1", 102 | "babel-preset-es2015": "6.22.0", 103 | "babel-preset-es2015-node6": "0.4.0", 104 | "babel-preset-stage-0": "6.22.0", 105 | "babel-register": "^6.23.0", 106 | "babili": "^0.0.12", 107 | "benchmark": "^2.1.3", 108 | "chai": "^3.5.0", 109 | "codecov": "1.0.1", 110 | "commitizen": "2.9.6", 111 | "conventional-changelog-angular-emoji": "0.2.2", 112 | "conventional-changelog-lint": "1.1.1", 113 | "cross-env": "3.2.3", 114 | "cz-conventional-changelog-emoji": "0.1.0", 115 | "eslint": "^3.17.1", 116 | "eslint-config-standard": "7.0.1", 117 | "eslint-plugin-promise": "3.5.0", 118 | "eslint-plugin-standard": "2.1.1", 119 | "greenkeeper-postpublish": "1.0.1", 120 | "markdown-link-check": "3.0", 121 | "markdownlint-cli": "0.2.0", 122 | "mocha": "^3.2.0", 123 | "mochawesome": "^2.0.4", 124 | "mochawesome-report-generator": "1.1.0", 125 | "nodejs-dashboard": "^0.4.0", 126 | "nodemon": "^1.11.0", 127 | "ntl": "1.2.0", 128 | "shx": "^0.2.2", 129 | "sinon": "1.17.7", 130 | "sinon-chai": "2.8.0", 131 | "snyk": "^1.25.2", 132 | "standard-changelog": "0.0.1", 133 | "standard-version": "^4.0.0", 134 | "travis-lint": "1.0.0", 135 | "yarn": "0.21.3" 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ![Node Developer Boilerplate](https://github.frapsoft.com/top/babel-es7.jpg?v=101) 2 | 3 | # Node Developer Boilerplate 4 | 5 | [![Javascript](https://badges.frapsoft.com/javascript/code/javascript.svg?v=100)](https://github.com/ellerbrock/javascript-badges/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/ellerbrock/javascript-badges/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/ellerbrock/open-source-badges/) [![Gitter Chat](https://badges.gitter.im/frapsoft/frapsoft.svg)](https://gitter.im/frapsoft/frapsoft/) 6 | 7 | _Node / yarn 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 ..._ 8 | 9 | ## Project Status 10 | 11 | [![Build Status](https://travis-ci.org/ellerbrock/node-developer-boilerplate.svg?branch=master)](https://travis-ci.org/ellerbrock/node-developer-boilerplate) [![codecov](https://codecov.io/gh/ellerbrock/node-developer-boilerplate/branch/master/graph/badge.svg)](https://codecov.io/gh/ellerbrock/node-developer-boilerplate) ![dependencies](https://david-dm.org/ellerbrock/node-developer-boilerplate.svg) 12 | 13 | ## Features 14 | 15 | - Node optimized ES6 / ES7 Transpilation and Source Maps with [Babel](https://github.com/babel/babel) 16 | - ES6+ aware Code Minification based on the Babel toolchain [babili](https://github.com/babel/babili) 17 | - Restart Node on Application Changes with [nodemon](https://github.com/remy/nodemon) 18 | - Code Debugging with [babel-node-debug](https://github.com/crabdude/babel-node-debug) 19 | - Node Server Performance Monitoring with [nodejs-dashboard](https://github.com/FormidableLabs/nodejs-dashboard) 20 | - Javascript Linting with [ESLint](https://github.com/eslint/eslint) 21 | - Javascript Code Style [Standard](https://github.com/feross/standard) 22 | - Javascript Style Linting via [eslint-config-standard](https://github.com/feross/eslint-config-standard) 23 | - Automatic Semantic Releasing with [standard-version](https://github.com/conventional-changelog/standard-version) 24 | - Code Benchmark Testing with [benchmark.js](https://github.com/bestiejs/benchmark.js) 25 | - Vulnerability scan via [snyk](https://github.com/Snyk/snyk) 26 | - ES6+ Testing via [babel-register](https://github.com/babel/babel/tree/master/packages/babel-register) with [Mocha](https://github.com/mochajs/mocha), [Chai](https://github.com/chaijs/chai), [Sinon](https://github.com/sinonjs/sinon) and [sinon-chai](https://github.com/domenic/sinon-chai) 27 | - Generate HTML Reports from tests via [mochawesome](https://github.com/adamgruber/mochawesome) 28 | - ES6+ Code Coverage with [babel-istanbul](https://github.com/jmcriffey/babel-istanbul) 29 | - Ready for Continuous Integration & Delivery with [travis-ci](https://travis-ci.org) 30 | - Use Standard Conventional Commit Messages via [commitizen](https://github.com/commitizen/cz-cli) 31 | - Commitizen Emoji Support for [cz-conventional-changelog-emoji](https://github.com/ellerbrock/cz-conventional-changelog-emoji) 32 | - Automatic generate Changelog with Emoji Support [conventional-changelog-angular-emoji](https://github.com/ellerbrock/conventional-changelog-angular-emoji) 33 | - Lint Commit Messages via [conventional-changelog-lint](https://github.com/marionebl/conventional-changelog-lint) 34 | - Lint Markdown files with [markdownlint](https://github.com/DavidAnson/markdownlint) 35 | - Check if links in Markdown are online via [markdown-link-check](https://github.com/tcort/markdown-link-check) 36 | - Lint .travis.yml with [travis-lint](https://github.com/pwmckenna/node-travis-lint) 37 | - Slack & Email Notifications for Builds via [travis-ci](https://docs.travis-ci.com/user/notifications) 38 | - Task Runner CLI via [ntl](https://github.com/ruyadorno/ntl) 39 | - npm scripts to get quick up and running 40 | 41 | ## External Services 42 | 43 | *all used services are free to use for open source projects and quick registration via github authentication* 44 | 45 | - [github](https://github.com/) - Modern Version Control System 46 | - [npmjs](https://www.npmjs.com/) - Javascript Package Registry (optional: only if you want to publish to the npm registry) 47 | - [travis-ci](https://travis-ci.org) - Continuous Integration & Delivery 48 | - [codecov.io](https://codecov.io/) - Code Coverage 49 | - [snyk.io](https://snyk.io) - Fix and prevent known vulnerabilities in dependencies 50 | - [greenkeeper.io](https://greenkeeper.io) - Automated Dependency Management 51 | 52 | In case you have to pass some secure token to Travis-CI i recommend the [travis-cli](https://github.com/travis-ci/travis.rb) tool for decryption and lots of other features. You can read more about it [here](https://docs.travis-ci.com/user/encryption-keys/). Linux / OS X Installation via `sudo gem install travis`. You can also set Token on GitHub in the Repository Settings. 53 | 54 | ![unicorn](http://i.giphy.com/3o85xBO5Rt4031bH44.gif) 55 | 56 | ## Quickstart (npm) 57 | 58 | ```bash 59 | git clone https://github.com/ellerbrock/node-developer-boilerplate 60 | cd node-developer-boilerplate 61 | npm install 62 | ``` 63 | 64 | ## Quickstart (yarn) 65 | 66 | ```bash 67 | git clone https://github.com/ellerbrock/node-developer-boilerplate 68 | cd node-developer-boilerplate 69 | yarn 70 | ``` 71 | 72 | ### ECMAScript 2015 / ES6 73 | 74 | [Node.js](https://github.com/nodejs/node) comes with a huge set of ES6 features out of the box. A detailed list of supported features can be found at . To speed things up and avoid transpiling natively supported features i recommend to install only the missing parts in your current Node Version: 75 | 76 | - `npm install --save-dev babel-preset-es2015-node6` - Node.js Version 6x 77 | - `npm install --save-dev babel-preset-es2015-node5` - Node.js Version 5x 78 | - `npm install --save-dev babel-preset-es2015-node4` - Node.js Version 4x 79 | - `npm install --save-dev babel-preset-es2015` - for all Node.js Versions 80 | 81 | ### Info 82 | 83 | At the moment im busy working on this boilerplate and lot stuff is changing. 84 | When things getting more stable i will bump the version to 1.0.0 and write a detailed documentation. 85 | 86 | ### Contact / Social Media 87 | 88 | _Get the latest News about Web Development, Open Source, Tooling, Server & Security_ 89 | 90 | [![Github](https://github.frapsoft.com/social/github.png)](https://github.com/ellerbrock/) 91 | [![Docker](https://github.frapsoft.com/social/docker.png)](https://hub.docker.com/u/frapsoft/) 92 | [![npm](https://github.frapsoft.com/social/npm.png)](https://www.npmjs.com/~ellerbrock) 93 | [![Twitter](https://github.frapsoft.com/social/twitter.png)](https://twitter.com/frapsoft/) 94 | [![Facebook](https://github.frapsoft.com/social/facebook.png)](https://www.facebook.com/frapsoft/) 95 | [![Google+](https://github.frapsoft.com/social/google-plus.png)](https://plus.google.com/116540931335841862774) 96 | [![Gitter](https://github.frapsoft.com/social/gitter.png)](https://gitter.im/frapsoft/frapsoft/) 97 | 98 | ### License 99 | 100 | Copyright (c) 2016 [Maik Ellerbrock](https://github.com/ellerbrock/) 101 | 102 | [![MIT Licence](https://badges.frapsoft.com/os/mit/mit-125x28.png?v=102)](https://opensource.org/licenses/mit-license.php) 103 | --------------------------------------------------------------------------------