-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
110 lines (87 loc) · 2.7 KB
/
Justfile
File metadata and controls
110 lines (87 loc) · 2.7 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# JUSTFILE (Updated for Full Stack)
set dotenv-load
default:
@just --list
# Variables
APP_NAME := "basepack"
BACKEND_DIR := "cmd/api"
FRONTEND_DIR := "web"
BUILD_DIR := "bin"
# === FULL STACK COMMANDS ===
# Setup entire project
setup:
@echo "Setting up full stack project..."
@if [ ! -f .env ]; then cp .env.example .env; echo "Created backend .env"; fi
@if [ ! -f {{FRONTEND_DIR}}/.env.local ]; then cp {{FRONTEND_DIR}}/.env.example {{FRONTEND_DIR}}/.env.local; echo "Created frontend .env.local"; fi
@mkdir -p {{BUILD_DIR}} tmp logs
just install-tools
just install-frontend
@echo "Setup completed!"
# Start both backend and frontend
dev-all:
@echo "Starting full stack development..."
@trap 'kill 0' SIGINT; \
just dev-backend & \
just dev-frontend & \
wait
# Build both backend and frontend
build-all:
@echo "Building full stack application..."
just build-backend
just build-frontend
# === BACKEND COMMANDS ===
# Start backend development server
dev-backend:
@echo "Starting Go backend..."
air -c .air.toml
# Build Go backend
build-backend:
@echo "Building Go backend..."
@mkdir -p {{BUILD_DIR}}
go build -o {{BUILD_DIR}}/{{APP_NAME}} ./{{BACKEND_DIR}}
# Test Go backend
test-backend:
@echo "Testing Go backend..."
go test -v ./...
# === FRONTEND COMMANDS ===
# Install frontend dependencies
install-frontend:
@echo "Installing frontend dependencies..."
cd {{FRONTEND_DIR}} && npm install
# Start frontend development server
dev-frontend:
@echo "Starting frontend server..."
cd {{FRONTEND_DIR}} && npm run dev
# Build Next.js frontend
build-frontend:
@echo "Building frontend..."
cd {{FRONTEND_DIR}} && npm run build
# Test frontend
test-frontend:
@echo "Testing frontend..."
cd {{FRONTEND_DIR}} && npm run test
# Lint frontend
lint-frontend:
@echo "Linting frontend..."
cd {{FRONTEND_DIR}} && npm run lint
# === DOCKER COMMANDS ===
# Build all Docker images
docker-build-all:
@echo "Building all Docker images..."
docker build -t {{APP_NAME}}-backend -f Dockerfile.backend .
docker build -t {{APP_NAME}}-frontend -f Dockerfile.frontend ./{{FRONTEND_DIR}}
# Start full stack with Docker
docker-up:
@echo "Starting full stack with Docker..."
docker-compose up -d
# === UTILITY COMMANDS ===
# Clean all build artifacts
clean:
@echo "Cleaning all build artifacts..."
rm -rf {{BUILD_DIR}} tmp coverage.out coverage.html
cd {{FRONTEND_DIR}} && rm -rf .next node_modules
# Install all development tools
install-tools:
@echo "Installing development tools..."
go install github.com/cosmtrek/air@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest