-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (41 loc) · 1.06 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
PACKAGE_NAME?=package
TAG?=v0.0.0-local
SHELL:=$(PREFIX)/bin/sh
VERSION:=$(shell `npm bin`/semver $(TAG))
build: \
out/static/version.txt \
out/static/openapi.yaml \
out/static/openapi.json \
out/static/index.html \
out/npm/ \
rebuild: clean build
clean:
rm -rf bin
rm -rf out
out/static/version.txt:
@mkdir --parents $(@D)
echo $(VERSION) > $@
out/static/openapi.yaml: src/openapi.yaml
@mkdir --parents $(@D)
sed 's/0.0.0-local/$(VERSION)/' $< > $@
out/static/openapi.json: out/static/openapi.yaml
@mkdir --parents $(@D)
`npm bin`/js-yaml $< > $@
out/static/index.html: out/static/openapi.yaml
@mkdir --parents $(@D)
`npm bin`/redoc-cli bundle $< --output $@
out/npm/: out/static/openapi.yaml
`npm bin`/oas3ts-generator package \
--package-dir $@ \
--package-name $(PACKAGE_NAME) \
--request-type application/json \
--response-type application/json \
--response-type application/x-ndjson \
--response-type text/plain \
--response-type application/octet-stream \
$<
( cd $@ ; npm install --unsafe-perm )
.PHONY: \
build \
rebuild \
clean \