From fcb6c6ff22aa58ba7f405b55d0d2399f80a66e89 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 3 Apr 2023 14:33:11 -0700 Subject: [PATCH] readme --- d2js/README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/d2js/README.md b/d2js/README.md index c0ed2116f2..6728d72af6 100644 --- a/d2js/README.md +++ b/d2js/README.md @@ -1 +1,30 @@ -`GOOS=js GOARCH=wasm go build -ldflags='-s -w' -trimpath -o main.wasm ./d2js` +# D2 as a Javascript library + +D2 is runnable as a Javascript library, on both the client and server side. This means you +can run D2 entirely on the browser. + +This is achieved by a JS wrapper around a WASM file. + +## Install + +### NPM + +```sh +npm install @terrastruct/d2 +``` + +### Yarn + +```sh +yarn add @terrastruct/d2 +``` + +## Build + +```sh +GOOS=js GOARCH=wasm go build -ldflags='-s -w' -trimpath -o main.wasm ./d2js +``` + +## API + +todo