Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subsequent Init runs would clear Husky pre-commit #1520

Open
fgrande opened this issue Sep 16, 2024 · 4 comments
Open

Subsequent Init runs would clear Husky pre-commit #1520

fgrande opened this issue Sep 16, 2024 · 4 comments

Comments

@fgrande
Copy link

fgrande commented Sep 16, 2024

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

@Munaf-Divan
Copy link

I have a similar requirement. I want my existing pre-commit to remain unchanged while I run npx husky init.

@kaspar-p
Copy link

+1. Deprecating install and replacing it with something that does not do what install did is annoying.

@typicode
Copy link
Owner

Init should be run only once. You can do the setup manually also.

@fgrande
Copy link
Author

fgrande commented Oct 31, 2024

@typicode It "should" be run only once. But what if a dev runs it again, after changes on pre-commit file ? That's the meaning of my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants