-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
27 lines (22 loc) · 849 Bytes
/
Makefile
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
.PHONY: generate publish publish-all
generate: $(foreach dir,$(shell ls -d ./apis/*),$(dir)/mod.ts $(dir)/deno.json)
# Generate deno.json for each API directory
apis/%/deno.json: apis/%/schema.json
mkdir -p $(dir $@)
deno run -A generate.ts
# Generate OpenAPI client for each API directory
apis/%/client: apis/%/schema.json
mkdir -p $(dir $@)
deno run -A npm:@hey-api/openapi-ts --client @hey-api/client-fetch --input $< --output $@
apis/%/mod.ts: apis/%/client
echo "export * from './client'" > $@
# Publish a specific API to JSR
publish-%: apis/%/jsr.json apis/%/mod.ts
@echo "Publishing @openapis/$* to JSR"
cd apis/$* && deno publish --allow-dirty --unstable-sloppy-imports --allow-slow-types
# Publish all APIs to JSR
publish-all:
@for dir in $$(ls -d ./apis/*/); do \
api=$$(basename $$dir); \
$(MAKE) publish-$$api; \
done