2021-03-15 00:30:16 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
source ./common.sh
|
|
|
|
|
|
|
|
function setup_frontend() {
|
|
|
|
prefix_stdout_stderr "${PURPLE}frontend: ${NC}"
|
|
|
|
|
|
|
|
cd ./frontend
|
|
|
|
|
|
|
|
echo "Installing dependencies..."
|
|
|
|
npm i
|
|
|
|
|
|
|
|
echo "Done!"
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup_backend() {
|
|
|
|
prefix_stdout_stderr "${CYAN}backend: ${NC}"
|
|
|
|
|
|
|
|
cd ./backend
|
|
|
|
|
|
|
|
echo "Deleting old virtual environment..."
|
|
|
|
rm -rf ./venv
|
|
|
|
|
|
|
|
echo "Deleting sqlite database..."
|
2021-03-15 00:41:06 -04:00
|
|
|
rm ./links.db || echo "Nothing to delete ¯\_(ツ)_/¯"
|
2021-03-15 00:30:16 -04:00
|
|
|
|
|
|
|
echo "Creating new virtual environment..."
|
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
|
|
|
|
echo "Installing dependencies..."
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
|
|
|
echo "Creating a dummy sqlite database at 'backend/links.db'..."
|
|
|
|
python setup_db.py
|
|
|
|
|
|
|
|
echo "Done!"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_frontend_backend "setup_frontend" "setup_backend"
|