-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
38 lines (29 loc) · 939 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
28
29
30
31
32
33
34
35
36
37
38
GOROOT := $(shell go env GOROOT)
TARGET_FILES := \
pcdeditor.esm.js \
pcdeditor.wasm \
wasm_exec.js \
ReactPCDEditor/index.js
.PHONY: serve
serve: pcdeditor.wasm wasm_exec.js pcdeditor.esm.js
go run ./examples/serve
pcdeditor.esm.js: pcdeditor.js
sed 's/module\.exports = /export default /' $< > $@
ReactPCDEditor/index.js: ReactPCDEditor/index.tsx package.json tsconfig.json
pnpm tsc
pcdeditor.wasm: *.go go.*
GOOS=js GOARCH=wasm go build \
-ldflags="-s -w -X 'main.Version=$(shell git rev-parse --short HEAD)' -X 'main.BuildDate=$(shell git show -s --format=%ci HEAD)'" -o $@ .
wasm_exec.js: $(GOROOT)/misc/wasm/wasm_exec.js
cp $< $@
.PHONY: target-files
target-files: $(TARGET_FILES)
.PHONY: pack
pack: target-files
pnpm pack
.PHONY: version
version-$(VERSION):
pnpm version $(VERSION) --allow-same-version --no-git-tag-version
.PHONY: publish
publish-$(VERSION):
pnpm publish seqsense-pcdeditor-$(VERSION).tgz