-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_setup.sh
More file actions
executable file
·46 lines (34 loc) · 1.29 KB
/
dev_setup.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# Manual setup includes creating .env for API and Frontend from the .env.example provided.
# This script sets up the development environment for the project.
# Define absolute paths
FRONTEND_DIR="Frontend"
API_DIR="API"
VENV_DIR=".venv"
trap 'trap - ERR EXIT; kill -INT $$ ; return' ERR EXIT
# Deactivate the virtual environment if it is active
if [[ "$VIRTUAL_ENV" != "" ]]; then
deactivate
fi
# Create a .env file in the root of the project from .env.example if it does not exist
if [ ! -f ".env" ]; then
echo "Creating .env file in the root of the project from .env.example..."
cp ".env.example" ".env"
fi
# Set up Python virtual environment if it does not exist
if [ ! -d "$VENV_DIR" ]; then
echo "Creating Python virtual environment..."
python3 -m venv "$VENV_DIR"
fi
# Activate the virtual environment
echo "Activating Python virtual environment..."
source "$VENV_DIR/bin/activate"
# Navigate to the Frontend directory and install node modules
echo "Installing node modules in Frontend..."
npm install --prefix "$FRONTEND_DIR"
# Navigate to the API directory and install dependencies
echo "Setting up API dependencies..."
pip install pre-commit ruff
pip install -r "$API_DIR/requirements.txt"
echo "Install pre-commit hooks..."
pre-commit install --install-hooks