Spaces:
Runtime error
Runtime error
# 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!" |