Add the initial foundation for Coda, a Go/Docker service that converts FLAC albums to MP3 320 kbps CBR, triggered by Lidarr webhooks or manually from the web UI. - docs: requirements and architecture (SQLite persistence, media volume, work window, manual FLAC search, env + web config) - config: .env loader with env precedence - web: embed/dev asset split, chi server, index template (DaisyUI + htmx) - build: Makefile (setup/css/run/build/test/lint), Dockerfile (Tailwind standalone CLI + DaisyUI, no Node), .env.example, ignore rules - docs: AGENTS.md and README for the project
85 lines
2.3 KiB
Makefile
85 lines
2.3 KiB
Makefile
SHELL := /bin/bash
|
|
|
|
TAILWIND_VERSION ?= v4.1.14
|
|
HTMX_VERSION ?= 2.0.4
|
|
|
|
TOOLS_DIR := tools
|
|
TAILWIND := $(TOOLS_DIR)/tailwindcss
|
|
DAISYUI := $(TOOLS_DIR)/daisyui.mjs
|
|
HTMX := web/static/htmx.min.js
|
|
APP_CSS := web/static/app.css
|
|
INPUT_CSS := web/styles/input.css
|
|
|
|
UNAME_M := $(shell uname -m)
|
|
ifeq ($(UNAME_M),x86_64)
|
|
TW_ARCH := x64
|
|
else
|
|
TW_ARCH := arm64
|
|
endif
|
|
TAILWIND_URL := https://github.com/tailwindlabs/tailwindcss/releases/download/$(TAILWIND_VERSION)/tailwindcss-linux-$(TW_ARCH)
|
|
DAISYUI_URL := https://github.com/saadeghi/daisyui/releases/latest/download/daisyui.mjs
|
|
HTMX_URL := https://unpkg.com/htmx.org@$(HTMX_VERSION)/dist/htmx.min.js
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
.PHONY: help
|
|
help: ## List available targets
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
|
|
|
|
.PHONY: setup
|
|
setup: $(TAILWIND) $(DAISYUI) $(HTMX) deps ## Download tools (Tailwind, DaisyUI, htmx) and resolve deps
|
|
@test -f .env || cp .env.example .env
|
|
@echo "setup complete. edit .env as needed."
|
|
|
|
$(TAILWIND):
|
|
@mkdir -p $(TOOLS_DIR)
|
|
curl -sL -o $(TAILWIND) $(TAILWIND_URL)
|
|
chmod +x $(TAILWIND)
|
|
|
|
$(DAISYUI):
|
|
@mkdir -p $(TOOLS_DIR)
|
|
curl -sL -o $(DAISYUI) $(DAISYUI_URL)
|
|
|
|
$(HTMX):
|
|
@mkdir -p web/static
|
|
curl -sL -o $(HTMX) $(HTMX_URL)
|
|
|
|
.PHONY: deps
|
|
deps: ## Resolve Go dependencies (go mod tidy)
|
|
go mod tidy
|
|
|
|
.PHONY: css
|
|
css: $(TAILWIND) $(DAISYUI) ## Generate web/static/app.css (minified)
|
|
$(TAILWIND) -i $(INPUT_CSS) -o $(APP_CSS) --minify
|
|
|
|
.PHONY: css-watch
|
|
css-watch: $(TAILWIND) $(DAISYUI) ## Rebuild CSS automatically on save
|
|
$(TAILWIND) -i $(INPUT_CSS) -o $(APP_CSS) --watch
|
|
|
|
.PHONY: assets
|
|
assets: css $(HTMX) ## Ensure generated/fetched assets exist (app.css + htmx)
|
|
|
|
.PHONY: run
|
|
run: assets ## Run in dev mode (hot-reload of templates/static via dev build tag)
|
|
go run -tags dev ./cmd/server
|
|
|
|
.PHONY: run-prod
|
|
run-prod: assets ## Run in production mode (embedded assets)
|
|
go run ./cmd/server
|
|
|
|
.PHONY: build
|
|
build: assets ## Build the production binary at bin/server (embedded assets)
|
|
go build -o bin/server ./cmd/server
|
|
|
|
.PHONY: test
|
|
test: ## Run tests
|
|
go test ./...
|
|
|
|
.PHONY: lint
|
|
lint: ## Run go vet
|
|
go vet ./...
|
|
|
|
.PHONY: clean
|
|
clean: ## Remove generated artifacts (bin, app.css)
|
|
rm -rf bin $(APP_CSS)
|