summaryrefslogtreecommitdiff
path: root/Makefile
blob: e1df60d43ac194304fcab565d7aa407caba1a5b6 (plain)
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
75
TS_FILES = \
	dispatch.ts \
	fetch.ts \
	globals.ts \
	main.ts \
	msg.pb.d.ts \
	msg.pb.js \
	os.ts \
	runtime.ts \
	timers.ts \
	tsconfig.json \
	types.ts \
	url.js \
	util.ts \
	v8_source_maps.ts \
	v8worker2.d.ts

GO_FILES = \
	assets.go \
	deno_dir.go \
	deno_dir_test.go \
	dispatch.go \
	echo.go \
	fetch.go \
	main.go \
	msg.pb.go \
	os.go \
	os_test.go \
	timers.go \
	util.go

deno: msg.pb.go $(GO_FILES)
	go build -o deno

assets.go: dist/main.js
	cp node_modules/typescript/lib/lib.*d.ts dist/
	cp deno.d.ts dist/
	go-bindata -pkg main -o assets.go dist/

msg.pb.go: msg.proto
	protoc --go_out=. msg.proto

msg.pb.js: msg.proto node_modules
	./node_modules/.bin/pbjs -t static-module -w commonjs -o msg.pb.js msg.proto

msg.pb.d.ts: msg.pb.js node_modules
	./node_modules/.bin/pbts -o msg.pb.d.ts msg.pb.js

dist/main.js: $(TS_FILES) node_modules
	./node_modules/.bin/tsc --noEmit # Only for type checking.
	./node_modules/.bin/parcel build --out-dir=dist/ --no-minify main.ts

node_modules:
	yarn

clean:
	-rm -f deno assets.go msg.pb.go msg.pb.js msg.pb.d.ts
	-rm -rf dist/

distclean: clean
	-rm -rf node_modules/

lint: node_modules
	yarn lint
	go vet

fmt: node_modules
	yarn fmt
	go fmt
	clang-format msg.proto -i

test: deno
	go test -v

.PHONY: test lint clean distclean