simple-git-hooks icon indicating copy to clipboard operation
simple-git-hooks copied to clipboard

Auto-update on commit

Open flugg opened this issue 3 years ago • 2 comments

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.

flugg avatar Apr 04 '22 14:04 flugg

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

Let me know If I can be of help

toplenboren avatar May 28 '22 20:05 toplenboren

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.

JounQin avatar Aug 12 '22 02:08 JounQin