I'm setting up a node project with husky
and I want to have a git-hook script run manually, without having to trigger it in git.
Example:
My package.json has the following:
{
...
"scripts": {
"precommit": // something goes here
}
...
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
...
}
If I run npm run precommit
, the lint-staged
hook step runs, WITHOUT the commit actually occurring in git.
Is this possible?
lint-staged
command,"precommit": "lint-staged"
– Coprologybash .git/hooks/pre-commit
) – Zephyrusnpx lint-staged
works for me. – Catechetical