fxa/_scripts/git-merge-hook.sh
Danny Coates e6f60d2880
feat(dev): added post-checkout/merge git hooks to keep deps in sync
It's easy to not notice when to run a `yarn install` either
when switching branches or doing a git pull. This adds a
hook to diff your previous yarn.lock with the one your changing
to, and if there's changes running 'yarn install' for you.
2020-05-26 16:13:14 -07:00

12 lines
388 B
Bash
Executable File

#!/bin/bash
if [[ "$FXA_AUTO_INSTALL" == 0 ]] || git diff --quiet ORIG_HEAD HEAD yarn.lock; then
exit 0
elif [[ "$FXA_AUTO_INSTALL" == 1 ]]; then
echo "yarn.lock changed, running 'yarn install'"
yarn install
else
echo -e "\nyarn.lock changed. You may want to run 'yarn install'.\n"
echo -e "To auto install next time set FXA_AUTO_INSTALL=1 or to 0 to disable this check.\n"
fi