create .env and tailwind.css file in setup.sh

This commit is contained in:
Neil Parikh 2021-05-31 02:09:24 -04:00 committed by Adi Thakral
parent 8033863a33
commit f16be2231f
2 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ data.json
.env .env
build/ build/
index.out.css index.out.css
frontend/public/index.html

View File

@ -3,6 +3,7 @@
set -e set -e
source ./common.sh source ./common.sh
MAIN_PATH=$(pwd)
function setup_frontend() { function setup_frontend() {
prefix_stdout_stderr "${PURPLE}frontend: ${NC}" prefix_stdout_stderr "${PURPLE}frontend: ${NC}"
@ -12,6 +13,10 @@ function setup_frontend() {
echo "Installing dependencies..." echo "Installing dependencies..."
npm i npm i
echo "Building tailwind css file for links page"
cd public
NODE_ENV=production npx tailwindcss-cli@latest build index.in.css -o index.out.css
echo "Done!" echo "Done!"
} }
@ -26,6 +31,9 @@ function setup_backend() {
echo "Deleting sqlite database..." echo "Deleting sqlite database..."
rm ./links.db || echo "Nothing to delete ¯\_(ツ)_/¯" rm ./links.db || echo "Nothing to delete ¯\_(ツ)_/¯"
echo "Deleting .env file"
rm ./.env || echo "No .env to delete"
echo "Creating new virtual environment..." echo "Creating new virtual environment..."
python3 -m venv venv python3 -m venv venv
source venv/bin/activate source venv/bin/activate
@ -36,6 +44,11 @@ function setup_backend() {
echo "Creating a dummy sqlite database at 'backend/links.db'..." echo "Creating a dummy sqlite database at 'backend/links.db'..."
python setup_db.py python setup_db.py
echo "Creating .env file"
echo "PASSWORD=test" > .env
echo "PORT=5000" >> .env
echo "OUT_PATH=$MAIN_PATH/frontend/public/index.html" >> .env
echo "Done!" echo "Done!"
} }