#!/bin/bash

rm -rf ../httpdocs/public/client/*

# Run ng build
ng build

# Check if ng build was successful
if [ $? -ne 0 ]; then
    echo "ng build failed. Exiting script."
    exit 1
fi



# Move files from ../httpdocs/public/client/browser to ../httpdocs/public/client
mv ../httpdocs/public/client/browser/* ../httpdocs/public/client/

# Check if move was successful
if [ $? -ne 0 ]; then
    echo "Failed to move files. Exiting script."
    exit 1
fi

# Remove the browser folder
rm -rf ../httpdocs/public/client/browser

# Check if removal was successful
if [ $? -ne 0 ]; then
    echo "Failed to remove browser folder. Exiting script."
    exit 1
fi

echo "Build completed and files moved successfully."