File size: 1,726 Bytes
b93ecc4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
#!/bin/bash

# Set source path
SOURCE=../automotion

# Get absolute path of current script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Check if source directory exists
if [ ! -d "$SOURCE" ]; then
    echo "Error: Source directory $SOURCE does not exist"
    exit 1
fi

echo "Starting build process..."
echo "Source path: $SOURCE"
echo "Target path: $SCRIPT_DIR"

# Enter source directory
cd "$SOURCE" || {
    echo "Error: Cannot enter directory $SOURCE"
    exit 1
}

echo "Current directory: $(pwd)"

# Execute build script
echo "Executing bun scripts/build-langgraph.ts..."
bun scripts/build-langgraph.ts || {
    echo "Error: Build script failed"
    exit 1
}

# Remove existing dist directory if it exists
if [ -d "$SCRIPT_DIR/dist" ]; then
    echo "Removing existing dist directory..."
    rm -rf "$SCRIPT_DIR/dist" || {
        echo "Error: Cannot remove existing dist directory"
        exit 1
    }
fi

# Copy dist/langgraph to current dist directory
if [ -d "dist/langgraph" ]; then
    echo "Copying dist/langgraph to $SCRIPT_DIR/dist..."
    mkdir -p "$SCRIPT_DIR"
    cp -r "dist/langgraph" "$SCRIPT_DIR/dist" || {
        echo "Error: Cannot copy dist/langgraph directory"
        exit 1
    }
    echo "Copied dist/langgraph/"
else
    echo "Error: dist/langgraph directory not found"
    exit 1
fi

# Copy apps/web/package.json to current directory
if [ -f "apps/web/package.json" ]; then
    echo "Copying apps/web/package.json..."
    cp "apps/web/package.json" "$SCRIPT_DIR/" || {
        echo "Error: Cannot copy package.json"
        exit 1
    }
    echo "Copied package.json"
else
    echo "Error: apps/web/package.json file not found"
    exit 1
fi

echo "Build completed!"