Husky
Husky permit execute scripts during some actions of git
Git Hooks
| Hook | Actions |
|---|---|
| pre-commit | - Commit - Amend - Merge Resolve |
| prepare-commit-msg | – Commit – Amend – Cherrypick – Merge – Squash – Revert |
| commit-msg | – Commit – Amend – Merge Resolve |
| post-commit | – Commit – Amend – Cherrypick – Merge Resolve – Revert |
| pre-rebase | – Rebase – Squash |
| post-checkout | – Checkout – Discard Changes (selectively) |
| post-merge | – Merge (Without Conflicts) – Fast-Forward |
| post-rewrite | – Amend – Squash – Rebase |
| pre-push | – Push Branch – Push Tag – Delete Remote Branch – Delete Remote Tag |
Installation
npm i husky -D
In file commit-msg inside of folder husky
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx commitlint --edit $1
In file pre-commit inside of folder husky
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx nx lint --project=example-api