diff --git a/.gitignore b/.gitignore index 949626c..b97dcc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.wasm *.ndp -tmp \ No newline at end of file +tmp +discord-rich-presence \ No newline at end of file diff --git a/Makefile b/Makefile index 2a74ccb..c6cccc5 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,18 @@ SHELL := /usr/bin/env bash PLUGIN_NAME := discord-rich-presence WASM_FILE := plugin.wasm +TINYGO := $(shell command -v tinygo 2> /dev/null) test: go test -race ./... build: +ifdef TINYGO tinygo build -opt=2 -scheduler=none -no-debug -o $(WASM_FILE) -target wasi -buildmode=c-shared . +else + GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o $(WASM_FILE) . +endif + package: build zip $(PLUGIN_NAME).ndp $(WASM_FILE) manifest.json