NodeJS Project Boilerplate
Setup for nodejs backend project
This setup includes:
- autoformatting code
- git hooks
pre-commit
- check dependencies
- code linting
- test code
commit-msg
- linting of commit message conventional commit
- autogenerated changelog
npm run first-release
: generate changelog based onconventional commit
typenpm run changelog
: update changelog based onconventional commit
type
- mutation testing
npm run coverage
: run coverage over mutation testing (stryker
)
N.B: the version of package is not automatically bumped; these settings should be used in conjunction with a git-flow
(for example gitflow-avh) tool, which will handle release management
Usage
npx nodejs-project-boilerplate
Commit message type
The commit message type must follow the conventional commit
convention based on angular convention
type(scope): message
Type
Must be one of the following:
build
: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci
: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)docs
: Documentation only changesfeat
: A new featurefix
: A bug fixperf
: A code change that improves performancerefactor
: A code change that neither fixes a bug nor adds a featurestyle
: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)test
: Adding missing tests or correcting existing tests
Scope
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit message
Setup example
git init
git flow init
<config git flow>
git flow feature start init-project
npx nodejs-project-boilerplate
git add . && git commit -m 'build: init project'
git flow feature finish
First release
git flow release start 1.0.0
(or another version)npm run first-release
(for version other than1.0.0
, usenpm run changelog
)git flow release finish
New release example
git flow feature <feature-name> start
<develop and commit your new feature>
git flow feature finish
git flow release start x.y.x
npm run changelog
git flow release finish