d2/d2js/README.md
Alexander Wang a541c14e0e
init
2024-12-29 09:50:15 -07:00

30 lines
428 B
Markdown

# 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