-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (57 loc) · 1.68 KB
/
Makefile
File metadata and controls
74 lines (57 loc) · 1.68 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
SRCS = $(wildcard lib/**)
all: dist
.PHONY: deps
deps: node_modules
.PHONY: clean
clean:
pnpm exec tsc -b --clean
rm -rf dist
rm -rf __tests__/dist
rm __tests__/fixtures/*/*.ts
.PHONY: test
test: node_modules
pnpm exec tsc -b
pnpm exec vitest
node_modules: package.json
pnpm install
dist: node_modules tsconfig.json $(SRCS)
pnpm exec tsc
.PHONY: dev
dev:
pnpm tsc -b -w
.PHONY: fixtures
fixtures: dist
$(MAKE) petstore test1 openai
.PHONY: petstore
petstore: __tests__/fixtures/petstore.json dist
node --enable-source-maps dist/bin/index.js \
-i $< \
-o __tests__/fixtures/petstore
pnpm exec prettier --write __tests__/fixtures/petstore
.PHONY: test1
test1: __tests__/fixtures/test1.json dist
node --enable-source-maps dist/bin/index.js \
-i $< \
-o __tests__/fixtures/test1
pnpm exec prettier --write __tests__/fixtures/test1
__tests__/fixtures/openai.json: __tests__/fixtures/openai.yaml
mkdir -p $(@D)
pnpm exec js-yaml $< > $@
__tests__/fixtures/openai.yaml: __tests__/fixtures/openai.yaml
curl https://raw.githubusercontent.com/openai/openai-openapi/refs/heads/master/openapi.yaml --output $@
.PHONY: openai
openai: __tests__/fixtures/openai.json dist
node --enable-source-maps dist/bin/index.js \
-i $< \
-o __tests__/fixtures/openai
pnpm exec prettier --write __tests__/fixtures/openai
# .PHONY: cloudflare
# cloudflare: __tests__/fixtures/cloudflare/openapi.json dist
# node --enable-source-maps dist/bin/index.js \
# -i __tests__/fixtures/cloudflare/openapi.json \
# -o __tests__/fixtures/cloudflare
# pnpm prettier --write __tests__/fixtures/cloudflare
.PHONY: pretty
pretty: node_modules
pnpm exec eslint --fix . || true
pnpm exec prettier --write .