feat: add git hook to auto update dependencies (#3365)

* feat: add git hook to auto update dependencies

* feat: update color
This commit is contained in:
winches 2024-10-29 00:39:34 +08:00 committed by GitHub
parent 1c1fd39d37
commit 5ac433a905
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

5
.husky/post-merge Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
huskyDir=$(dirname -- "$0")
. "$huskyDir/_/husky.sh"
. "$huskyDir/scripts/update-dep"

5
.husky/post-rebase Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
huskyDir=$(dirname -- "$0")
. "$huskyDir/_/husky.sh"
. "$huskyDir/scripts/update-dep"

11
.husky/scripts/update-dep Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
if (echo "$changed_files" | grep --quiet "$1"); then
printf "\033[36mDetected changes in pnpm-lock.yaml, starting dependency update\033[0m\n"
eval "$2"
fi
}
check_run pnpm-lock.yaml "pnpm install --color"