aissel-astro/build.sh

25 lines
731 B
Bash
Raw Normal View History

2024-11-07 04:39:56 +00:00
#!/bin/bash
# Define the current Astro project directory
ASTRO_PROJECT_DIR="$(pwd)"
# Build the Astro project
echo "Building the Astro project..."
npm run build
# Define the destination as the parent folder of the Astro project directory
DESTINATION_DIR="$(dirname "$ASTRO_PROJECT_DIR")"
# Check if the build was successful and the dist folder exists
if [ -d "$ASTRO_PROJECT_DIR/dist" ]; then
echo "Build successful. Transferring files to the parent directory..."
# Copy all files and directories from the dist folder to the parent directory
cp -R "$ASTRO_PROJECT_DIR/dist/." "$DESTINATION_DIR"
echo "Transfer complete. The files are now in $DESTINATION_DIR."
else
echo "Build failed or dist folder not found."
fi