tpmccallum$ wasm-pack test --node
[INFO]: 🎯 Checking for the Wasm target...
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
[INFO]: ⬇️ Installing wasm-bindgen...
Finished test [unoptimized + debuginfo] target(s) in 0.09s
Running target/wasm32-unknown-unknown/debug/deps/headless-f2eded3f78b0be11.wasm
this test suite is only configured to run in a browser, but we're only testing node.js tests so skipping
Running target/wasm32-unknown-unknown/debug/deps/non_wasm-07c17dc01af19677.wasm
no tests to run!
#System housekeeping
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential
sudo apt-get -y install curl
#Install Node and NPM
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install npm
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity_no="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<script>
if (!('WebAssembly' in window)) {
alert('you need a browser with wasm support enabled :(');
}
(async () => {
const response = await fetch('triple.wasm');
cd ~/triple
cargo build - release
cp -rp ~/triple/target/wasm32-wasi/release/triple_lib.wasm /var/www/html/triple.wasm
#[no_mangle]
pub extern fn triple(x: i32) -> i32 {
return 3 * x;
}
[build]
target = "wasm32-wasi"
[lib]
name = "triple_lib"
path = "src/triple.rs"
crate-type =["cdylib"]
cd ~
cargo new --lib triple
cd triple
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install apache2
sudo chown -R $USER:$USER /var/www/html
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup target add wasm32-wasi
rustup override set nightly
Run all of the following Ubuntu system set up commands (update, install Apache2 and Rust)
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install apache2
sudo chown -R $USER:$USER /var/www/html
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup target add wasm32-wasi
rustup override set nightly