-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore: review commit hooks #1345
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @stephenkilbourn ! Both pre-commit and pre-push hook are working for me now 🎉
This will also close #1263 !
@@ -25,6 +25,7 @@ | |||
"lint": "yarn lint:scripts && yarn lint:css", | |||
"lint:scripts": "eslint app/scripts/", | |||
"lint:css": "stylelint 'app/styles/**/**' 'app/scripts/**/*.(js|ts|tsx|jsx)'", | |||
"postinstall": "husky", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will run after the install of veda-ui as a registry, which we don't want it. Do we need this @stephenkilbourn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hanbyul-here - ah, I didn't realize that was going to be a consideration. Looking further at the husky docs for the setup of yarn, we need that postinstall setup, but we also need to disable it before and after the npm publish setup:
{
"scripts": {
// Yarn doesn't support prepare script
"postinstall": "husky",
// Include this if publishing to npmjs.com
"prepack": "pinst --disable",
"postpack": "pinst --enable"
}
}
i'm adding those in a follow-up PR here: #1384
Related Ticket: Close #1329
Description of Changes
It seems that there are some changes in both Husky and Yarn in how to make them play nicely together. Husky needs to be run once for each user before the package begins enforcing the git hooks. When it does that, you should see a new directory
.husky/_
. Fornpm
this is done through a prepare script. Yarn doesn't support this, so Husky recommends apostinstall
script. https://typicode.github.io/husky/how-to.html#manual-setupI've added that script, as well as added a pre-push hook to run the type check and unit tests. That's easy to remove if contributors prefer pushing separate commits to fix/add tests, though.