-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
57 lines (46 loc) · 1.45 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
PORT?=8080
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run
build: templ
go build -o bin/www
build/static: templ
go run ./cmd/build
dev/templ:
go run github.com/a-h/templ/cmd/templ@v0.2.707 generate --watch \
--proxy=http://localhost:$(PORT) \
--open-browser=false
dev/server:
go run github.com/air-verse/air@v1.52.2 \
--build.cmd "go build -o tmp/bin/main" \
--build.bin "tmp/bin/main" \
--build.exclude_dir "node_modules" \
--build.include_ext "go" \
--build.stop_on_error "false" \
--misc.clean_on_exit true \
-- -p $(PORT) -d
dev/sync_assets:
go run github.com/air-verse/air@v1.52.2 \
--build.cmd "go run github.com/a-h/templ/cmd/templ@v0.2.707 generate --notify-proxy" \
--build.bin "true" \
--build.delay "100" \
--build.exclude_dir "" \
--build.include_dir "static" \
--build.include_ext "js,css"
dev:
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
make -j3 dev/templ dev/server dev/sync_assets
run: build
./bin/www
all: build
clean:
if [[ -d "dist" ]]; then rm -r ./dist; fi
if [[ -d "tmp" ]]; then rm -r ./tmp; fi
if [[ -d "bin" ]]; then rm -r ./bin; fi
rm $(TEMPL_FILES)
# For some reason "templ generate" does not detect the files in CI,
# so this is a workaround.
TEMPL_FILES=$(patsubst %.templ, %_templ.go, $(wildcard **/*.templ))
templ: $(TEMPL_FILES)
@echo Generating templ files
%_templ.go: %.templ
go run github.com/a-h/templ/cmd/templ@v0.2.707 generate -f $^ > /dev/null