diff --git a/deploy.sh b/deploy.sh index 9579a9a..ba00aa2 100755 --- a/deploy.sh +++ b/deploy.sh @@ -133,8 +133,30 @@ echo "✅ Directory structure created" # Copy built application echo "📋 Copying application files..." -cp -r dist/* "$WEBROOT/" -echo "✅ Application files copied ($(du -sh dist | cut -f1))" +if [ -d "dist" ] && [ "$(ls -A dist)" ]; then + # Use rsync for better copying, or fallback to cp + if command -v rsync &> /dev/null; then + rsync -av --delete dist/ "$WEBROOT/" + echo "✅ Application files copied via rsync ($(du -sh dist | cut -f1))" + else + # More reliable copy method + cp -r dist/. "$WEBROOT/" + echo "✅ Application files copied via cp ($(du -sh dist | cut -f1))" + fi + + # Verify copy was successful + if [ ! -f "$WEBROOT/index.html" ] && [ ! -d "$WEBROOT/server" ]; then + echo "❌ Error: Application files not properly copied" + echo "🔍 Dist contents: $(ls -la dist/)" + echo "🔍 Webroot contents: $(ls -la $WEBROOT/)" + exit 1 + fi +else + echo "❌ Error: dist/ directory is empty or doesn't exist" + echo "🔍 Current directory: $(pwd)" + echo "🔍 Contents: $(ls -la)" + exit 1 +fi # Copy essential data files echo "🗂️ Setting up data files..."