-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
230 lines (203 loc) Β· 9.86 KB
/
Makefile
File metadata and controls
230 lines (203 loc) Β· 9.86 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# Simplified Makefile for Jekyll D&D site
#
# DEVELOPMENT PRINCIPLE: 100% Docker-based development
# - NO local tool installation (npm, node, ruby gems, etc.)
# - ALL development tools run inside Docker containers
# - Keeps host machine clean and ensures consistent environments
# - Dev/prod parity through identical tooling
#
# SIMPLIFICATION PRINCIPLE: Only essential targets
# - Removed unused/broken targets
# - Focus on daily development workflow
# - Everything works out of the box
.PHONY: help serve build extract extract-archetypes extract-folk clean find-broken-links ci-build update-creator-data check-creator-sync test-creator-data lint-md lint-md-fix test-structure test-structure-full test test-verbose validate-profiles validate-questions analyze-question-traits test-class-scoring test-ranking-system
# Docker configuration
DOCKER_IMAGE = dnd-jekyll
CONTAINER_NAME = dnd-site
# Default: show help
help:
@echo "π² D&D Site Development (Docker-based)"
@echo ""
@echo "Daily workflow:"
@echo " make serve - Start development server (does everything)"
@echo ""
@echo "Manual operations:"
@echo " make build - Rebuild Docker image"
@echo " make clean - Stop containers and clean up"
@echo " make minify - Regenerate minified CSS/JS"
@echo " make extract - Re-extract searchable content, archetypes, and folk"
@echo " make extract-archetypes - Extract archetypes from class files to _data/archetypes.yml"
@echo " make extract-folk - Extract folk and subtypes from folk files to _data/folk.yml"
@echo ""
@echo "Character Creator:"
@echo " make update-creator-data - Extract data from markdown for character creator"
@echo " make check-creator-sync - Check if creator data needs update"
@echo " make test-creator-data - Validate creator data structure"
@echo ""
@echo "Utilities:"
@echo " make find-broken-links - Find placeholder images to replace"
@echo " make test - Run all validation (lint-md + validate-questions)"
@echo " make test-verbose - Run validation with detailed output"
@echo " make lint-md - Validate markdown formatting and structure"
@echo " make lint-md-quiet - Validate markdown with minimal output"
@echo " make lint-md-fix - Auto-fix markdown formatting issues (trailing whitespace, blank lines, bold/italic)"
@echo " make test-structure - Validate Varlyn patterns for MVP files (Human+Elf+Tiefling, Fighter+Wizard+Cursed)"
@echo " make test-structure-quiet - Validate Varlyn patterns with minimal output"
@echo " make test-structure-full - Validate Varlyn patterns for all Folk/Class files"
@echo " make validate-profiles - Validate class profile frontmatter schema (checks archetype anchor naming)"
@echo " make validate-questions - Validate class selector question bank coverage"
@echo " make analyze-question-traits - Analyze multi-trait vs single-trait questions"
@echo " make test-class-scoring - Test class recommendation scoring algorithm"
@echo " make test-ranking-system - Test class recommendation ranking and explanations"
@echo ""
@echo "π³ Everything runs in Docker - no local setup needed!"
# Build Docker image with Jekyll
build:
@echo "π³ Building Docker image with Jekyll..."
docker build -t $(DOCKER_IMAGE) .
# Extract searchable content (skills, familiars, feats, etc.)
extract: build extract-archetypes extract-folk
@echo "π Extracting searchable content..."
@docker run --rm -v $(PWD):/srv/jekyll $(DOCKER_IMAGE) ruby tools/extract-searchable.rb
# Extract archetypes from class files
extract-archetypes: build
@echo "π Extracting archetypes from class files..."
@docker run --rm -v $(PWD):/srv/jekyll $(DOCKER_IMAGE) ruby tools/extract-archetypes.rb
# Extract folk and subtypes from folk files
extract-folk: build
@echo "π Extracting folk and subtypes from folk files..."
@docker run --rm -v $(PWD):/srv/jekyll $(DOCKER_IMAGE) ruby tools/extract-folk.rb
# Start development server (does extract automatically)
serve: clean build extract
@echo "π Starting Jekyll development server..."
@echo "π http://localhost:4000/dnd/"
@docker run --rm --name $(CONTAINER_NAME) -v $(PWD):/srv/jekyll -p 4000:4000 $(DOCKER_IMAGE)
# Clean up containers and images
clean:
@echo "π§Ή Cleaning up Docker..."
@docker stop $(CONTAINER_NAME) 2>/dev/null || true
@docker rm $(CONTAINER_NAME) 2>/dev/null || true
@docker rmi $(DOCKER_IMAGE) 2>/dev/null || true
# Find images that need replacement
find-broken-links:
@echo "π Finding placeholder images..."
@grep -r -n "Placeholder.*image" docs/ --include="*.md" | sed 's/:.*: /: /' || echo "β
No placeholders found"
# CI/CD build (used by GitHub Actions)
ci-build: extract
@echo "ποΈ Building for CI/CD..."
bundle exec jekyll build --baseurl="/dnd"
# Character Creator Data Management
# Update character creator data from markdown files
update-creator-data: build
@echo "π² Extracting character creation data from Jekyll collections..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
npm run build-creator-data"
@echo "β
Creator data updated: assets/data/creator-data.json"
@echo " Last sync: $$(date)"
# Check if creator data is in sync with source files
check-creator-sync: build
@echo "π Checking if creator data is in sync..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
npm run check-creator-sync"
# Validate creator data structure
test-creator-data: build
@echo "π§ͺ Validating creator data structure..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
npm test"
# Validate markdown formatting and structure
lint-md: build
@echo "π Validating markdown formatting and structure..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
node tools/lint-markdown.js docs"
lint-md-fix: build
@echo "π§ Auto-fixing markdown formatting issues..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
node tools/lint-markdown.js --fix docs"
test-structure: build
@echo "π¬ Testing Varlyn structure patterns (MVP: 3 Folk + 3 Classes)..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/test-structure.js --mvp"
test-structure-full: build
@echo "π¬ Testing Varlyn structure patterns (Full dataset)..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/test-structure.js --full"
test-verbose: build
@echo "π Running validation tools..."
@echo ""
@echo "π Step 1: Markdown linting..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
node tools/lint-markdown.js docs" && \
echo "" && \
echo "π― Step 2: Question bank validation..." && \
docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-question-bank.js"
# Quiet mode versions (minimal output with dots)
test: build
@echo "π Running validation (quiet mode)..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
node tools/lint-markdown.js --quiet docs" && \
echo "" && \
echo "π Validating class profiles..." && \
docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-class-profiles.js" && \
echo "" && \
echo "π― Validating question bank..." && \
docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-question-bank.js" && \
echo "" && \
echo "π€ Checking for problematic answer characters..." && \
docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-answer-characters.js"
lint-md-quiet: build
@echo "π Markdown linting (quiet)..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent && \
node tools/lint-markdown.js --quiet docs"
test-structure-quiet: build
@echo "π¬ Structure testing (quiet, MVP)..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/test-structure.js --mvp --quiet"
# Validate class profile frontmatter schema
validate-profiles: build
@echo "π Validating class profile schemas..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-class-profiles.js"
# Validate question bank coverage and structure
validate-questions: build
@echo "π― Validating question bank..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/validate-question-bank.js"
# Analyze question bank trait distribution
analyze-question-traits: build
@echo "π Analyzing question trait coverage..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/analyze-question-traits.js"
# Test class recommendation scoring algorithm
test-class-scoring: build
@echo "π§ͺ Testing class scoring algorithm..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/test-class-scoring.js"
# Test class recommendation ranking and explanations
test-ranking-system: build
@echo "π Testing recommendation ranking system..."
@docker run --rm -v $(PWD):/srv/jekyll -w /srv/jekyll $(DOCKER_IMAGE) sh -c " \
npm install --silent js-yaml && \
node tools/test-ranking-system.js"