Skip to content

Commit

Permalink
Fix rust-wasm-cross
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrikstrid committed Apr 15, 2024
1 parent ecb9b22 commit eaeac1b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions examples/rust-wasm-cross/.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import("./app/pkg/app.js").then((app) => app.main());
5 changes: 2 additions & 3 deletions examples/rust-wasm-cross/.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fi
[[ "$CARGO_INSTALL_ROOT" == "$DEVENV_STATE/cargo-install" ]]
echo "$PATH" | grep -- "$CARGO_INSTALL_ROOT/bin"

cd app
wasm-pack build --target nodejs
wasm-pack build ./app --target nodejs

node <<< "import('./pkg/app.js').then(app => app.main());"
node .test.js
4 changes: 2 additions & 2 deletions examples/rust-wasm-cross/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ edition = "2021"
[dependencies]
wasm-bindgen = "0.2.84"

[workspace]

[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"

[workspace]
12 changes: 7 additions & 5 deletions examples/rust-wasm-cross/devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@

targets = [ "wasm32-unknown-unknown" ];

components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" "rust-std" ];
};

pre-commit.hooks = {
rustfmt.enable = true;
clippy.enable = true;
};
# These break us
# pre-commit.hooks = {
# rustfmt.enable = true;
# clippy.enable = true;
# };

packages = [
pkgs.wasm-pack
pkgs.nodejs
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
frameworks.Security
]);
Expand Down
2 changes: 2 additions & 0 deletions examples/rust-wasm-cross/devenv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ inputs:
inputs:
nixpkgs:
follows: nixpkgs
devenv:
url: path:../../src/modules

0 comments on commit eaeac1b

Please sign in to comment.