Fix myonlineradio.hu https://github.com/AdguardTeam/AdguardFilters/issues/188445
[Adblock-list-backups-hufilter.git] / .husky / post-merge
blob09f426c80ef9674b4e143e9552aec1b417b0747a
1 #!/usr/bin/env sh
2 . "$(dirname -- "$0")/_/husky.sh"
4 # TODO: Migrate to Husky 9
6 # See https://git-scm.com/docs/githooks#_post_merge
8 # This function checks if a file has changed between the current HEAD and the previous HEAD
9 # Source: https://jshakespeare.com/use-git-hooks-and-husky-to-tell-your-teammates-when-to-run-npm-install
10 function changed {
11 # HEAD@{1} is the original position of HEAD before the merge
12 # HEAD is the new merge commit
13 # --name-only only shows the names of the changed files
14 # grep "^$1" only shows the files that match the first argument
15 git diff --name-only HEAD@{1} HEAD | grep "^$1" > /dev/null 2>&1
18 # If package.json or pnpm-lock.yaml is changed, we should sync local dependencies
19 if changed "package.json" || changed "pnpm-lock.yaml"; then
20 echo "package.json or pnpm-lock.yaml changed, running pnpm install to sync dependencies"
21 pnpm install --force