You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the feedback 🙂 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:
adding shebang
adding code to source husky code
setting correct permission
... and finally adding 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.
Troubleshoot
https://typicode.github.io/husky/troubleshoot.html
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 experiencenode --eval "fs.writeFileSync('.husky/pre-commit','npm test\n')"
should work for any shell, maybe worth to update?
Context: prettier/prettier#16000 (comment)
The text was updated successfully, but these errors were encountered: