-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (70 loc) · 1.83 KB
/
Copy pathMakefile
File metadata and controls
82 lines (70 loc) · 1.83 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
# Variables
SRC_FILE := ./cmd/main.go
BUILD_DIR := ./tmp
APP_NAME := main
POSTGRES_CONTAINER := rss-postgres
REDIS_SERVER_CMD := redis-server
FORMAT_SCRIPT := scripts/format.sh
GOOSE_SCRIPT := scripts/goose.sh
NEXTJS_DIR := ./www
# Default target
.PHONY: ready
ready: start-postgres start-redis
# Build the project
.PHONY: build
build:
@echo "Building the project..."
go build -o $(BUILD_DIR)/$(APP_NAME) $(SRC_FILE)
# Run air for live reloading
.PHONY: run-air
run-air:
@echo "Running air for live reloading..."
air
# Start PostgreSQL container
.PHONY: start-postgres
start-postgres:
@echo "Starting PostgreSQL container..."
docker start $(POSTGRES_CONTAINER)
# Start Redis server
.PHONY: start-redis
start-redis:
@echo "Starting Redis server..."
$(REDIS_SERVER_CMD)
# Format the code
.PHONY: format
format:
@echo "Formatting code..."
$(FORMAT_SCRIPT)
# Goose migrations (up)
.PHONY: migrate-up
migrate-up:
@echo "Running Goose migrations (up)..."
$(GOOSE_SCRIPT) up
# Goose migrations (down)
.PHONY: migrate-down
migrate-down:
@echo "Running Goose migrations (down)..."
$(GOOSE_SCRIPT) down
# Start Next.js project (Bun)
.PHONY: start-nextjs
start-nextjs:
@echo "Starting Next.js project..."
cd $(NEXTJS_DIR) && bun run dev
# Clean build files
.PHONY: clean
clean:
@echo "Cleaning build files..."
rm -rf $(BUILD_DIR)
# Help
.PHONY: help
help:
@echo "Available commands:"
@echo " build - Build the project"
@echo " start-postgres - Start PostgreSQL container"
@echo " start-redis - Start Redis server"
@echo " run-air - Run air for live reloading"
@echo " format - Format the code"
@echo " migrate-up - Run Goose migrations (up)"
@echo " migrate-down - Run Goose migrations (down)"
@echo " start-nextjs - Start Next.js project (Bun)"
@echo " clean - Clean build files"