Files
maternal-app/pre-deploy-check.sh
Andrei c22fa82521
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
feat: Implement comprehensive error handling and production deployment pipeline
## Error Handling System
- Add centralized error handling utilities (errorHandler.ts)
- Create reusable error components (ErrorMessage, ErrorToast)
- Implement multilingual error support (preserves backend error messages in 5 languages)
- Update 15+ forms and components with consistent error handling
  - Auth forms: login, register, forgot-password
  - Family management: family page, join family dialog
  - Child management: child dialog
  - All tracking forms: feeding, sleep, diaper, medicine, growth, activity

## Production Build Fixes
- Fix backend TypeScript errors: InviteCode.uses → InviteCode.useCount (5 instances)
- Remove non-existent savedFamily variable from registration response
- Fix admin panel TypeScript errors: SimpleMDE toolbar type, PieChart label type

## User Experience Improvements
- Auto-uppercase invite code and share code inputs
- Visual feedback for case conversion with helper text
- Improved form validation with error codes

## CI/CD Pipeline
- Create comprehensive production deployment checklist (PRODUCTION_DEPLOYMENT_CHECKLIST.md)
- Add automated pre-deployment check script (pre-deploy-check.sh)
  - Validates frontend, backend, and admin panel builds
  - Checks git status, branch, and sync state
  - Verifies environment files and migrations
- Add quick start deployment guide (DEPLOYMENT_QUICK_START.md)
- Add production deployment automation template (deploy-production.sh)

## Cleanup
- Remove outdated push notifications documentation files
- Remove outdated PWA implementation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 21:27:39 +00:00

147 lines
3.9 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -e
echo "======================================"
echo "🔍 Pre-Deployment Checks"
echo "======================================"
ERRORS=0
# Check 1: Frontend build
echo ""
echo "1⃣ Checking frontend build..."
cd /root/maternal-app/maternal-web
if npm run build > /tmp/frontend-build.log 2>&1; then
echo "✅ Frontend build successful"
else
echo "❌ Frontend build failed"
echo "See /tmp/frontend-build.log for details"
ERRORS=$((ERRORS + 1))
fi
# Check 2: Backend build
echo ""
echo "2⃣ Checking backend build..."
cd /root/maternal-app/maternal-app/maternal-app-backend
if npm run build > /tmp/backend-build.log 2>&1; then
echo "✅ Backend build successful"
else
echo "❌ Backend build failed"
echo "See /tmp/backend-build.log for details"
tail -20 /tmp/backend-build.log
ERRORS=$((ERRORS + 1))
fi
# Check 2.5: Admin Panel build
echo ""
echo "2⃣.5 Checking admin panel build..."
cd /root/maternal-app/parentflow-admin
if npm run build > /tmp/admin-build.log 2>&1; then
echo "✅ Admin panel build successful"
else
echo "❌ Admin panel build failed"
echo "See /tmp/admin-build.log for details"
tail -20 /tmp/admin-build.log
ERRORS=$((ERRORS + 1))
fi
# Check 3: Uncommitted changes
echo ""
echo "3⃣ Checking for uncommitted changes..."
cd /root/maternal-app
if [ -z "$(git status --porcelain)" ]; then
echo "✅ No uncommitted changes"
else
echo "⚠️ Uncommitted changes detected:"
git status --short
echo ""
echo "You may want to commit these before deploying"
fi
# Check 4: Current branch
echo ""
echo "4⃣ Checking current branch..."
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
echo "✅ On branch: $BRANCH"
else
echo "⚠️ On branch: $BRANCH (not main/master)"
fi
# Check 5: Remote sync
echo ""
echo "5⃣ Checking if local is ahead of remote..."
git fetch origin --quiet
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
if [ "$LOCAL" = "$REMOTE" ]; then
echo "✅ Local and remote are in sync"
elif [ "$LOCAL" != "$REMOTE" ]; then
AHEAD=$(git rev-list --count @{u}..HEAD)
if [ "$AHEAD" -gt 0 ]; then
echo "⚠️ Local is $AHEAD commit(s) ahead of remote (need to push)"
else
echo "⚠️ Local is behind remote (need to pull)"
fi
fi
# Check 6: Pending migrations
echo ""
echo "6⃣ Checking for pending migrations..."
cd /root/maternal-app/maternal-app/maternal-app-backend
MIGRATIONS=$(find src/database/migrations -name "*.ts" 2>/dev/null | wc -l)
echo "Found $MIGRATIONS migration files"
# Check 7: Environment files
echo ""
echo "7⃣ Checking environment files..."
if [ -f "/root/maternal-app/maternal-web/.env.local" ]; then
echo "✅ Frontend .env.local exists"
else
echo "⚠️ Frontend .env.local not found"
fi
if [ -f "/root/maternal-app/maternal-app/maternal-app-backend/.env" ]; then
echo "✅ Backend .env exists"
else
echo "⚠️ Backend .env not found"
fi
if [ -f "/root/maternal-app/parentflow-admin/.env.local" ]; then
echo "✅ Admin panel .env.local exists"
else
echo "⚠️ Admin panel .env.local not found"
fi
# Summary
echo ""
echo "======================================"
if [ $ERRORS -eq 0 ]; then
echo "✅ All critical checks passed! Ready to deploy."
echo ""
echo "📋 Next steps:"
echo " 1. Review any warnings above"
echo " 2. git add . (if uncommitted changes)"
echo " 3. git commit -m 'your message'"
echo " 4. git push origin main"
echo " 5. SSH to production server"
echo " 6. Run: /var/www/maternal-app/deploy.sh"
echo ""
else
echo "$ERRORS critical check(s) failed!"
echo ""
echo "Fix the following before deploying:"
if [ -f /tmp/frontend-build.log ]; then
echo " - Frontend build errors"
fi
if [ -f /tmp/backend-build.log ]; then
echo " - Backend build errors"
fi
if [ -f /tmp/admin-build.log ]; then
echo " - Admin panel build errors"
fi
echo ""
exit 1
fi
echo "======================================"