Spaces:
Sleeping
Sleeping
File size: 1,917 Bytes
8cb7e46 5e667e4 8cb7e46 44aa1b9 8cb7e46 |
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 71 72 73 74 75 76 77 78 79 |
#!/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
# Check if web app directory exists
if [ ! -d "$SOURCE/apps/web" ]; then
echo "Error: Web app directory $SOURCE/apps/web does not exist"
exit 1
fi
echo "Starting build..."
echo "Source path: $SOURCE"
echo "Target path: $SCRIPT_DIR"
# Enter web app directory
cd "$SOURCE/apps/web" || {
echo "Error: Cannot enter directory $SOURCE/apps/web"
exit 1
}
echo "Current directory: $(pwd)"
# Execute build
echo "Running pnpm build..."
pnpm build:web
# Check if build was successful
if [ $? -ne 0 ]; then
echo "Error: pnpm build failed"
exit 1
fi
# Check if .output directory exists
if [ ! -d ".output" ]; then
echo "Error: Build output directory .output does not exist"
exit 1
fi
echo "Build completed, moving output files..."
# Remove existing .output directory if it exists
if [ -d "$SCRIPT_DIR/.output" ]; then
echo "Removing existing output directory..."
rm -rf "$SCRIPT_DIR/.output"
fi
# Copy .output directory to script directory (resolve symlinks for Docker compatibility)
echo "Copying .output directory and resolving symlinks..."
cp -rL ".output" "$SCRIPT_DIR/" || {
echo "Error: Cannot copy .output directory to $SCRIPT_DIR"
exit 1
}
# Copy environment files if they exist
echo "Copying environment files..."
if [ -f ".env" ]; then
cp ".env" "$SCRIPT_DIR/" && echo "Copied .env"
else
echo "No .env file found, skipping..."
fi
if [ -f ".env.example" ]; then
cp ".env.example" "$SCRIPT_DIR/" && echo "Copied .env.example"
else
echo "No .env.example file found, skipping..."
fi
echo "Build completed! Output files moved to: $SCRIPT_DIR/.output" |