-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMakefile
65 lines (54 loc) · 1.61 KB
/
Makefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Makefile
# Variables
FRONTEND_DIR := frontend
BACKEND_DIR := backend
PYTHON_DIR := backend # Assuming your Python code is in the backend directory
LINT_PATHS := $(FRONTEND_DIR) $(BACKEND_DIR)
# Commands
FRONTEND_START_CMD := npm run dev
BACKEND_START_CMD := poetry run uvicorn app:app --port 21337 --no-server-header --reload
FRONTEND_LINT_CMD := npm run lint
PYTHON_LINT_CMD := poetry run ruff check
FORMAT_PYTHON := poetry run ruff format
FORMAT_JS_CMD := prettier --write --log-level silent
REDIS_CONTAINER_NAME := redis-requestrepo-dev
REDIS_PORT := 6379
# Start the backend server
.PHONY: start-backend
start-backend: start-redis
if [ ! -f .env ]; then cp .env.example .env; fi
cd $(BACKEND_DIR) && $(BACKEND_START_CMD)
# Start the Redis container
.PHONY: start-redis
start-redis:
@if [ `docker ps -q -f name=$(REDIS_CONTAINER_NAME)` ]; then \
echo "$(REDIS_CONTAINER_NAME) is already running"; \
else \
if [ `docker ps -aq -f name=$(REDIS_CONTAINER_NAME)` ]; then \
docker start $(REDIS_CONTAINER_NAME); \
else \
docker run -d --name $(REDIS_CONTAINER_NAME) -p $(REDIS_PORT):6379 redis; \
fi \
fi
# Start the frontend application
.PHONY: start-frontend
start-frontend:
cd $(FRONTEND_DIR) && $(FRONTEND_START_CMD)
# Lint the codebase
.PHONY: lint
lint: lint-js lint-python
.PHONY: lint-js
lint-js:
cd $(FRONTEND_DIR) && $(FRONTEND_LINT_CMD)
.PHONY: lint-python
lint-python:
$(PYTHON_LINT_CMD) $(PYTHON_DIR)
# Format the codebase
.PHONY: format
format: format-js format-python
.PHONY: format-js
format-js:
$(FORMAT_JS_CMD) $(FRONTEND_DIR)
.PHONY: format-python
format-python:
$(FORMAT_PYTHON) $(PYTHON_DIR)