website-builder-backend / frontend /scripts /01_frontend_structure.sh
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120
Raw
History Blame Contribute Delete
1.11 kB
#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
echo "[1/8] Validating frontend..."
[ -f package.json ] || {
echo "package.json not found."
exit 1
}
mkdir -p .backup
STAMP="$(date +%Y%m%d-%H%M%S)"
echo "[2/8] Backup..."
tar -czf ".backup/frontend-${STAMP}.tar.gz" \
app \
components \
src \
package.json \
next.config.js \
postcss.config.js \
tailwind.config.js \
2>/dev/null || true
echo "[3/8] Remove duplicate App Router..."
if [ -d src/app ]; then
cp -rn src/app/* app/ 2>/dev/null || true
rm -rf src/app
fi
echo "[4/8] Merge duplicate components..."
if [ -d src/components ]; then
mkdir -p components
cp -rn src/components/* components/ 2>/dev/null || true
rm -rf src/components
fi
echo "[5/8] Cleanup..."
rm -f components/*.broken
rm -f src/App.jsx
rm -f src/index.js
echo "[6/8] Install dependencies..."
npm install
echo "[7/8] Verify..."
test -d app
test -d components
test -f app/layout.jsx
test -f app/page.jsx
test -f package.json
echo "[8/8] Complete."
echo "Frontend normalized successfully."