Skip to content

Commit 0cb76de

Browse files
authored
feat: run yarn install only when pkg.json has changes (#534)
Added a condition in post-merge hook to check if any change is detected in - package.json - .yarn/* - yarn.lock not to run `yarn install` on every git pull cmd.
1 parent 60fba6a commit 0cb76de

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.husky/post-merge

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/bin/bash
22

3-
# Install dependencies
4-
yarn install
3+
declare -a FILES=("package.json" "yarn.lock" ".yarn/")
4+
5+
# Run yarn install only when there's any change in the above listed files
6+
if git diff-tree --name-only --no-commit-id ORIG_HEAD HEAD | grep -E $(IFS="|" ; echo "${FILES[*]}"); then
7+
echo "package.json or yarn config has been changed, running yarn install..."
8+
yarn install
9+
fi

0 commit comments

Comments
 (0)