-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (58 loc) · 1.96 KB
/
Makefile
File metadata and controls
74 lines (58 loc) · 1.96 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
.PHONY: build install test check fmt lint clean update-golden fetch-queries bootstrap
# Build the binary (set VERSION to inject a version string)
VERSION ?=
LDFLAGS := $(if $(VERSION),-ldflags "-X main.version=$(VERSION)",)
build:
go build $(LDFLAGS) -o dfd ./cmd/dfd/
# Install to GOPATH/bin
install:
go install $(LDFLAGS) ./cmd/dfd/
# Run all tests
test:
go test ./...
# Run tests with verbose output
test-v:
go test -v ./...
# Update golden files after intentional view changes
update-golden:
go test ./internal/tui/... -update
# Run all checks (fmt, vet, lint, test)
check: fmt-check vet lint test
# Check formatting (fails if files need formatting)
fmt-check:
@test -z "$$(gofmt -l .)" || (echo "Files need formatting:"; gofmt -l .; exit 1)
# Format code
fmt:
gofmt -w .
# Run go vet
vet:
go vet ./...
# Run staticcheck if available
lint:
@which staticcheck > /dev/null && staticcheck ./... || echo "staticcheck not installed, skipping"
# Clean build artifacts
clean:
rm -f dfd
go clean ./...
# Run the app on HEAD
run: build
./dfd
# Show test coverage
cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
# Fetch syntax highlighting queries from upstream tree-sitter grammar repos.
# This downloads .scm query files for all supported languages.
# NOTE: We use upstream repos, NOT nvim-treesitter (which has Lua-specific predicates).
# WARNING: This overwrites local modifications! After running:
# 1. Check 'git diff pkg/highlight/queries/' for changes
# 2. Reorder patterns if needed (general before specific for "last match wins")
# 3. Re-apply any LOCAL MODIFICATION sections
# See pkg/highlight/queries/fetch_queries.sh for details.
# Download generated parser files that are too large to commit (e.g. SQL ~38MB).
# Run this once after cloning before building.
bootstrap:
go generate ./pkg/highlight/grammars/...
fetch-queries:
./pkg/highlight/queries/fetch_queries.sh