From 75912d7ed3bd68282b763f5354a7abab3e69c30f Mon Sep 17 00:00:00 2001 From: NADAL Jean-Baptiste Date: Fri, 27 Feb 2026 12:25:57 +0100 Subject: [PATCH] fix: deploy script uses temp dir and includes frontend in zip --- deploy/deploy.sh | 51 +++++++++++-------- partitions/src/routes/admin/[id]/+page.svelte | 3 +- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 7175c1d..ed10adb 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -8,43 +8,54 @@ cd /home/jbnadal/sources/jb/ohmj/ohmj2 echo "=== OHMJ Deploy Script ===" -# 1. Remove old zip -echo "[1/7] Removing old zip..." -rm -f _builds/deploy_ohmj.zip +# Create temp directory for deploy +DEPLOY_DIR="_deploy_temp" +rm -rf $DEPLOY_DIR +mkdir -p $DEPLOY_DIR + +# 1. Copy source files +echo "[1/8] Copying source files..." +cp -r api $DEPLOY_DIR/ +cp -r partitions $DEPLOY_DIR/ +cp -r deploy $DEPLOY_DIR/ # 2. Generate JWT_SECRET -echo "[2/7] Generating JWT_SECRET..." +echo "[2/8] Generating JWT_SECRET..." JWT_SECRET=$(openssl rand -base64 32) -echo "JWT_SECRET=$JWT_SECRET" > api/.env -echo "SCORES_PATH=/data/scores/" >> api/.env +echo "JWT_SECRET=$JWT_SECRET" > $DEPLOY_DIR/api/.env +echo "SCORES_PATH=/data/scores/" >> $DEPLOY_DIR/api/.env # 3. Set production API URL in frontend .env -echo "[3/7] Setting production API URL..." -echo "VITE_API_URL=https://ohmj-api.c.nadal-fr.com" > partitions/.env +echo "[3/8] Setting production API URL..." +echo "VITE_API_URL=https://ohmj-api.c.nadal-fr.com" > $DEPLOY_DIR/partitions/.env # 4. Clean and build frontend -echo "[4/7] Cleaning and building frontend..." -cd partitions +echo "[4/8] Cleaning and building frontend..." +cd $DEPLOY_DIR/partitions rm -rf build npm run build # Copy .mjs to .js for correct MIME type cp build/pdf.worker.min.mjs build/pdf.worker.min.js 2>/dev/null || echo "pdf.worker.min.mjs not found" -cd .. +cd ../.. -# 5. Create symlink for frontend directory -echo "[5/7] Creating frontend symlink..." -rm -f frontend -ln -sfn partitions/build frontend +# 5. Copy built frontend as 'frontend' directory (not symlink, for zip compatibility) +echo "[5/8] Copying built frontend..." +cp -r $DEPLOY_DIR/partitions/build $DEPLOY_DIR/frontend # 6. Copy nginx config to frontend -echo "[6/7] Adding nginx config..." -mkdir -p partitions/build -cp /home/jbnadal/sources/jb/ohmj/ohmj2/partitions/nginx.conf partitions/build/nginx.conf 2>/dev/null || echo "nginx.conf not found in partitions/" +echo "[6/8] Adding nginx config..." +cp partitions/nginx.conf $DEPLOY_DIR/frontend/nginx.conf 2>/dev/null || echo "nginx.conf not found" # 7. Create zip (without tests.php and legacy) -echo "[7/7] Creating zip..." -zip -r _builds/deploy_ohmj.zip api frontend -x "*.DS_Store" "node_modules/*" ".svelte-kit/*" "api/tests.php" +echo "[7/8] Creating zip..." +cd $DEPLOY_DIR +zip -r ../_builds/deploy_ohmj.zip api frontend -x "*.DS_Store" "node_modules/*" ".svelte-kit/*" "api/tests.php" + +# 8. Cleanup +echo "[8/8] Cleaning up..." +cd .. +rm -rf $DEPLOY_DIR echo "=== Done! ===" echo "Zip created: _builds/deploy_ohmj.zip" diff --git a/partitions/src/routes/admin/[id]/+page.svelte b/partitions/src/routes/admin/[id]/+page.svelte index cde8f3e..5774462 100644 --- a/partitions/src/routes/admin/[id]/+page.svelte +++ b/partitions/src/routes/admin/[id]/+page.svelte @@ -26,7 +26,8 @@ { code: 'cba', name: 'Contrebasse', defaultKey: 'sib' }, { code: 'per', name: 'Percussions', defaultKey: '' }, { code: 'pia', name: 'Piano', defaultKey: '' }, - { code: 'har', name: 'Harpe', defaultKey: '' } + { code: 'har', name: 'Harpe', defaultKey: '' }, + { code: 'sup', name: 'Parties supplémentaires', defaultKey: '' } ]; let scoreId = $derived($page.params.id || '');