Replace static HTTP server with livereload-based dev server that watches posts/, layout/, and static/ directories for changes, rebuilds the site, and auto-refreshes the browser.
35 lines
883 B
Makefile
35 lines
883 B
Makefile
# Makefile
|
|
|
|
# declare phony targets
|
|
.PHONY: build test typecheck
|
|
|
|
# run locally with live reload (uses --local-stacosys if stacosys is running on port 8100)
|
|
# watches posts/ for changes, regenerates site, and auto-refreshes browser
|
|
site:
|
|
@if curl -s --connect-timeout 1 http://127.0.0.1:8100/api > /dev/null 2>&1; then \
|
|
uv run python devserver.py --local-stacosys; \
|
|
else \
|
|
uv run python devserver.py --local; \
|
|
fi
|
|
|
|
# run type checks
|
|
typecheck:
|
|
uv run mypy makesite.py monitor.py
|
|
|
|
# run unit tests
|
|
test:
|
|
uv run python -m unittest discover test -v
|
|
|
|
# docker build image
|
|
build:
|
|
@echo "Running type checks..."
|
|
uv run mypy makesite.py monitor.py
|
|
@echo "Running tests..."
|
|
uv run python -m unittest discover test -v
|
|
@echo "Building Docker image..."
|
|
docker build -t source.madyanne.fr/yax/blog .
|
|
|
|
# docker publish image
|
|
publish:
|
|
docker push source.madyanne.fr/yax/blog
|
|
|