Collection of tools and configurations used for development and release of @mmpzet projects
To install the package run
npm install --save-dev @mmpzet/contribution-tools
Install it in your project using
npm install --save-dev commitlint
and add the following configuration to your package.json
"commitlint": {
"extends": [
"@mmpzet/contribution-tools/commitlint"
]
}
In order to lint efficiently we use lint-staged that lints only the currently git staged files.
Install it in your project using
npm install --save-dev lint-staged
and add the following configuration to your package.json
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
}
To setup and manage git hooks we use husky.
Install it in your project using
npm install --save-dev husky
and add the following configuration to your package.json
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged",
"pre-push": "npm run test"
}
}
To easily write commit message that follow the guidelines we use commitizen
Install it globally using
npm i -g commitizen
and configure it for the current project by executing
commitizen init @mmpzet/contribution-tools/commitizen --save-exact
To release we use semantic-release that takes care of bumping the package version according to the semantic of the commits and of generating and publishing the release changelog.
Install it in your project using
npm install --save-dev semantic-release
and add the following configuration to your package.json
"release": {
"extends": "@mmpzet/contribution-tools/semantic-release"
},
"repository": {
"type": "git",
"url": "<path to your project https git url>"
}
run
npm i -g commitizen
npm install --save-dev semantic-release commitlint lint-staged husky @mmpzet/contribution-tools
commitizen init @mmpzet/contribution-tools/commitizen --save-exact
and add the following to your package.json
"release": {
"extends": "@mmpzet/contribution-tools/semantic-release"
},
"repository": {
"type": "git",
"url": "<path to your project https git url>"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged",
"pre-push": "npm run test"
}
},
"commitlint": {
"extends": [
"@mmpzet/contribution-tools/commitlint"
]
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
}