Hey i want to add a script to my package.json
but don't want to check in this addition to our git because it affects the behaviour of the project for my colleagues.
The script i want to add is a precommit-Hook which is handled by husky. Is there a possibility to have something like a package.override.json where i define the script and ignore the file in .gitignore or are there different approaches?
I can think of two solutions without using husky
:
You can set up your own git hooks directly in the .git/hooks
folder of your local repository. See https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks for information on how to do that.
If that doesn't work out you and you're running a *nix OS, can always write your own commit alias using bash. Add something like
alias commit="npm run test && git commit"
to your ~/.bashrc
file.
(Of course, the ideal is to convince your colleagues of the value husky provides.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.