Last active
January 31, 2023 05:50
-
-
Save leothorp/79cf50b4bddf0b6d4299867df7bf7a1c to your computer and use it in GitHub Desktop.
Husky post-merge hook: auto-update pnpm packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
. "$(dirname "$0")/_/husky.sh" | |
# navigate to parent of husky dir- we assume pnpm-lock is located there. | |
cd "$(dirname $0)/.." | |
LOCKFILE_CHANGED_LINES=`git diff HEAD@{1} --stat -- pnpm-lock.yaml | wc -l` | |
if [ -z "${CI}" ] && [ $LOCKFILE_CHANGED_LINES -gt 0 ]; | |
then | |
echo "Detected changes to lockfile. Reinstalling packages..." | |
pnpm i | |
fi | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment