This repository has been archived on 2025-01-04. You can view files and clone it, but cannot push or open issues or pull requests.

47 lines
993 B
Bash
Raw Normal View History

2023-03-07 05:02:02 -06:00
#!/bin/bash
# Date: 2023-03-07
# Developer: Hyperling
# Purpose: Install all dependencies and run the project.
2023-03-07 06:15:44 -06:00
DIR=`dirname $0`
PROG=`basename $0`
if [[ $DIR == "." ]]; then
DIR="`pwd`"
echo $DIR/$PROG
fi
## Install any system packages. ##
2023-03-07 05:02:02 -06:00
if [[ -z `which npm` ]]; then
2023-03-07 05:15:22 -06:00
echo "NPM needs to be installed."
2023-03-07 05:02:02 -06:00
sudo apt install npm
2023-03-07 05:15:22 -06:00
else
echo "NPM is already available."
2023-03-07 05:02:02 -06:00
fi
if [[ -z `which tsc` ]]; then
echo "TSC needs to be installed."
sudo apt install node-typescript
else
echo "TSC is already available."
fi
## Install/update any project modules. ##
echo "Refreshing NPM packages."
2023-03-07 06:15:44 -06:00
bash -c "rm -r $DIR/node_modules $DIR/package-lock.json"
npm install $DIR
2023-03-07 05:02:02 -06:00
## Main ##
# Fork somehow other than just doing &? Then...
if [[ $parent ]]; then
# Start backend
2023-03-07 06:15:44 -06:00
node $DIR/server.js >$DIR/logs/server.log 2>&1 &
else
# Start frontend.
2023-03-07 06:15:44 -06:00
tsc --project $DIR
# ??? $DIR/dist/index.js >$DIR/logs/ui.log 2>&1
fi
2023-03-07 05:15:22 -06:00
2023-03-07 06:15:44 -06:00
# Or just run them each with & and then kill with another shell script? stop.sh