Skip to content

Commit

Permalink
Update WASM demo README.
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Jun 19, 2022
1 parent 48f9424 commit 59fe22e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ jobs:
cd trustfall_wasm
wasm-pack build --no-typescript
cp src/trustfall_wasm.d.ts pkg/
# cd pkg/
# tar -czvf ../trustfall_wasm.tar.gz --exclude='.gitignore' .
cd pkg/
tar -czvf ../trustfall_wasm.tar.gz --exclude='.gitignore' .
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand All @@ -259,7 +259,7 @@ jobs:
uses: ncipollo/release-action@v1
if: steps.branch-info.outputs.BRANCH_NAME == 'main' && steps.branch-info.outputs.WASM_CHANGED != 0
with:
artifacts: "trustfall_wasm/pkg/*"
artifacts: "trustfall_wasm/trustfall_wasm.tar.gz"
commit: ${{ steps.branch-info.outputs.COMMIT }}
tag: ${{ steps.branch-info.outputs.TAG_NAME }}
generateReleaseNotes: true
Expand Down
21 changes: 20 additions & 1 deletion trustfall_wasm/www/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# `trustfall_wasm_web` — browser-based demo of using `trustfall_wasm`
# `trustfall_wasm_www` — browser-based demo of using `trustfall_wasm`

A demo web site using the `trustfall_wasm` package with webpack.
It initializes the WASM module, sets up a query adapter, runs a query,
and prints the results to `console.log()`.

See the schema and query adapter used in this demo in the included `index.js`
[file](https://github.com/obi1kenobi/trustfall/tree/main/trustfall_wasm/www/index.js)

## Building and running `trustfall_wasm_www`

Prerequisites:
- a recent Rust environment: [installation instructions](https://www.rust-lang.org/tools/install)
- the `wasm-pack` tool: [installation instructions](https://rustwasm.github.io/wasm-pack/installer/)
- Node v16+ or newer: [installation instructions](https://nodejs.org/en/download/)

First, build `trustfall_wasm` by following the steps in the `trustfall_wasm`
[README.md](https://github.com/obi1kenobi/trustfall/tree/main/trustfall_wasm/README.md).
When this process is complete, you should have a `trustfall_wasm/pkg/` directory in the repo
containing the `trustfall_wasm` WASM module and supporting files.

Then, run `npm install` to install the dependencies for building and running the web server.
Finally, run `npm start` to start the webpack dev server and open a browser tab with
the `trustfall_wasm_www` demo website.
2 changes: 1 addition & 1 deletion trustfall_wasm/www/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "trustfall_wasm_web",
"name": "trustfall_wasm_www",
"version": "0.1.0",
"description": "a demo app running the trustfall query engine in the browser",
"main": "index.js",
Expand Down

0 comments on commit 59fe22e

Please sign in to comment.