-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
109 lines (94 loc) · 2.54 KB
/
Taskfile.yml
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
version: "3"
env:
STATIC_DIR: "web/static"
BUILD_DIR: ".build"
BIN_DIR: ".build/bin"
tasks:
clean:
cmds:
- rm -rf $BUILD_DIR
- rm -rf $STATIC_DIR/index.css
- rm -rf $STATIC_DIR/index.js
- rm -rf node_modules
- rm -rf tmp
tools:
cmds:
- pnpm install
# Build tasks for production
build:templ:
deps: [tools]
cmds:
- go run github.com/a-h/templ/cmd/[email protected] generate -v
build:styles:
deps: [tools]
cmds:
- pnpm exec tailwindcss -c tailwind.config.js -i web/styles/styles.css -o $STATIC_DIR/index.css
build:esbuild:
deps: [tools]
cmds:
- mkdir -p $STATIC_DIR
- pnpm exec esbuild web/libs/datastar/index.ts --bundle --outdir=$STATIC_DIR --format=esm
build:
deps:
- tools
- build:styles
- build:templ
- build:esbuild
cmds:
- go build -o $BIN_DIR/main .
# Debug task
debug:
deps: [build]
cmds:
- go run github.com/go-delve/delve/cmd/[email protected] exec $BIN_DIR/main
# Live development tasks
live:templ:
deps: [tools]
cmds:
- go run github.com/a-h/templ/cmd/[email protected] generate --watch --proxy="http://localhost:8080" --open-browser=false -v
live:styles:
deps: [tools]
cmds:
- pnpm exec tailwindcss -c tailwind.config.js -i web/styles/styles.css -o $STATIC_DIR/index.css --watch
live:esbuild:
deps: [tools]
cmds:
- mkdir -p $STATIC_DIR
- pnpm exec esbuild web/libs/datastar/index.ts --sourcemap --bundle --outdir=$STATIC_DIR --watch --format=esm
live:server:
deps: [tools]
cmds:
- |
go run github.com/air-verse/[email protected] \
--build.cmd "go build -tags dev -o $BIN_DIR/main" \
--build.bin "$BIN_DIR/main" \
--build.delay "20" \
--build.exclude_dir "node_modules,data,public,$BUILD_DIR" \
--build.include_ext "go" \
--build.stop_on_error "false" \
--misc.clean_on_exit true \
-d=false
live:reload:
deps: [tools]
cmds:
- |
go run github.com/air-verse/[email protected] \
--build.cmd "go run github.com/a-h/templ/cmd/[email protected] generate --notify-proxy" \
--build.bin "true" \
--build.delay "100" \
--build.exclude_dir "$BUILD_DIR" \
--build.include_dir "$STATIC_DIR" \
--build.include_ext "js,css" \
-d=false
live:
deps:
- tools
- live:templ
- live:styles
- live:esbuild
- live:reload
- live:server
run:
deps: [build]
cmds:
- $BIN_DIR/main