Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed Jan 18, 2024
1 parent 2e202c6 commit 955b649
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,27 @@ setup:
rustup target add wasm32-unknown-unknown
command -v cargo-binstall || curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
command -v cargo-component || cargo binstall cargo-component -y
if ! command -v node; then \
if [ "$$OS" = "Windows_NT" ]; then \
curl -sS https://webi.sh/node | sh; \
else \
curl.exe https://webi.ms/node | powershell; \
fi \
fi
command -v node || { echo 'Please install Node.js manually'; exit 1; }
command -v jco || npm install -g @bytecodealliance/jco
command -v deno || curl -fsSL https://deno.land/install.sh | sh
command -v bun || curl -fsSL https://bun.sh/install | bash
command -v python3 || { echo 'Please install Python manually'; exit 1; }
command -v wit-bindgen || cargo binstall --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-cli -y
command -v static-web-server || cargo binstall static-web-server -y
command -v wasm-tools || cargo binstall wasm-tools -y

test-js:
cd tests/js; \
set -e; cd tests/js; \
[ -d node_modules ] || npm install; \
npm run build; \
npm test

test-rs:
# https://github.com/bytecodealliance/wasmtime/issues/7784
# cargo test -p tests-rs
cargo test -p tests-rs || true

test-py:
cd tests/py; \
set -e; cd tests/py; \
[ -d .venv ] || $(MAKE) venv; \
$(MAKE) fetch; \
$(MAKE) build; \
Expand All @@ -48,7 +43,7 @@ test-py:
test: test-js test-rs test-py

publish:
version=$$(cargo pkgid | cut -d'#' -f2 | cut -d'@' -f2); \
set -e; version=$$(cargo pkgid | cut -d'#' -f2 | cut -d'@' -f2); \
echo -n | gh release create \
"v$$version" \
--generate-notes \
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# unicode-math-class for WebAssembly

🦀
🦀 [unicode-math-class] Rust crate compiled to a [WebAssembly component]

🟪 Compiles [unicode-math-class] to a WebAssembly component \
🏷️ Uses [unicode-math-class] v0.1.0
<p align=center>

</p>

🏷️ Uses [unicode-math-class] v0.1.0 \
🟪 Distributed as WebAssembly to run anywhere \
🤝 Composes well with other WebAssembly components

**👀 You might be looking for the [JavaScript bindings] or the [Python
bindings].**

## Usage

![WebAssembly](https://img.shields.io/static/v1?style=for-the-badge&message=WebAssembly&color=654FF0&logo=WebAssembly&logoColor=FFFFFF&label=)

🛑 You might be interested in the premade bindings for [JavaScript].

You can also download the [unicode-math-class.wasm] WebAssembly component file
from [this repository's GitHub releases page]. To actually _use_ the WebAssembly
You can download the [unicode-math-class.wasm] WebAssembly component file from
[this repository's GitHub releases page]. To actually _use_ the WebAssembly
component, you'll need to use a [WebAssembly component host runtime].

[![Download](https://img.shields.io/static/v1?style=for-the-badge&message=Download&color=24A47F&logo=GitHub&logoColor=FFFFFF&label=)]()
Expand Down Expand Up @@ -40,4 +46,6 @@ using it in JavaScript and Rust. Use `make build-docs` to build the docs. Run

<!-- prettier-ignore-start -->
[the `make publish` workflow]: https://github.com/jcbhmr/unicode-math-class.wasm/actions/workflows/make-publish.yml
[unicode-math-class]: https://crates.io/crates/unicode-math-class

<!-- prettier-ignore-end -->
8 changes: 4 additions & 4 deletions tests/py/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PYTHON := python3.12
PYTHON := python3
WORLD := unicode-math-class

.PHONY: build
build:
. .venv/bin/activate; \
set -e; . .venv/bin/activate; \
python -m wasmtime.bindgen \
../../target/wasm32-unknown-unknown/$(if $(RELEASE),release,debug)/$(WORLD).wasm \
--out-dir build

fetch:
. .venv/bin/activate; \
set -e; . .venv/bin/activate; \
python -m pip install -r requirements.txt

venv:
Expand All @@ -22,5 +22,5 @@ shell:
exec bash -c 'exec bash --rcfile <(echo ". ~/.bashrc; . .venv/bin/activate")'

test:
. .venv/bin/activate; \
set -e; . .venv/bin/activate; \
python -m unittest

0 comments on commit 955b649

Please sign in to comment.