-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (49 loc) · 1.73 KB
/
Makefile
File metadata and controls
60 lines (49 loc) · 1.73 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
# Root Makefile — Wails app lives at repo root (wails.json + main.go)
SHELL := /bin/bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
APP_DIR := .
FRONTEND_DIR := frontend
ASSETS_DST := $(APP_DIR)/frontend/dist
WAILS := wails
.PHONY: help run build gui clean format test frontend assets
help:
@echo "Targets:"
@echo " run - wails dev from $(APP_DIR)"
@echo " build - build SPA, stage assets, then wails build"
@echo " gui - run the built app (macOS .app or binary)"
@echo " clean - clean Go cache and Wails output + staged assets"
@echo " format - golines + gofmt + go mod tidy"
@echo " test - go test ./... (race)"
@echo " frontend - npm ci && npm run build (to $(FRONTEND_DIR)/dist)"
@echo " assets - copy dist/ into $(ASSETS_DST) for go:embed"
run:
cd "$(APP_DIR)" && "$(WAILS)" dev
build: frontend
cd "$(APP_DIR)" && "$(WAILS)" build
frontend:
npm --prefix "$(FRONTEND_DIR)" ci --no-audit --no-fund
npm --prefix "$(FRONTEND_DIR)" run build
assets:
@echo "No asset staging required; embedding uses $(ASSETS_DST)"
gui: build
@if [ -d "$(APP_DIR)/build/bin/rabbit.app" ]; then \
"$(APP_DIR)/build/bin/rabbit.app/Contents/MacOS/rabbit"; \
elif [ -x "$(APP_DIR)/build/bin/rabbit" ]; then \
"$(APP_DIR)/build/bin/rabbit"; \
elif [ -x "$(APP_DIR)/build/bin/rabbit.exe" ]; then \
"$(APP_DIR)/build/bin/rabbit.exe"; \
else \
echo "No built binary found under $(APP_DIR)/build/bin"; exit 1; \
fi
clean:
go clean
@if [ -d "$(APP_DIR)/build" ]; then rm -rf "$(APP_DIR)/build"; fi
cd "$(APP_DIR)" && "$(WAILS)" build -clean || true
format:
golines -m 100 -t 8 --shorten-comments -w .
gofmt -s -w .
go mod tidy
test:
go test ./... -race -count=1