Closed fisker closed 3 months ago
Thanks for the feedback :slightly_smiling_face: you're right about it not working on Windows.
I've updated the changelog so that This can be accomplished using your favorite editor, a script or a basic echo command
is closer to the v9
example. I've also added that it's for Linux/macOS.
The idea with v9 update is that you don't need a special command anymore. That's what I wanted to showcase with echo 'npm test' > .husky/pre-commit
.
Previously, npx husky add .husky/pre-commit "npm test"
was kind of necessary since hooks were more complex.
For reference,it was doing the following to the hook file:
npm test
Now, just creating a file with the hook code is sufficient. Most users will probably use their code editor like they do for editing their other config files.
I feel that node --eval "fs.writeFileSync('.husky/pre-commit','npm test\n')"
could confuse beginners that aren't familiar with fs
API or they may end up relying on it to change hook.
I just saw that it's consistent with the way prettier config is installed, you can forget about my last comment :)
Troubleshoot
If you're migrating from husky 4, see: https://typicode.github.io/husky/migrate-from-v4.html
Context Please describe your issue and provide some context:
Thank you!
In v9 release note,
is suggested to use, but it should not work on
cmd.exe
, in my experienceshould work for any shell, maybe worth to update?
Context: https://github.com/prettier/prettier/pull/16000#discussion_r1477057609