Harden update script dependency install flow

This commit is contained in:
Nate Emmert committed 2026-03-10 15:00:45 -04:00
1 parent 85368ba0dc
commit 34986b5760
1 file changed
+12 -2
+12 -2
View File
@@ -12,8 +12,18 @@ echo "📥 Pulling latest code..."
git pull origin main
echo "📦 Installing dependencies..."
rm -rf node_modules package-lock.json
npm ci --only=production 2>&1 | tail -20
rm -rf node_modules
# Prefer deterministic installs with npm ci when lockfile is present.
if [ -f package-lock.json ]; then
if ! npm ci --omit=dev 2>&1 | tail -20; then
echo "npm ci failed, falling back to npm install..."
npm install --omit=dev 2>&1 | tail -20
fi
else
echo "No package-lock.json found, using npm install..."
npm install --omit=dev 2>&1 | tail -20
fi
echo "🔄 Restarting application..."
pm2 restart resource-monitor