npm

Need private packages and team management tools?Check out npm Orgs. »

husky

0.15.0-rc.1 • Public • Published

husky npm version Mac/Linux Build Status Windows Build status

Git hooks made easy

Husky can prevent bad git commit, git push and more 🐶 woof!

Install

npm install husky@next --save-dev
// package.json
{
  "husky": {
    "hooks": {
      "pre-commit": "npm test",
      "pre-push": "npm test",
      "...": "..."
    }
  }
}
git commit -m 'Keep calm and commit'

By default, husky expects your project's package.json and your .git directory to be at the same level. It can be configured to support monorepos or sub-directories.

Check documentation for more.

Uninstall

npm uninstall husky

Upgrading from 0.14

If you're upgrading from 0.14, simply move your hooks to husky.hooks:

{
  "scripts": {
-   "precommit": "npm test"
  },
+ "husky": {
+   "hooks": {
+     "pre-commit": "npm test"
+   }
+ }
}

Or run the following command which will do the same automatically for you ;)

./node_modules/.bin/husky-upgrade

Alternatively, you can also use any of the files/formats that are supported by cosmiconfig. This means that you can place your husky hooks config in a .huskyrc file or export them from a husky.config.js file as well. Cosmiconfig supports js, json, and yaml file formats.

Features

  • Keeps existing user hooks
  • Supports GUI Git clients
  • Supports all Git hooks (pre-commit, pre-push, ...)
  • Auto-migrates Git hooks installed by ghooks

Used by

See also

License

MIT - Typicode 🌵 - Patreon

install

npm i husky

Downloadsweekly downloads

2,057,630

version

0.15.0-rc.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability