Files
AdguardFilters/.husky/post-merge
David b9b379022a Migrate from Yarn to npm package manager and update AGLint to v3 (#205942)
* migrate from Yarn to npm package manager and update dependencies

* update CODEOWNERS file with new ownership assignments and reorder entries
2025-05-21 18:25:57 +03:00

18 lines
840 B
Plaintext
Executable File

# See https://git-scm.com/docs/githooks#_post_merge
# This function checks if a file has changed between the current HEAD and the previous HEAD
# Source: https://jshakespeare.com/use-git-hooks-and-husky-to-tell-your-teammates-when-to-run-npm-install
function changed {
# HEAD@{1} is the original position of HEAD before the merge
# HEAD is the new merge commit
# --name-only only shows the names of the changed files
# grep "^$1" only shows the files that match the first argument
git diff --name-only HEAD@{1} HEAD | grep "^$1" > /dev/null 2>&1
}
# If package.json or package-lock.json is changed, we should sync local dependencies
if changed "package.json" || changed "package-lock.json"; then
echo "package.json or package-lock.json changed, running npm install to sync dependencies"
npm install --force
fi