File size: 1,122 Bytes
23680f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Export frontend to static files for Python package

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
FRONTEND_DIR="$PROJECT_ROOT/frontend"
HYPER_SCATTER_DIR="$PROJECT_ROOT/hyper-scatter"
STATIC_DIR="$PROJECT_ROOT/src/hyperview/server/static"

# Build hyper-scatter library if it's a local checkout
if [ -d "$HYPER_SCATTER_DIR" ] && [ -f "$HYPER_SCATTER_DIR/package.json" ]; then
    echo "Building hyper-scatter library..."
    cd "$HYPER_SCATTER_DIR"
    if [ ! -d "node_modules" ]; then
        npm install
    fi
    npm run build:lib
fi

echo "Building frontend..."
cd "$FRONTEND_DIR"

# Install dependencies if needed
if [ ! -d "node_modules" ]; then
    echo "Installing frontend dependencies..."
    npm install
fi

# Build for static export
npm run build

# Copy to Python package
echo "Copying build output into Python package..."
rm -rf "$STATIC_DIR"
mkdir -p "$STATIC_DIR"
cp -r out/* "$STATIC_DIR/"

echo ""
echo "✅ Frontend exported to $STATIC_DIR"
echo ""
echo "To test, run:"
echo "  cd $PROJECT_ROOT"
echo "  uv run hyperview demo"