- Added comprehensive SVG validation and fixes in EnhancedGeometry.js - Created SVG_VALIDATION_COMPLETE.md to document validation results and improvements - Developed a quick test guide for all 7 roof types in TEST_ROOF_TYPES_QUICK.md - Summarized test results in TEST_SUMMARY.md, highlighting core functionality and API status - Implemented Playwright tests for roof types API and UI interactions, ensuring all roof types are selectable and functional - Enhanced error handling and accessibility features across the application - Verified successful integration of SVG rendering with React components
85 lines
2.9 KiB
Bash
Executable File
85 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "🚀 Deploying Frontend til Produktion"
|
|
echo "====================================="
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Paths
|
|
FRONTEND_DIR="/mnt/HC_Volume_103713257/tilbudgivern/frontend"
|
|
BUILD_DIR="$FRONTEND_DIR/build"
|
|
PROD_DIR="/var/www/tilbudgivern" # Adjust this to your actual production path
|
|
|
|
echo -e "\n${BLUE}📦 Step 1: Building frontend...${NC}"
|
|
cd $FRONTEND_DIR
|
|
REACT_APP_API_URL=https://tilbudsgiveren.alw.dk CI=false npm run build
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo -e "${RED}❌ Build failed!${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "\n${GREEN}✅ Build successful!${NC}"
|
|
echo " JS: $(du -h $BUILD_DIR/static/js/*.js | awk '{print $1}')"
|
|
echo " CSS: $(du -h $BUILD_DIR/static/css/*.css | awk '{print $1}')"
|
|
|
|
echo -e "\n${BLUE}📋 Step 2: Checking production directory...${NC}"
|
|
|
|
# Check if production directory exists
|
|
if [ ! -d "$PROD_DIR" ]; then
|
|
echo -e "${RED}⚠️ Production directory not found: $PROD_DIR${NC}"
|
|
echo -e "${BLUE}Creating directory...${NC}"
|
|
sudo mkdir -p $PROD_DIR
|
|
sudo chown $USER:$USER $PROD_DIR
|
|
fi
|
|
|
|
echo -e "\n${BLUE}🔄 Step 3: Backing up current production...${NC}"
|
|
if [ -d "$PROD_DIR/backup" ]; then
|
|
sudo rm -rf $PROD_DIR/backup
|
|
fi
|
|
if [ -d "$PROD_DIR/index.html" ] || [ -d "$PROD_DIR/static" ]; then
|
|
sudo mkdir -p $PROD_DIR/backup
|
|
sudo cp -r $PROD_DIR/* $PROD_DIR/backup/ 2>/dev/null || true
|
|
echo -e "${GREEN}✅ Backup created${NC}"
|
|
fi
|
|
|
|
echo -e "\n${BLUE}📤 Step 4: Deploying new build...${NC}"
|
|
sudo rm -rf $PROD_DIR/static $PROD_DIR/*.html $PROD_DIR/*.json $PROD_DIR/*.ico $PROD_DIR/*.svg $PROD_DIR/*.txt
|
|
sudo cp -r $BUILD_DIR/* $PROD_DIR/
|
|
sudo chown -R www-data:www-data $PROD_DIR 2>/dev/null || sudo chown -R nginx:nginx $PROD_DIR 2>/dev/null || true
|
|
|
|
echo -e "${GREEN}✅ Files copied to production${NC}"
|
|
|
|
echo -e "\n${BLUE}🔄 Step 5: Restarting web server...${NC}"
|
|
|
|
# Try to detect and restart the web server
|
|
if systemctl is-active --quiet nginx; then
|
|
sudo systemctl reload nginx
|
|
echo -e "${GREEN}✅ Nginx reloaded${NC}"
|
|
elif systemctl is-active --quiet apache2; then
|
|
sudo systemctl reload apache2
|
|
echo -e "${GREEN}✅ Apache reloaded${NC}"
|
|
elif systemctl is-active --quiet httpd; then
|
|
sudo systemctl reload httpd
|
|
echo -e "${GREEN}✅ Apache (httpd) reloaded${NC}"
|
|
else
|
|
echo -e "${RED}⚠️ Could not detect web server${NC}"
|
|
echo " You may need to manually restart your web server"
|
|
fi
|
|
|
|
echo -e "\n${GREEN}🎉 DEPLOYMENT COMPLETE!${NC}"
|
|
echo "====================================="
|
|
echo ""
|
|
echo "📊 New CSS file: main.c2326ed4.css"
|
|
echo "🌐 Visit your site and hard refresh (Ctrl+F5) to see changes"
|
|
echo ""
|
|
echo "If changes don't appear:"
|
|
echo " 1. Clear browser cache (Ctrl+Shift+Delete)"
|
|
echo " 2. Hard refresh (Ctrl+F5 or Cmd+Shift+R)"
|
|
echo " 3. Check: curl -I https://tilbudsgiveren.alw.dk/static/css/main.c2326ed4.css"
|
|
echo ""
|