File size: 1,192 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
#!/usr/bin/env bash
set -euo pipefail

echo "[1/8] Checking required files..."

FILES=(
app/layout.jsx
app/page.jsx
app/globals.css
components/layout/WorkspaceLayout.jsx
components/editor/ProductionCodeEditor.jsx
components/explorer/ProductionFileExplorer.jsx
components/terminal/ProductionTerminal.jsx
components/chat/ProductionAIChat.jsx
components/device/DevicePreview.jsx
components/build/BuildCenter.jsx
components/sidebar/ActivityBar.jsx
components/statusbar/StatusBar.jsx
package.json
next.config.js
)

for f in "${FILES[@]}"; do
    [ -f "$f" ] || {
        echo "Missing: $f"
        exit 1
    }
done

echo "[2/8] Installing dependencies..."
npm install

echo "[3/8] Linting..."
if npm run lint >/dev/null 2>&1; then
    echo "Lint OK"
else
    echo "Lint skipped"
fi

echo "[4/8] Production build..."
npm run build

echo "[5/8] Cleaning previous server..."
pkill -f "next dev" 2>/dev/null || true
pkill -f "next start" 2>/dev/null || true

echo "[6/8] Starting production..."
nohup npm start > production.log 2>&1 &
sleep 10

echo "[7/8] Health check..."

curl -fsS http://127.0.0.1:3000 >/dev/null

echo "[8/8] SUCCESS"
echo
echo "Studio running at:"
echo "http://127.0.0.1:3000"