husky icon indicating copy to clipboard operation
husky copied to clipboard

Subsequent Init runs would clear Husky pre-commit

Open fgrande opened this issue 5 months ago • 1 comments

Hi,

if I run "npx run init" after I've already changed pre-commit file in .husky/pre-commit, I lose my changes, it return to the "npm test"

I would suggest (going to send a PR) to create the pre-commit file only if it doesn't exists (so accidental multiple "npx run init" don't break changes).

Going to move the file creation into the try...catch, adding the flag "wx" (it raise an error if the file already exists)

regards FabioG

fgrande avatar Sep 16 '24 19:09 fgrande