Files
padelnomics/Makefile
Deeman 2325e9b51e merge: group_key static article grouping + email-gated report PDF
Feature 1 — group_key for static article admin grouping:
- Migration 0020: group_key TEXT column + index on articles table
- _sync_static_articles(): auto-upserts data/content/articles/*.md on
  every /admin/articles load, reads cornerstone → group_key
- _get_article_list_grouped(): COALESCE(group_key, url_path) as group_id,
  so EN/DE static cornerstones pair into one row (pSEO unchanged)

Feature 2 — Email-gated State of Padel report PDF:
- data/content/articles/state-of-padel-q1-2026-{en,de}.md → reports/
- New reports/ blueprint: GET/POST /<lang>/reports/<slug> (email gate),
  GET /<lang>/reports/<slug>/download (PDF serve)
- Premium PDF: full-bleed navy cover, Padelnomics wordmark watermark at
  3.5% opacity (position:fixed, every page), gold/teal accents, Georgia
  headings, WeasyPrint CSS3 (no JS)
- make report-pdf target to build PDFs
- i18n EN + DE (26 keys each, native German via linguistic-mediation)
- /reports added to RESERVED_PREFIXES, data/content/reports/_build/ gitignored

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 07:53:15 +01:00

85 lines
3.8 KiB
Makefile

TAILWIND_VERSION := v4.1.18
TAILWIND := ./bin/tailwindcss
SOPS_DOTENV := sops --input-type dotenv --output-type dotenv
.PHONY: help dev init-landing-seeds css-build css-watch report-pdf \
secrets-decrypt-dev secrets-decrypt-prod \
secrets-edit-dev secrets-edit-prod \
secrets-encrypt-dev secrets-encrypt-prod \
secrets-updatekeys-prod
help:
@echo "Available targets:"
@echo " dev Start full dev environment (reset DB, migrate, seed, app + worker + CSS watcher)"
@echo " init-landing-seeds Create seed landing files for SQLMesh (run once after clone)"
@echo " css-build Build + minify Tailwind CSS"
@echo " css-watch Watch + rebuild Tailwind CSS"
@echo " report-pdf Build market intelligence report PDFs (WeasyPrint)"
@echo " secrets-decrypt-dev Decrypt .env.dev.sops → .env"
@echo " secrets-decrypt-prod Decrypt .env.prod.sops → .env"
@echo " secrets-edit-dev Edit .env.dev.sops in \$$EDITOR"
@echo " secrets-edit-prod Edit .env.prod.sops in \$$EDITOR"
@echo " secrets-encrypt-dev Encrypt .env (plaintext) → .env.dev.sops"
@echo " secrets-encrypt-prod Encrypt .env (plaintext) → .env.prod.sops"
@echo " secrets-updatekeys-prod Re-encrypt .env.prod.sops for all keys in .sops.yaml"
# ── Dev environment ───────────────────────────────────────────────────────────
dev:
@./web/scripts/dev_run.sh
# ── Landing seeds ─────────────────────────────────────────────────────────────
# Create seed files for SQLMesh staging models that require at least one landing file.
# Run once after a fresh clone (data/ is gitignored so seeds are not in git).
init-landing-seeds:
@uv run python web/scripts/init_landing_seeds.py
# ── CSS ───────────────────────────────────────────────────────────────────────
bin/tailwindcss:
@mkdir -p bin
curl -sLo bin/tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/$(TAILWIND_VERSION)/tailwindcss-linux-x64
chmod +x bin/tailwindcss
css-build: bin/tailwindcss
$(TAILWIND) -i web/src/padelnomics/static/css/input.css -o web/src/padelnomics/static/css/output.css --minify
css-watch: bin/tailwindcss
$(TAILWIND) -i web/src/padelnomics/static/css/input.css -o web/src/padelnomics/static/css/output.css --watch
report-pdf:
uv run python web/scripts/build_report_pdf.py
# ── Secrets (SOPS + age) ─────────────────────────────────────────────────────
# Requires: sops (https://github.com/getsops/sops) + age (https://github.com/FiloSottile/age)
# Keys config: .sops.yaml
# .env.*.sops files use dotenv format but sops can't infer from the extension,
# so we pass --input-type / --output-type explicitly.
# Encrypted files are safe to commit to git.
secrets-decrypt-dev:
$(SOPS_DOTENV) --decrypt .env.dev.sops > .env
@echo "Decrypted .env.dev.sops → .env"
secrets-decrypt-prod:
$(SOPS_DOTENV) --decrypt .env.prod.sops > .env
@echo "Decrypted .env.prod.sops → .env"
secrets-edit-dev:
$(SOPS_DOTENV) .env.dev.sops
secrets-edit-prod:
$(SOPS_DOTENV) .env.prod.sops
secrets-encrypt-dev:
$(SOPS_DOTENV) --encrypt --in-place .env.dev.sops
@echo "Encrypted .env.dev.sops (commit this file)"
secrets-encrypt-prod:
$(SOPS_DOTENV) --encrypt --in-place .env.prod.sops
@echo "Encrypted .env.prod.sops (commit this file)"
secrets-updatekeys-prod:
sops updatekeys --input-type dotenv .env.prod.sops