Harden update script dependency install flow
This commit is contained in:
1 parent
85368ba0dc
commit
34986b5760
1 file changed
+12
-2
+12
-2
@@ -12,8 +12,18 @@ echo "📥 Pulling latest code..."
|
|||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
echo "📦 Installing dependencies..."
|
echo "📦 Installing dependencies..."
|
||||||
rm -rf node_modules package-lock.json
|
rm -rf node_modules
|
||||||
npm ci --only=production 2>&1 | tail -20
|
|
||||||
|
# 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..."
|
echo "🔄 Restarting application..."
|
||||||
pm2 restart resource-monitor
|
pm2 restart resource-monitor
|
||||||
|
|||||||
Reference in new issue
Block a user