-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
135 lines (115 loc) · 2.59 KB
/
Taskfile.yaml
File metadata and controls
135 lines (115 loc) · 2.59 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# https://taskfile.dev
version: '3'
vars:
BINARY_NAME: kefw2ui
FRONTEND_DIR: frontend
tasks:
default:
desc: Show available tasks
cmds:
- task --list
# Development
dev:
desc: Run development servers (backend + frontend)
deps: [frontend:install]
cmds:
- task --parallel dev:backend dev:frontend
dev:backend:
desc: Run Go backend with hot reload
cmds:
- go run .
env:
CGO_ENABLED: "0"
dev:frontend:
desc: Run frontend dev server
dir: "{{.FRONTEND_DIR}}"
cmds:
- npm run dev
# Building
build:
desc: Build production binary with embedded frontend
deps: [frontend:build]
cmds:
- CGO_ENABLED=0 go build -o bin/{{.BINARY_NAME}} .
frontend:install:
desc: Install frontend dependencies
dir: "{{.FRONTEND_DIR}}"
cmds:
- npm install
sources:
- package.json
- package-lock.json
generates:
- node_modules/**/*
frontend:build:
desc: Build frontend for production
dir: "{{.FRONTEND_DIR}}"
deps: [frontend:install]
cmds:
- npm run build
sources:
- src/**/*
- static/**/*
- svelte.config.js
- vite.config.ts
- tailwind.config.js
generates:
- build/**/*
frontend:check:
desc: Run svelte-check
dir: "{{.FRONTEND_DIR}}"
cmds:
- npm run check
# Docker
docker:build:
desc: Build Docker image
cmds:
- docker build -t kefw2ui .
docker:run:
desc: Run Docker container
cmds:
- docker compose up
docker:run:detached:
desc: Run Docker container in background
cmds:
- docker compose up -d
docker:stop:
desc: Stop Docker container
cmds:
- docker compose down
# Testing
test:
desc: Run Go tests
cmds:
- go test -v ./...
test:coverage:
desc: Run Go tests with coverage
cmds:
- go test -v -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
# Linting
lint:
desc: Run linters
cmds:
- golangci-lint run
- task: frontend:check
# Cleaning
clean:
desc: Clean build artifacts
cmds:
- rm -f {{.BINARY_NAME}}
- rm -rf {{.FRONTEND_DIR}}/build
- rm -rf {{.FRONTEND_DIR}}/node_modules
- rm -rf {{.FRONTEND_DIR}}/.svelte-kit
# Utilities
run:
desc: Run the built binary
deps: [build]
cmds:
- ./bin/{{.BINARY_NAME}}
install:
desc: Install binary to /usr/local/bin
deps: [build]
cmds:
- sudo cp bin/{{.BINARY_NAME}} /usr/local/bin/
- echo "Installed to /usr/local/bin/{{.BINARY_NAME}}"