Skip to content

Angular GIT hooks

Vojtech Mašek edited this page Jan 30, 2020 · 5 revisions

Collection of our GIT hooks

To set up automatic GIT hooks triggered by commits, pushes, etc. (which can be effectively managed and enforced upstream)

Important: make sure you have all set up for the Prettier already in your project

Add this to your package.json

  "husky": {
    "hooks": {
      "pre-commit": "pretty-quick --staged",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "pre-push": "npm run lint && npm run test"
    }
  }

Install all needed packages npm i --save-dev husky @commitlint/cli @commitlint/config-conventional

Finally, add a commitlint.config.js file to project root with the following content:

module.exports = {
  extends: ['@commitlint/config-conventional'],
};
Clone this wiki locally