diff --git a/.gitignore b/.gitignore index 5d1402e4..66610a23 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ target/ /crates/wasmtime-test /test.js /shared -example/package-lock.json -example/hello.component.wasm +examples/hello-world/guest/package-lock.json +examples/hello-world/guest/hello.component.wasm /build-debug /build-release /build-release-weval diff --git a/EXAMPLE.md b/EXAMPLE.md index 0f40b3ef..d1a95411 100644 --- a/EXAMPLE.md +++ b/EXAMPLE.md @@ -44,9 +44,9 @@ node componentize.mjs ### Running the Component in Wasmtime -Set up the [Cargo.toml as in the example directory](example/Cargo.toml). +Set up the [Cargo.toml as in the example directory](examples/hello-world/host/Cargo.toml). -Set up [`src/main.rs`](example/src/main.rs) as in the example directory. +Set up [`src/main.rs`](examples/hello-world/host/src/main.rs) as in the example directory. Building and running the binary should print the result: diff --git a/examples/hello-world/guest/hello.component.wasm b/examples/hello-world/guest/hello.component.wasm deleted file mode 100644 index 9bf27ec6..00000000 Binary files a/examples/hello-world/guest/hello.component.wasm and /dev/null differ diff --git a/examples/hello-world/test.sh b/examples/hello-world/test.sh index f87cd828..7d2d4f9a 100755 --- a/examples/hello-world/test.sh +++ b/examples/hello-world/test.sh @@ -7,13 +7,13 @@ export TEST_BINARY_PATH=$(realpath host)/target/release/wasmtime-test # Build the JS component if not present echo -e "[info] expecting component WASM at [$COMPONENT_WASM_PATH]..."; if [ ! -f "$COMPONENT_WASM_PATH" ]; then - cd guest && npm install && npm build + cd guest && npm install && npm run build && cd .. fi # Build the Rust embedding test binary if not present -echo -e "[info] expecting test binary at [$COMPONENT_WASM_PATH]..."; +echo -e "[info] expecting test binary at [$TEST_BINARY_PATH]..."; if [ ! -f "$TEST_BINARY_PATH" ]; then - cd host && cargo build --release + cd host && cargo build --release && cd .. fi # Run the test binary, capturing the output