Check is pre-commit existed: npm

27 Views Asked by At

I have a script in package.json:

"prepare": "husky install && npx husky add .husky/pre-commit \"npx lint-staged\""

But each time I run npm i, new npx lint-staged create in pre-commit file.

If I run 3 times:

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
npx lint-staged
npx lint-staged

How can I prevent it?

0

There are 0 best solutions below