Qortal UI - Main Code Repository A User Interface for the Qortal Blockchain Project. Truly decentralized web hosting, application hosting, communications, data storage, and full infrastructure for the future global decentralized digital world.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.5 KiB

3 years ago
#!/usr/bin/env bash
SHOW_HELP=0
NPM_WATCH=0
3 years ago
RUN_SERVER=0
RUN_ELECTRON=0
while [ -n "$*" ]; do
case $1 in
-h)
# Show help
SHOW_HELP=1
;;
-w)
# Use "npm run watch" instead of "npm run build", to enable hot swapping
NPM_WATCH=1
3 years ago
;;
-s)
3 years ago
# Run server after building
RUN_SERVER=1
;;
-e)
3 years ago
# Run electron after building
RUN_ELECTRON=1
;;
esac
shift
done
if [ "${SHOW_HELP}" -eq 1 ]; then
echo
echo "Usage:"
echo "build.sh [-h] [-w] [-s] [-e]"
3 years ago
echo
echo "-h: show help"
echo "-w: use 'npm run watch' instead of 'npm run build', to enable hot swapping"
3 years ago
echo "-s: run UI server after completing the build"
echo "-e: run electron server after completing the build"
echo
exit
fi
WATCH_PID=$(cat "watch.pid" || echo "")
if [ ! -z "${WATCH_PID}" ]; then
echo "Stopping existing watch process..."
kill "${WATCH_PID}"
rm -f "watch.pid"
fi
if [ "${NPM_WATCH}" -eq 1 ]; then
3 years ago
echo "Building qortal-ui in watch mode..."
npm run watch &
3 years ago
echo "$!" > "watch.pid";
else
npm run build
3 years ago
fi
if [ "${RUN_SERVER}" -eq 1 ]; then
echo "Running UI server..."
trap : INT
npm run server
3 years ago
elif [ "${RUN_ELECTRON}" -eq 1 ]; then
echo "Starting electron..."
trap : INT
npm run start-electron
3 years ago
fi
WATCH_PID=$(cat "watch.pid" || echo "")
if [ ! -z "${WATCH_PID}" ]; then
echo "Stopping watch process..."
kill "${WATCH_PID}"
rm -f "watch.pid"
fi
# Catch-all to kill any remaining processes
pkill -P $$