From b1e168b20781fd0e480dc682b8a90e22ab47bf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mime=20=C4=8Cuvalo?= Date: Wed, 28 Feb 2024 10:50:48 +0000 Subject: [PATCH] tooling: notify team members if package.json/yarn has been updated (#2972) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a team tooling thing to let each other know if `yarn` needs to be run upon checkout of a branch. ### Change Type - [x] `internal` — Any other changes that don't affect the published package[^2] --- .husky/post-checkout | 13 ++++++++++++- .husky/post-merge | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .husky/post-merge diff --git a/.husky/post-checkout b/.husky/post-checkout index 2cbb3d818..2ff91172d 100755 --- a/.husky/post-checkout +++ b/.husky/post-checkout @@ -1,4 +1,15 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -rm -rf *.tsbuildinfo */*.tsbuildinfo */*/*.tsbuildinfo */*/*/*.tsbuildinfo */*/*/*/*.tsbuildinfo \ No newline at end of file +set -e + +rm -rf *.tsbuildinfo */*.tsbuildinfo */*/*.tsbuildinfo */*/*/*.tsbuildinfo */*/*/*/*.tsbuildinfo + +# This notifies the user if the yarn.lock file has changed. +CHANGED=$(git diff "$1" "$2" --stat -- ./yarn.lock | wc -l) +if (( CHANGED > 0 )); then + echo + echo "🚨 🚨 🚨 yarn.lock has changed! 🚨 🚨 🚨 " + echo "run 'yarn' to get the latest!" + echo +fi diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100644 index 000000000..d24df7600 --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1,13 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +set -e + +# This notifies the user if the yarn.lock file has changed. +CHANGED=$(git diff HEAD@{1} --stat -- ./yarn.lock | wc -l) +if (( CHANGED > 0 )); then + echo + echo "🚨 🚨 🚨 yarn.lock has changed! 🚨 🚨 🚨 " + echo "run 'yarn' to get the latest!" + echo +fi