Files
awesome-ai-dev-tools/Makefile
T
tiennm99 519f85b231 build: add a Makefile task runner
`go run build` cannot work — Go resolves a bare argument as an import
path, so it looks for a package named "build" in std. Wrap the existing
commands in make targets instead, which gives the `make build` /
`make check` ergonomics without changing the Go interface underneath.

The wrapper earns its keep beyond the aliasing: `make serve` builds and
previews dist/ in one step, `make test` runs exactly what CI runs, and
`make update` fails with a pointer to LOCAL_DEV.md when GITHUB_TOKEN is
unset rather than erroring out mid-run.

Cloudflare keeps calling `go run . -build` directly. Locally make is
convenience; in the build image it would be a dependency relied on for
no benefit.
2026-09-16 22:49:17 +07:00

66 lines
2.0 KiB
Makefile

# Task runner for the repo. Run `make` on its own to list the targets.
#
# These are thin wrappers over the Go tool — `make build` is exactly
# `go run . -build`. The wrapping earns its keep for the targets Go alone
# cannot express (serve, test, clean) and for not having to remember which
# steps need a GITHUB_TOKEN and which do not.
DIST ?= dist
PORT ?= 8080
# Print the help text when make is run with no target.
.DEFAULT_GOAL := help
.PHONY: help update build check serve test fmt lint clean
help: ## Show this help
@echo "Usage: make <target>"
@echo
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-8s\033[0m %s\n", $$1, $$2}'
@echo
@echo "Only 'update' needs network access and a GITHUB_TOKEN."
update: ## Fetch GitHub and refresh README, history and metadata (needs GITHUB_TOKEN)
@[ -n "$$GITHUB_TOKEN" ] || { \
echo "GITHUB_TOKEN is not set — see docs/LOCAL_DEV.md for how to get one."; \
echo "If you only changed tags, notes or the dashboard, use 'make build' instead."; \
exit 1; \
}
go run .
build: ## Render the site into dist/ from committed data (offline)
go run . -build
check: ## Validate data/agents.yml (offline)
go run . -check
serve: build ## Build, then preview the dashboard locally (override with PORT=)
@command -v python3 >/dev/null || { \
echo "python3 not found — serve $(DIST)/ with any static file server instead."; \
exit 1; \
}
@echo "Serving $(DIST)/ at http://localhost:$(PORT) — Ctrl-C to stop"
@python3 -m http.server $(PORT) -d $(DIST)
test: ## Run everything CI runs (vet, tests, check, build)
go vet ./...
go test ./...
go run . -check
go run . -build
fmt: ## Format the Go sources
gofmt -w .
lint: ## Run golangci-lint if it is installed
@command -v golangci-lint >/dev/null || { \
echo "golangci-lint not installed — CI runs it regardless."; \
echo "Install: https://golangci-lint.run/welcome/install/"; \
exit 1; \
}
golangci-lint run
clean: ## Remove build output
rm -rf $(DIST)
rm -f awesome-ai-dev-tools