toplenboren / simple-git-hooks

A simple git hooks manager for small projects
MIT License
1.32k stars 43 forks source link

Auto-update on commit #73

Open flugg opened 2 years ago

flugg commented 2 years ago

Hello, great project @toplenboren! Just migrated from Husky myself and have to say this project works in a much more elegant fashion DX-wise.

Inspired by https://github.com/toplenboren/simple-git-hooks/issues/34 I've added built-in support for auto-updating the hooks on commit. It's tested this with both npm and Yarn. In addition, it should not break anything for people who already added the update script to the pre-commit hook, but in these cases it will run the simple-git-hooks command twice.

This all works by running a simple-git-hooks command instead of the user-specified pre-commit command. This command uses both a silent option so the user's terminal isn't bloated with messages when updating the hooks, and an auto option which executes the configured pre-commit.

Would love to hear what you think!

Edit: It should probably be mentioned in the release notes/upgrade guide that you need to run the simple-git-hooks once with the new version before the automation kicks in.

toplenboren commented 2 years ago

Hi, please check the tests :) it seems, that something is off

Let me know If I can be of help

JounQin commented 2 years ago

I think a custom prepare/postinstall script is just the solution, no need to contaminate the current codes.

Of course, a new silent option is great to me, at least personally.