It runs commands of your choice at specific times. For example, if you wanted to run your linter right before your commit and your test suite right before you push, you would add in your package.json something like this:
"scripts":{"precommit":"npm run lint","prepush":"npm run test","lint":// your linter command,"test":// your test command}
If your linter fails, your commit fails. If your test suite fails, your push fails ( in this example ). You can use any git hooks you wish.
That's a good question. I actually never tried. I suppose whatever you can run inside package.json can be used with husky. Here is a list of hooks supported if you are interested by that
Husky does really facilitate creating git hooks. I prefer linting the code before committing, so for those who want to lint on precommit git hook digitalfortress.tech/tricks/lint-o...
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
Only one gotcha. If you've already installed the husky package at least once, you will need to run yarn --force or npm install --no-cache. For some reason the post-install script of husky does not run, when the package is pulled from yarn's or npm's cache.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This looks interesting, but I'm not 100% sure I follow follow what it does based on the readme. Can you explain this like I'm five?
It runs commands of your choice at specific times. For example, if you wanted to run your linter right before your commit and your test suite right before you push, you would add in your package.json something like this:
If your linter fails, your commit fails. If your test suite fails, your push fails ( in this example ). You can use any git hooks you wish.
And it can run other commands, not just npm environment-related ones?
That's a good question. I actually never tried. I suppose whatever you can run inside package.json can be used with husky. Here is a list of hooks supported if you are interested by that
Yeah it does, just did a quick test:
Not going to keep rails test before each commit obviously but we now know it works :D
Very cool! Thank you!
Husky does really facilitate creating git hooks. I prefer linting the code before committing, so for those who want to lint on precommit git hook digitalfortress.tech/tricks/lint-o...
You can run anything.
lint-staged
compliments this package very well. Here's an example, github.com/nickytonline/generator-...Only one gotcha. If you've already installed the husky package at least once, you will need to run
yarn --force
ornpm install --no-cache
. For some reason the post-install script of husky does not run, when the package is pulled from yarn's or npm's cache.