Skip to content

Commit

Permalink
feat: add auto update dep hook (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
winchesHe committed Mar 28, 2024
1 parent f78afca commit d58dc42
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
huskyDir=$(dirname -- "$0")
. "$huskyDir/_/husky.sh"

. "$huskyDir/scripts/update-dep"
5 changes: 5 additions & 0 deletions .husky/post-rebase
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
huskyDir=$(dirname -- "$0")
. "$huskyDir/_/husky.sh"

. "$huskyDir/scripts/update-dep"
11 changes: 11 additions & 0 deletions .husky/scripts/update-dep
Original file line number Diff line number Diff line change
@@ -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
echo "Detected changes in pnpm-lock.yaml, starting dependency update"
eval "$2"
fi
}

check_run pnpm-lock.yaml "pnpm install --color"

0 comments on commit d58dc42

Please sign in to comment.