#!/bin/sh changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" if echo "$changed_files" | grep --quiet -E "package.json|package-lock.json"; then echo "📦 Dependencies changed. Syncing..." # --no-progress stops the terminal spam # --loglevel error ensures we only see the bad stuff if npm install --no-progress --loglevel error; then echo "✅ Node modules are up to date." else echo "❌ npm install failed! Please check your connection or package.json." exit 1 fi fi