Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (83 loc) · 3.4 KB
/
Copy pathMakefile
File metadata and controls
99 lines (83 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.PHONY: help serve build check clean setup post uv-sync run-md prek-install prek-install-hooks lint format dev-setup
# Default target: show help
help:
@echo "\033[1m📖 Available Make Targets\033[0m\n"
@echo "\033[1;34m🌐 Site Management:\033[0m"
@echo " serve - Start local development server with live reload"
@echo " build - Build the static site into the 'public' directory"
@echo " check - Check the site for broken links"
@echo " clean - Remove the 'public' directory"
@echo ""
@echo "\033[1;32m✏️ Content Creation:\033[0m"
@echo " post - Create a new blog post (usage: make post SLUG=my-post-slug)"
@echo ""
@echo "\033[1;33m🐍 Python Development:\033[0m"
@echo " run-md - Run python code blocks from a markdown file (MD=<path>)"
@echo " sync-md - Run python code blocks and inject results into markdown (MD=<path>)"
@echo " test - Run all blog code block tests with pytest"
@echo ""
@echo "\033[1;35m🔧 Development Tools:\033[0m"
@echo " setup - Install Zola (Debian/Ubuntu)"
@echo " dev-setup - Complete development environment setup"
@echo " prek-install - Install prek (Rust pre-commit implementation)"
@echo " prek-install-hooks - Install pre-commit hooks with prek"
@echo " lint - Run linters on all files"
@echo " format - Format code using ruff and prettier"
# Start local development server
serve:
zola serve
# Build the static site
build:
zola build
# Check for broken links
check:
zola check
# Remove generated files
clean:
rm -rf public
# Install Zola using the provided script
setup:
chmod +x scripts/install-zola.sh
./scripts/install-zola.sh
# Synchronize Python dependencies via uv (creates .venv)
uv-sync:
uv sync --no-install-project
# Run python code blocks from a markdown file (argument: MD=<path>)
run-md:
@if [ -z "$(MD)" ]; then echo "Usage: make run-md MD=path/to/file.md"; exit 1; fi
uv run --no-project scripts/run_md_blocks.py $(MD)
# Sync results into a markdown file (argument: MD=<path>)
sync-md:
@if [ -z "$(MD)" ]; then echo "Usage: make sync-md MD=path/to/file.md"; exit 1; fi
uv run --no-project scripts/sync_md.py $(MD)
# Create a new blog post
post:
@if [ -z "$(SLUG)" ]; then echo "Usage: make post SLUG=my-post-slug"; exit 1; fi
@mkdir -p content/blog/$(SLUG)
@printf "+++\ntitle = \"$(SLUG)\"\ndate = $(shell date +%Y-%m-%d)\ndescription = \"\"\n[taxonomies]\ntags = []\n+++\n" > content/blog/$(SLUG)/index.md
@echo "Created content/blog/$(SLUG)/index.md"
# Complete development environment setup
dev-setup: setup uv-sync prek-install-hooks
@echo "Development environment setup complete!"
@echo "You can now:"
@echo " - Run 'make serve' to start the development server"
@echo " - Run 'make test' to run tests"
@echo " - Run 'make lint' to run linters"
@echo " - Run 'make format' to format code"
# Install prek (Rust pre-commit implementation)
prek-install:
cargo install prek
# Install pre-commit hooks using prek
prek-install-hooks: prek-install
prek install
# Run linters on all files
lint:
prek run --all-files
# Format code using ruff and prettier
format:
uv run --no-project ruff format scripts/ tests/
uv run --no-project ruff check --fix scripts/ tests/
npx prettier --write "**/*.{yml,yaml,md,json}"
# Run all code block tests
test:
uv run --no-project pytest tests/ -vvv