forked from tkhq/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (53 loc) · 2.27 KB
/
Makefile
File metadata and controls
71 lines (53 loc) · 2.27 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
ROOT := $(shell git rev-parse --show-toplevel)
JS_SDK_ROOT := $(ROOT)/../sdk
.PHONY: openapi-gen gen tags mintlify-check
# Convenience method to start dev server
dev:
mintlify dev
# Install deps for OpenAPI
install:
cd scripts/openapi-gen && npm install
# Default MDX generation target
gen: mintlify-check
npx ts-node scripts/openapi-gen/swagger-to-openapi.ts
cd scripts/openapi-gen && npx ts-node openapi-gen.ts --file=openapi.json --generate-mdx
# Run the OpenAPI generator (allows custom ARGS)
openapi-gen: mintlify-check
cd scripts/openapi-gen && npx ts-node openapi-gen.ts $(ARGS)
tags: mintlify-check
cd scripts/openapi-gen && npx ts-node openapi-gen.ts --file=openapi.json --list-endpoints-tags ../../snippets/data/endpoint-tags.mdx
mintlify-check:
@current=$$(mintlify --version 2>/dev/null || echo "not installed"); \
latest=$$(npm view mintlify version 2>/dev/null || echo "unknown"); \
if [ "$$current" != "$$latest" ]; then \
echo "⬆️ Updating Mintlify CLI: $$current → $$latest..."; \
npm install -g mintlify@latest; \
echo "✅ Mintlify CLI updated to $$(mintlify --version)"; \
else \
echo "✅ Mintlify CLI is up to date ($$current)"; \
fi
.PHONY: sync-sdk-gen-docs
sync-sdk-gen-docs:
@if [ ! -d $(JS_SDK_ROOT) ]; then git clone git@github.com:tkhq/sdk.git $(JS_SDK_ROOT); fi
$(cd "$JS_SDK_ROOT && git pull)
cp docs.json $(JS_SDK_ROOT)/generated-docs
@mkdir -p ./generated-docs
@echo Generating docs and formatting output into mdx...
(cd $(JS_SDK_ROOT) && pnpm run generate-docs)
(cd $(JS_SDK_ROOT) && node $(JS_SDK_ROOT)/typedoc-theme/format-json-output.js \
--packages react-wallet-kit core \
--groups React "TypeScript | Frontend")
@echo Running prettier...
(cd $(JS_SDK_ROOT) && pnpm run prettier-all:write)
@echo Copying synced docs.json to root...
cp $(JS_SDK_ROOT)/generated-docs/docs.json docs.json
@echo Copying formatted docs to ./generated-docs...
cp -R $(JS_SDK_ROOT)/generated-docs/react-wallet-kit ./generated-docs
cp -R $(JS_SDK_ROOT)/generated-docs/core ./generated-docs
@echo Copying formatted changelogs to ./changelogs...
cp -R $(JS_SDK_ROOT)/generated-docs/changelogs .
@echo Deleting temporary files...
find $(JS_SDK_ROOT)/generated-docs -mindepth 1 \
! -name 'docs.json' \
! -name 'sdk-docs.json' \
-exec rm -rf {} +