-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·63 lines (51 loc) · 1.57 KB
/
Copy pathMakefile
File metadata and controls
executable file
·63 lines (51 loc) · 1.57 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.PHONY: backend backend-test backend-run frontend-install frontend-dev frontend-build frontend-test dev local neon server
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
FRONTEND_ENV_FILE ?= $(ROOT_DIR).env
BACKEND_ENV_FILE ?= $(ROOT_DIR).env
ifneq ($(filter local,$(MAKECMDGOALS)),)
FRONTEND_ENV_FILE = $(ROOT_DIR).env.local
BACKEND_ENV_FILE = $(ROOT_DIR).env.local
endif
ifneq ($(filter neon,$(MAKECMDGOALS)),)
FRONTEND_ENV_FILE = $(ROOT_DIR).env.neon
BACKEND_ENV_FILE = $(ROOT_DIR).env.neon
endif
backend:
cd backend && ENV_FILE="$(BACKEND_ENV_FILE)" go run ./cmd/api
backend-test:
cd backend && go test ./...
frontend-install:
cd frontend && npm install
frontend-dev:
cd frontend && npm run dev
frontend-build:
cd frontend && npm run build
frontend-test:
cd frontend && npm run test
frontend-e2e:
cd frontend && npm run test:e2e
dev:
@set -a; \
. "$(FRONTEND_ENV_FILE)"; \
set +a; \
if [ "$(filter local,$(MAKECMDGOALS))" = "local" ]; then \
echo "Starting Postgres and Mailer API in Docker..."; \
cd "$(ROOT_DIR)" && docker compose up -d db mailer-api; \
fi; \
if [ "$(filter local neon,$(MAKECMDGOALS))" != "" ]; then \
echo "Starting backend on :8080..."; \
cd backend && ENV_FILE="$(BACKEND_ENV_FILE)" go run ./cmd/api & \
BACK_PID=$$!; \
echo "Starting frontend dev on :5173..."; \
cd frontend && VITE_API_TARGET="$$VITE_API_TARGET" npm run dev; \
kill $$BACK_PID || true; \
else \
echo "Starting frontend dev on :5173..."; \
cd frontend && VITE_API_TARGET="$$VITE_API_TARGET" npm run dev; \
fi
local:
@true
neon:
@true
server:
@true