all: help

test:
	go test .

build: ## Builds the binary.
	go build -o esr ./cmd/esr

install: ## Installs the binary.
	go install ./cmd/esr

test-serve: ## Runs the server.
	go run cmd/esr/main.go --config example/.esr.yml --serve example/src/index.ts

test-build-watch: ## Runs esr --build
	go run cmd/esr/main.go --config example/.esr.yml --watch --build example/src/index.ts

test-build: ## Runs esr --build
	go run cmd/esr/main.go --config example/.esr.yml --build example/src/index.ts

test-init: ## Runs esr init
	go run cmd/esr/main.go init

test-run: ## Runs esr
	go run cmd/esr/main.go --config example/.esr.yml --run example/src/index.ts

test-run-watch: ## Runs esr --watch
	go run cmd/esr/main.go --config example/.esr.yml --run --watch example/src/index.ts

.PHONY: help
help:  ## Show help messages for make targets
	@echo esr && grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
