Reputation: 693
I'd like to implement a husky rule so as to make it run yarn build
and make sure that what's going to be pushed won't break the app.
I've browsed the web, but still not sure if the following is the correct way to do it?
"husky": {
"hooks": {
"pre-commit": "cross-env lint-staged",
"pre-push": "cross-env lint-staged yarn build"
}
},
Upvotes: 3
Views: 2374
Reputation: 879
The values assigned to pre-commit
and pre-push
should be the commands as if they were being run straight from the command line. In this case cross-env lint-staged yarn build
will be run as one command before pushing. (Haven't used yarn so I'm not sure if that's right.)
Multiple commands can be chained together as follows:
"pre-commit": "command1 arg1 arg2 && command2"
Upvotes: 3