Spaces:
Build error
Build error
File size: 1,111 Bytes
cce8120 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/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."
|