v0.2.0 759cc92

Makefile RawHistoryFolder

1# Makefile for dumber
2
3.PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static
4
5# Variables
6BINARY_NAME=dumber
7MAIN_PATH=.
8DIST_DIR=dist
9
10# Local caches to avoid $HOME permission issues in sandboxed environments
11GOENV=GOMODCACHE=$(PWD)/tmp/go-mod GOCACHE=$(PWD)/tmp/go-cache GOTMPDIR=$(PWD)/tmp
12
13# Version information from git
14VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-dev")
15COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
16BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
17
18# Linker flags
19LDFLAGS=-ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.buildDate=$(BUILD_DATE)"
20
21# Default target
22help: ## Show this help message
23	@echo "Available targets:"
24	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
25
26# Build targets
27build: build-frontend ## Build the application (frontend assets, then Go binary)
28	@echo "Building $(BINARY_NAME) $(VERSION)..."
29	@mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod
30	$(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH)
31
32build-frontend: ## Build TypeScript frontend
33	@echo "Building TypeScript frontend..."
34	@cd frontend && npm install --silent && npm run build
35	@echo "Frontend build complete"
36
37build-static: ## Build static binary (CGO disabled, CLI-only functionality)
38	@echo "Building static $(BINARY_NAME) $(VERSION) (CLI-only)..."
39	@mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod
40	$(GOENV) CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME)-static $(MAIN_PATH)
41
42# GUI build with WebKitGTK 6.0 (GTK4)
43.PHONY: build-gui run-gui
44build-gui: build-frontend ## Build GUI binary with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages)
45	@echo "Building $(BINARY_NAME) (GUI, webkit_cgo)…"
46	@mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod
47	$(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -tags=webkit_cgo -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH)
48
49run-gui: ## Run the GUI with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages)
50	@echo "Running GUI (webkit_cgo)…"
51	@mkdir -p tmp tmp/go-cache tmp/go-mod
52	$(GOENV) CGO_ENABLED=1 go run -tags=webkit_cgo $(MAIN_PATH)
53
54.PHONY: check-webkit
55check-webkit: ## Check system has GTK4/WebKitGTK 6.0/JavaScriptCore 6.0
56	@echo "Checking pkg-config versions..."
57	@which pkg-config >/dev/null 2>&1 || (echo "pkg-config not found" && exit 1)
58	@echo "gtk4:            $$(pkg-config --modversion gtk4 2>/dev/null || echo not found)"
59	@echo "webkitgtk-6.0:    $$(pkg-config --modversion webkitgtk-6.0 2>/dev/null || echo not found)"
60	@echo "javascriptcoregtk-6.0: $$(pkg-config --modversion javascriptcoregtk-6.0 2>/dev/null || echo not found)"
61
62# Development targets
63dev: ## Run in development mode
64	@echo "Running in development mode..."
65	go run $(MAIN_PATH)
66
67generate: ## Generate code (SQLC)
68	@echo "Generating code with SQLC..."
69	sqlc generate
70	@echo "Code generation complete"
71
72# Testing
73test: ## Run tests
74	@echo "Running tests..."
75	@mkdir -p tmp tmp/go-cache tmp/go-mod
76	$(GOENV) CGO_ENABLED=0 go test -v ./...
77
78test-race: ## Run tests with race detection
79	@echo "Running tests with race detection..."
80	@mkdir -p tmp tmp/go-cache tmp/go-mod
81	$(GOENV) CGO_ENABLED=1 go test -race -v ./...
82
83# Linting
84lint: ## Run golangci-lint
85	@echo "Running golangci-lint..."
86	golangci-lint run
87
88lint-fix: ## Run golangci-lint with --fix
89	@echo "Running golangci-lint with --fix..."
90	golangci-lint run --fix
91
92# Tools installation
93install-tools: ## Install development tools
94	@echo "Installing development tools..."
95	go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
96	go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
97	@echo "Tools installed successfully"
98
99# Cleanup
100clean: ## Clean build artifacts
101	@echo "Cleaning build artifacts..."
102	rm -rf $(DIST_DIR)
103	rm -f $(BINARY_NAME)  # Remove any old binaries in root
104	rm -rf frontend/dist frontend/node_modules
105	go clean -cache
106	go clean -testcache
107
108# Project initialization 
109init: install-tools ## Initialize project dependencies and tools
110	@echo "Project dependencies and tools installed!"
111	@echo "Ready for development. Run 'make help' for available commands."
112
113# Check setup
114check: ## Check that all tools and dependencies are working
115	@echo "Checking project setup..."
116	@echo "Go version:"
117	@$(GOENV) go version
118	@echo "\nSQLC version:"
119	@$(GOENV) sqlc version
120	@echo "\nGolangci-lint version:"
121	@$(GOENV) golangci-lint version
122	@echo "\nBuilding project..."
123	@$(MAKE) build
124	@echo "\nTesting built binary..."
125	@$(DIST_DIR)/$(BINARY_NAME) version
126	@echo "\nRunning tests..."
127	@$(MAKE) test
128	@echo "\n✅ All checks passed! Project is ready for development."

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close