blob: 1bd18f9da31a4dcdf2d61fa122aa5e8aec1eae77 (
plain)
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
|
BINARY_NAME=cafe
BUILD_PATH=bin/$(BINARY_NAME)
MAIN_PATH=$(BINARY_NAME)/main.go
COMPOSE_DEV=toolchain/docker-compose.dev.yml
TAILWIND=toolchain/tailwind
.PHONY: setup clean tidy build run dev test postgres stop reset css watch all
setup:
@echo "Setting up environment..."
@go mod download
@go mod tidy
@./scripts/tailwind.setup.sh
@./scripts/htmx.setup.sh
@echo "Environment setup complete."
clean:
@echo "Cleaning up..."
@rm -rf bin
@rm -rf tmp
@echo "Cleanup complete."
tidy:
@echo "Tidying modules..."
@go mod tidy
@echo "Modules tidied."
build:
@echo "Building..."
@go build -o $(BUILD_PATH) $(MAIN_PATH) || true
@echo "Build complete."
run:
@if [ ! -f $(BUILD_PATH) ]; then echo "Binary not found. Building binary..."; $(MAKE) -s build; fi
@echo "Running..."
@$(BUILD_PATH) || true
dev: css
@echo "Running in development mode..."
@go run $(MAIN_PATH) || true
test:
@echo "Running tests..."
@go test -v ./... || true
postgres:
@echo "Starting database..."
@docker-compose -f $(COMPOSE_DEV) up -d
stop:
@echo "Stopping database..."
@docker-compose -f $(COMPOSE_DEV) down
reset:
@echo "Resetting database..."
@./scripts/reset.db.sh
css:
@if [ ! -f $(TAILWIND) ]; then echo "Tailwind not found. Installing..."; ./scripts/install.tailwind.sh; fi
@echo "Building CSS..."
@$(TAILWIND) -i static/css/tailwind.css -o static/css/style.css --minify
watch:
@if [ ! -f $(TAILWIND) ]; then echo "Tailwind not found. Installing..."; ./scripts/install.tailwind.sh; fi
@echo "Watching CSS..."
@$(TAILWIND) -i static/css/tailwind.css -o static/css/style.css --watch
all: setup clean build run
.SILENT:
|