Something went wrong. Try again.
a minimal blog cms for your pds
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105# Convenience targets for fair. The actual CLI is `fair`; targets# below are sugar for the common flows.## Profile is required by every fair command. Default is sandbox; override# with `make publish-post POST=path/to/index.md PROFILE=prod`.
PROFILE ?= sandboxCA_BUNDLE := $(shell mkcert -CAROOT 2>/dev/null)/rootCA.pemCA_FLAG := $(if $(wildcard $(CA_BUNDLE)),--ca-bundle $(CA_BUNDLE),)
.PHONY: helphelp: @echo "Usage: make <target> [PROFILE=<name>] [POST=<path>]" @echo @echo "Targets:" @echo " build Compile ./fair" @echo " test Run go test ./..." @echo " vet Run go vet ./..." @echo " install Build and install to \$$GOBIN" @echo @echo " sandbox-up Bootstrap the local PDS + create test account" @echo " sandbox-down Stop the sandbox containers (keeps volume)" @echo " sandbox-reset Wipe sandbox data (volume + state + sessions)" @echo @echo " ls fair ls" @echo " doctor fair doctor" @echo " publish-post fair publish POST=<path>" @echo " build-site fair build" @echo " preview Run a static server over dist.\$$(PROFILE)/" @echo @echo "Current PROFILE=$(PROFILE)"
.PHONY: buildbuild: fair
fair: $(shell find cmd internal -name '*.go' 2>/dev/null) go.mod go.sum go build -o fair ./cmd/fair
.PHONY: testtest: go test ./...
.PHONY: vetvet: go vet ./...
.PHONY: installinstall: go install ./cmd/fair
# --- Sandbox lifecycle -------------------------------------------------------
.PHONY: sandbox-upsandbox-up: bash sandbox/seed.sh
.PHONY: sandbox-downsandbox-down: docker compose -f sandbox/compose.yaml --env-file sandbox/.env down
.PHONY: sandbox-resetsandbox-reset: bash sandbox/reset.sh
# --- Blog operations --------------------------------------------------------
.PHONY: lsls: fair ./fair --profile $(PROFILE) ls $(CA_FLAG)
.PHONY: doctordoctor: fair ./fair --profile $(PROFILE) doctor $(CA_FLAG)
.PHONY: publish-postpublish-post: fair @if [ -z "$(POST)" ]; then \ echo "Usage: make publish-post POST=path/to/index.md"; exit 1; \ fi ./fair --profile $(PROFILE) publish $(POST) $(CA_FLAG)
.PHONY: build-sitebuild-site: fair ./fair --profile $(PROFILE) build $(CA_FLAG)
.PHONY: previewpreview: build-site @echo "Serving dist.$(PROFILE)/ at http://localhost:8000/" python3 -m http.server 8000 --directory dist.$(PROFILE)
# --- Push to origin (tangled) and the GitHub mirror -------------------------
.PHONY: pushpush: git push origin main --tags git push github main --tags
# --- Cleanup ---------------------------------------------------------------
.PHONY: cleanclean: rm -f fair rm -rf dist dist.tmp dist.sandbox dist.sandbox.tmp rm -rf images-mirror images-mirror.sandbox images-mirror.prod