-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (54 loc) · 1.77 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
66
67
68
69
70
71
# the default ARCH for tailwindcss is macos-x64
ARCH ?= macos-arm64
# Setup the project for the first time
setup:
@echo "Setting up project..."
@echo "Creating database directory..."
@mkdir -p db
@echo "Database directory created."
@echo "Install templ"
@go install github.com/a-h/templ/cmd/templ@latest
@echo "templ installed."
@echo "Downloading Tailwind CSS ($(ARCH))..."
@curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-$(ARCH)
@echo "Tailwind CSS ($(ARCH)) downloaded."
@echo "Setting permissions..."
@chmod +x tailwindcss-$(ARCH)
@mv tailwindcss-$(ARCH) tailwindcss
@echo "Initializing Tailwind CSS..."
@./tailwindcss init
@echo "Tailwind CSS initialized."
ENV ?= dev
tailwind:
ifeq ($(ENV), dev)
@./tailwindcss -i ./css/main.css -o ./public/css/tailwind.css
else
@./tailwindcss -i ./css/main.css -o ./public/css/tailwind.css --minify
endif
kill:
@echo "Killing process on port 3000..."
@kill -9 $(lsof -i:3000 -t) || echo "No process running on port 3000."
dev:
@echo "Starting development server..."
@air
build:
@echo "Building project..."
@echo "Building templates..."
@templ generate || echo "Failed to build the templates."
@echo "Templates built."
@echo "Building Tailwind CSS..."
@make tailwind ENV=prod || echo "Failed to build the Tailwind CSS."
@echo "Tailwind CSS built."
@echo "Building Go binary..."
@go build -o bin/app || echo "Failed to build the Go binary."
@chmod +x ./bin/app
@echo "Go binary built."
@echo "Project built."
run:
@echo "Running project..."
@./bin/app || echo "Failed to run the application. Check if the binary exists and has execution permissions."
clean:
@echo "Deleting all contents of the /db directory..."
@rm -rf db
@mkdir db
@echo "Database directory cleaned."