DEV Community

Cover image for What's new in husky 5

Posted on • Updated on • Originally published at

What's new in husky 5

I'm happy to announce the release of husky 5 🎉 🐺 woof!

During the past years, husky has grown in complexity. With this version, I wanted to go back to something simpler, more flexible and closer to the metal.

You can use husky 5 in your Open Source projects today.

Thanks for your support and feedback. I hope you'll enjoy this release <3

Faster and smaller

Husky 5 is closer to Git and has a lot less abstractions. It makes it not only simpler to understand but also very fast and small with zero dependencies.

Time spent to run a simple echo "hello world" pre-commit hook:

husky 4: ~0.50s
husky 5: ~0.01s
Enter fullscreen mode Exit fullscreen mode

Installation size with dependencies:

husky 4: ~1.00MB with 47 packages
husky 5: ~0.02MB with  0 packages
Enter fullscreen mode Exit fullscreen mode

Optional install

With husky 4, hooks were automatically installed. With husky 5, you have the choice and it's explicit.

You can keep the previous behaviour (recommended) by adding a postinstall script:

// package.json
  "private": true,
  "scripts": {
    "postinstall": "husky install"
Enter fullscreen mode Exit fullscreen mode

If you prefer to manually install husky, omit the above postinstall script and just run in your terminal:

# Manual install
$ npx husky install
$ yarn husky install
Enter fullscreen mode Exit fullscreen mode


Previously, hooks were defined in package.json or .huskyrc. Now they're defined directly in their corresponding hook file. Overhead is reduced and scripting is easier.

# .husky/pre-commit
# ...
yarn lint-staged
Enter fullscreen mode Exit fullscreen mode

They can also be put in any subdirectory. For example in .config:

# .config/husky/pre-commit
$ husky install .config/husky
$ husky add .config/husky/pre-commit "npm test"
Enter fullscreen mode Exit fullscreen mode

How to migrate

A new doc site has been created with a dedicated section to migrating hooks from husky 4 to 5:

If you have many projects using husky 4, you can use husky-4-to-5 CLI to do it automatically:

There are some caveats so just copying your previous config may not work.


For a limited time, husky 5 will be released under License Zero's Parity License. It will be MIT again later.

Free for Open Source ❤️

The Parity License is an Open Source friendly license.

So if you're using husky in an Open Source project, this new license doesn't affect you.

You're free to use husky 5 today and I'm glad if it can help you in your day to day work.

Early access for Sponsors 🎁

If you're using husky in a commercial project, your support would be extremely helpful (husky 5 is free to try for 30 days).

That said, if your company can't or don't want to sponsor, that's perfectly fine too. Husky 4 remains free to use in any project and will continue to receive maintainance updates.

You can become a sponsor on GitHub Sponsors or Open Collective.


Thanks to everyone who has sponsored me, I'm sincerely grateful!

I also have other ideas for husky and projects. If you're a sponsor, you'll be the first to know about them :)

Photo by Andriyko Podilnyk on unsplash

Top comments (14)

lukeshiru profile image
Luke Shiru • Edited

About the migration, I don't understand the reasoning behind changing the way the configuration works now. Previously I was able to just do run-s foo bar (using npm-run-all) on husky's configuration, and that worked with npm, yarn, and pnpm.

Now I have to create a new file for every hook, in a new folder, and I have to specify either npm/npx, or pnpm/pnpx, or yarn... so I can't be "package manager agnostic".

Maybe the reason is related to performance, but I feel that performance is at the cost of flexibility and file clutter.

medikoo profile image
Mariusz Nowak

I totally agree. Having hooks configured in package.json was very straightforward.

Technically it was zero extra files config (as package.json stays in project anyway).

Now it's totally not clear to me where config should live, and polluting repo with extra config files doesn't feel good.

berkmann18 profile image
Maximilian Berkmann

Yeah, the ease of setting up hooks with husky+lint staged is a nightmare now when they used to be a breeze to set up.

lukeshiru profile image
Luke Shiru

My solution for now is to keep using v4 until maybe v6 or an alternative package similar to v4 is available.

Thread Thread
kutsan profile image
Kutsan Kaplan • Edited

I'm in the same boat, looking for an alternative for the time being. Actually, I've never had any problems about husky so far, their configuration interface was superb but now it tries to solve a problem that doesn't exist.

matteogioioso profile image
Matteo Gioioso

I went back to v4 once I have discover that

mpeyper profile image
Michael Peyper • Edited

I want to be clear that I 100% support the move to the new license and the financial support that hopefully brings to you. husky is a wonderful tool and has saved my bacon many times.

That said, did you consider not releasing it with the latest tag on NPM and having something like oss and/or sponsored tags instead for v5 and keeping latest pointing at v4? I wonder how many folks have run npm i -D husky or had dependabot come through and bumped their version and not realised they are up for sponsorship now.

alevosia profile image

Exactly. Broke plenty of projects. Plenty of open source projects have a commit of just rolling/reverting back husky to v4.

jounqin profile image

Like others, I have to say

now it tries to solve a problem that doesn't exist.

husky@4 works very nice and easy to use, but v5 is much more difficult to understand and config.

I think you should balance between performance and easy-to-use.

I can't wait to use v6 now. 🤪

rxliuli profile image
rxliuli • Edited

Roll back to v4

joellau profile image
Joel Lau

thanks sharing your work with the world!

ethaan profile image

postinstall => prepare v5.1.2

darcyxf profile image

Withhout writing precommit file to .git/hooks, how new husky now works?

Some comments may only be visible to logged-in visitors. Sign in to view all comments.