-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (26 loc) · 1.22 KB
/
Makefile
File metadata and controls
31 lines (26 loc) · 1.22 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
SHELL := /bin/bash
.PHONY: dev lint _lint-openapi-drift
OPENAPI_URL ?= https://raw.githubusercontent.com/usezombie/usezombie/main/public/openapi.json
dev:
npx mintlify dev
lint: _lint-openapi-drift
npx mintlify validate
npx mintlify broken-links
find . -name "*.mdx" | xargs -I{} npx markdown-link-check --config .mlc-config.json {}
_lint-openapi-drift:
@command -v jq >/dev/null 2>&1 || { echo "jq not installed — skipping openapi drift check"; exit 0; }
@tmp=$$(mktemp); \
if ! curl -sSfL --connect-timeout 5 "$(OPENAPI_URL)" -o "$$tmp"; then \
echo "warn: could not fetch $(OPENAPI_URL) — skipping openapi drift check"; \
rm -f "$$tmp"; exit 0; \
fi; \
upstream=$$(jq -r '.paths | to_entries[] | . as $$p | $$p.value | keys[] | (ascii_upcase + " " + $$p.key)' "$$tmp" | sort -u); \
referenced=$$(grep -hoE '"(GET|POST|PUT|DELETE|PATCH) /[^"]+"' docs.json api-reference/endpoint/*.mdx 2>/dev/null | tr -d '"' | sort -u); \
missing=$$(comm -23 <(echo "$$referenced") <(echo "$$upstream")); \
rm -f "$$tmp"; \
if [ -n "$$missing" ]; then \
echo "❌ openapi drift: paths referenced by docs but missing from $(OPENAPI_URL):"; \
echo "$$missing" | sed 's/^/ - /'; \
exit 1; \
fi; \
echo "✓ openapi drift check clean"