64 lines
1.6 KiB
Makefile
64 lines
1.6 KiB
Makefile
# Build the application
|
|
all: deps build
|
|
|
|
|
|
deps: ## Install build dependencies
|
|
go mod tidy
|
|
go install github.com/a-h/templ/cmd/templ@latest
|
|
|
|
build: ## Build and compile
|
|
echo "Building..."
|
|
tailwindcss -o server/web/assets/styles.css
|
|
templ generate
|
|
go build -o main.out server/main.go
|
|
|
|
run: ## Run the application
|
|
go run main.go
|
|
|
|
test: ## Run test
|
|
echo "Testing..."
|
|
go test ./tests/... -v
|
|
|
|
clean: ## Delete build artifacts
|
|
echo "Cleaning..."
|
|
rm -f main.out
|
|
rm -rf sessions/*
|
|
rm -rf storage/*
|
|
|
|
dev: ## Start templ-dev tailwind-dev and watch
|
|
make -j3 templ-dev tailwind-dev watch
|
|
|
|
templ-dev: ## Watch & Live rebuild of templ
|
|
templ generate --watch --proxy="http://localhost:8080" --open-browser=false
|
|
|
|
tailwind-dev: ##Live rebuild of tailwind
|
|
tailwindcss -o server/web/assets/styles.css -i input.css --watch
|
|
|
|
# Live Reload
|
|
watch: ##Live reload with air
|
|
@if command -v air > /dev/null; then \
|
|
air; \
|
|
echo "Watching...";\
|
|
else \
|
|
read -p "Go's 'air' is not installed on your machine. Do you want to install it? [Y/n] " choice; \
|
|
if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \
|
|
go install github.com/air-verse/air@latest; \
|
|
air; \
|
|
echo "Watching...";\
|
|
else \
|
|
echo "You chose not to install air. Exiting..."; \
|
|
exit 1; \
|
|
fi; \
|
|
fi
|
|
|
|
help: ## Display this Help.
|
|
@awk 'BEGIN { \
|
|
FS = ":.*##"; \
|
|
printf "\nUsage:\n make <target>\n" \
|
|
} \
|
|
/^[a-zA-Z_-]+:.*?##/ { \
|
|
printf " %-20s %s\n", $$1, $$2 \
|
|
} \
|
|
' $(MAKEFILE_LIST)
|
|
|
|
.PHONY: all build run test clean help
|