Files
pad/Makefile
T
xarmian 0972347cf0 Fix svelte warnings and add build version info (#26)
* Fix all 17 svelte-check warnings across 7 components

- Add tabindex to toolbar role elements (BoardView, Editor)
- Replace nested buttons with div[role=button] in ListView group headers
- Add role="none" to click-to-close backdrop overlays (Editor, slug page)
- Fix label→span for non-input field labels (CreateWorkspaceModal)
- Add keyboard handlers to interactive divs (CreateWorkspaceModal drop zone, slug page modal)
- Remove unused .slash-backdrop CSS (Editor) and input[type=text] selector (CreateWorkspaceModal)
- Fix state_referenced_locally in RawMarkdownEditor ($state init)
- Add svelte-ignore for conditional tabindex false positive (ToastContainer)

* feat: add build version, commit hash, and timestamp to CLI and web UI

Inject version info via ldflags during build (Makefile, GoReleaser,
Dockerfile). Expose version/commit/build_time in the health API
endpoint and display it in the sidebar footer. Dev builds show
"dev (abc1234 ...)", releases show "v1.2.3 (abc1234 ...)".
2026-03-30 11:54:45 -04:00

64 lines
1.8 KiB
Makefile

.PHONY: build test dev clean web dev-web serve restart lint install
BINARY=pad
BUILD_DIR=./cmd/pad
HOST?=127.0.0.1
INSTALL_DIR?=$(HOME)/.local/bin
VERSION ?= dev
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.buildTime=$(BUILD_TIME)
build: web
@# Write a build timestamp into embed.go so Go's content-hash cache
@# sees a real change and re-embeds the web assets.
@printf 'package pad\n\nimport "embed"\n\n//go:embed all:web/build\nvar WebUI embed.FS\n\n//go:embed skills/pad/SKILL.md\nvar PadSkill []byte\n\n// embed cache bust: %s\n' "$$(date +%s)" > embed.go
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(BUILD_DIR)
build-go:
@printf 'package pad\n\nimport "embed"\n\n//go:embed all:web/build\nvar WebUI embed.FS\n\n//go:embed skills/pad/SKILL.md\nvar PadSkill []byte\n\n// embed cache bust: %s\n' "$$(date +%s)" > embed.go
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(BUILD_DIR)
install: build
@# Stop running server, install binary, clear stale pid
-killall -9 $(BINARY) 2>/dev/null
@sleep 1
@mkdir -p $(INSTALL_DIR)
cp -f $(BINARY) $(INSTALL_DIR)/$(BINARY)
rm -f ~/.pad/pad.pid
@echo "Installed $(BINARY) to $(INSTALL_DIR)/$(BINARY)"
@# Trigger server auto-start by running a command
@$(INSTALL_DIR)/$(BINARY) status 2>/dev/null || true
@echo "Server restarted."
test:
go test ./... -v
dev: build-go
./$(BINARY) serve --host $(HOST)
serve: build
-./$(BINARY) stop 2>/dev/null
@sleep 1
./$(BINARY) serve --host $(HOST)
restart: build-go
-./$(BINARY) stop 2>/dev/null
@sleep 1
./$(BINARY) serve --host $(HOST)
web:
cd web && npm run build
dev-web:
cd web && npm run dev
clean:
rm -f $(BINARY)
rm -rf web/build
go clean ./...
lint:
go vet ./...