- Go 1.24 -> 1.26 - golangci-lint v1.64.5 -> v2.12.2 (module path now includes /v2) - alpine base image 3.23 -> 3.24 - actions/checkout v6 -> v7, actions/setup-go v6 -> v7 - actions/goreleaser-action v6.4.0 -> v7.2.3 - ci-base image 1.0.0 -> 1.1.0 Claude-Session: https://claude.ai/code/session_015abRza4tbCsWyMdK2gxEDU
92 lines
2.9 KiB
Makefile
92 lines
2.9 KiB
Makefile
PROJECT_NAME := terraria-companion
|
|
CGO_ENABLED ?= 0
|
|
PORT ?= 3000
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
LDFLAGS := -X main.version=$(VERSION)
|
|
|
|
GOLANGCI_LINT_VERSION := v2.12.2
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
## help: Display this help message
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /' | sort
|
|
|
|
# ── Build ────────────────────────────────────────────────────────
|
|
|
|
## build: Build the production binary (embeds data assets)
|
|
.PHONY: build
|
|
build:
|
|
CGO_ENABLED=$(CGO_ENABLED) go build -tags embed_data -ldflags "$(LDFLAGS)" -o $(PROJECT_NAME) .
|
|
|
|
## build-nodata: Build without embedded data (for CI/containers)
|
|
.PHONY: build-nodata
|
|
build-nodata:
|
|
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags "$(LDFLAGS)" -o $(PROJECT_NAME) .
|
|
|
|
## build-snapshot: Build all platforms locally via goreleaser (snapshot)
|
|
.PHONY: build-snapshot
|
|
build-snapshot:
|
|
goreleaser build --snapshot --clean
|
|
|
|
# ── Development ──────────────────────────────────────────────────
|
|
|
|
## dev: Run in dev mode (serves frontend from disk, hot-reloads data)
|
|
.PHONY: dev
|
|
dev:
|
|
DEV=1 go run .
|
|
|
|
## serve: Build and run the production server
|
|
.PHONY: serve
|
|
serve: build
|
|
./$(PROJECT_NAME)
|
|
|
|
# ── Data Fetching ────────────────────────────────────────────────
|
|
|
|
## fetch: Fetch/resume data from Terraria wiki (Go fetcher)
|
|
.PHONY: fetch
|
|
fetch:
|
|
go run . fetch
|
|
|
|
## fetch-reset: Reset fetch state and start fresh
|
|
.PHONY: fetch-reset
|
|
fetch-reset:
|
|
go run . fetch --reset
|
|
|
|
## fetch-only: Fetch a single phase (usage: make fetch-only PHASE=drops)
|
|
.PHONY: fetch-only
|
|
fetch-only:
|
|
go run . fetch --only=$(PHASE)
|
|
|
|
# ── Quality ──────────────────────────────────────────────────────
|
|
|
|
## format: Format code and tidy modules
|
|
.PHONY: format
|
|
format:
|
|
go fmt ./...
|
|
go mod tidy
|
|
|
|
## ci-lint: Run linter (auto-installs golangci-lint for CI)
|
|
.PHONY: ci-lint
|
|
ci-lint:
|
|
@which golangci-lint > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
|
golangci-lint run ./...
|
|
|
|
## lint: Run linters
|
|
.PHONY: lint
|
|
lint: ci-lint
|
|
|
|
# ── Cleanup ──────────────────────────────────────────────────────
|
|
|
|
## clean: Remove build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(PROJECT_NAME) $(PROJECT_NAME)-*
|
|
rm -rf dist/
|
|
|
|
## clean-data: Remove fetched data (keeps icons as cache)
|
|
.PHONY: clean-data
|
|
clean-data:
|
|
rm -rf data
|