From 7c9ba798ed62c486ecf50e6cb946bedcbb5a1ef0 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Thu, 16 Oct 2025 15:38:12 +0000 Subject: [PATCH] Update deployment script to use npm commands for builds Modify deploy.sh to utilize `npm run build` and `npm run db:push` for frontend builds and database migrations, and simplify PM2 process management. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 42d8028a-fa71-4ec2-938c-e43eedf7df01 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/42d8028a-fa71-4ec2-938c-e43eedf7df01/AwjfjCW --- deploy/deploy.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index bcb0786..8b8f961 100644 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -58,11 +58,11 @@ npm ci # Build frontend echo "🏗️ Build frontend Vite..." export NODE_ENV=production -./node_modules/.bin/vite build && ./node_modules/.bin/esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist +npm run build # Database migrations (serve Drizzle che è devDependency) echo "🗄️ Verifica database schema..." -./node_modules/.bin/drizzle-kit push --force || echo "⚠️ Schema push skipped (database già aggiornato)" +npm run db:push || echo "⚠️ Schema push skipped (database già aggiornato)" # NOTA: NON facciamo npm prune perché Vite serve a runtime per il middleware # Il server Express usa Vite per servire il frontend anche in produzione @@ -91,12 +91,8 @@ if $PM2_CMD show $APP_NAME > /dev/null 2>&1; then $PM2_CMD delete $APP_NAME fi -# Usa ecosystem.config.js se esiste, altrimenti comando diretto -if [ -f ecosystem.config.js ]; then - $PM2_CMD start ecosystem.config.js -else - $PM2_CMD start npm --name $APP_NAME -- start -fi +# Start con comando diretto (più affidabile) +$PM2_CMD start npm --name $APP_NAME -- start $PM2_CMD save # Health check