Skip to content

Commit

Permalink
Add instructions to README for using crate and publishing (#93)
Browse files Browse the repository at this point in the history
* Add instructions to README for using crate and publishing

* Move publish into a script
  • Loading branch information
jeffcharles authored Mar 16, 2022
1 parent 54ef7b3 commit a3f958a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/quickjs-wasm-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ let input_value = messagepack::transcode_input(&context, input_bytes).unwrap();
let output_value: Value = ...;
let output = messagepack::transcode_output(output_value).unwrap();
```

## Building a project using this crate

- Install the [wasi-sdk](https://github.com/WebAssembly/wasi-sdk#install) for your platform
- Set the `QUICKJS_WASM_SYS_WASI_SDK_PATH` environment variable to the absolute path where you installed the `wasi-sdk`

For example, if you install the `wasi-sdk` in `/opt/wasi-sdk`, you can run:
```bash
export QUICKJS_WASM_SYS_WASI_SDK_PATH=/opt/wasi-sdk
```

## Publishing to crates.io

To publish this crate to crates.io, run `./publish.sh`.
10 changes: 10 additions & 0 deletions crates/quickjs-wasm-rs/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

if [[ -z $QUICKJS_WASM_SYS_WASI_SDK_PATH ]]; then
echo "QUICKJS_WASM_SYS_WASI_SDK_PATH must be set to a path with a downloaded wasi-sdk" 1>&2
exit 1
fi

cargo publish --target=wasm32-wasi

0 comments on commit a3f958a

Please sign in to comment.