initial commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
.PHONY: build ui ui-build run docker docker-build test clean help
|
||||
|
||||
APP_NAME := helix-proxy
|
||||
GO := go
|
||||
UI_DIR := ui
|
||||
DIST_DIR := $(UI_DIR)/dist
|
||||
DATA_DIR := data
|
||||
|
||||
# Inject git tag and commit separately; version package picks tag → commit → dev.
|
||||
GIT_TAG := $(shell git describe --tags --exact-match HEAD 2>/dev/null)
|
||||
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
|
||||
LDFLAGS := -X helix-proxy/internal/version.Version=$(GIT_TAG) -X helix-proxy/internal/version.Commit=$(GIT_COMMIT)
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Helix Proxy Makefile"
|
||||
@echo ""
|
||||
@echo " build Build the Go binary (embeds UI if dist/ present)"
|
||||
@echo " ui Install UI deps (npm ci in ui/)"
|
||||
@echo " ui-build Build Svelte SPA to $(DIST_DIR)"
|
||||
@echo " run Build + run (uses current dir as cwd)"
|
||||
@echo " docker Build docker image (helix-proxy:dev)"
|
||||
@echo " docker-build Build docker image"
|
||||
@echo " test Run go tests"
|
||||
@echo " clean Remove build artifacts and ui/dist"
|
||||
@echo ""
|
||||
|
||||
build: ui-build
|
||||
@echo "Building $(APP_NAME) (tag=$(if $(GIT_TAG),$(GIT_TAG),none), commit=$(if $(GIT_COMMIT),$(GIT_COMMIT),none))..."
|
||||
$(GO) build -ldflags "$(LDFLAGS)" -o $(APP_NAME) ./cmd/helix-proxy
|
||||
|
||||
ui:
|
||||
@echo "Installing UI dependencies..."
|
||||
cd $(UI_DIR) && npm ci
|
||||
|
||||
ui-build: clean
|
||||
@if [ -d "$(UI_DIR)" ]; then \
|
||||
echo "Building Svelte UI..."; \
|
||||
cd $(UI_DIR) && npm run build; \
|
||||
else \
|
||||
echo "No $(UI_DIR)/ dir, skipping UI build (will use empty embed or stub)"; \
|
||||
fi
|
||||
|
||||
run: build
|
||||
@echo "Running $(APP_NAME) from cwd (data/ will be created relative)..."
|
||||
PROXY_MODE=development ./$(APP_NAME)
|
||||
|
||||
docker docker-build:
|
||||
@echo "Building docker image helix-proxy:dev..."
|
||||
docker build -t helix-proxy:dev .
|
||||
|
||||
test:
|
||||
$(GO) test ./... -count=1 -race -coverprofile=coverage.out
|
||||
|
||||
clean:
|
||||
rm -f $(APP_NAME)
|
||||
rm -rf $(DIST_DIR)
|
||||
rm -rf $(DATA_DIR)
|
||||
@echo "Cleaned binaries and UI dist."
|
||||
Reference in New Issue
Block a user