From 2cb7b2709d05610361a00921aca5f5924faf6840 Mon Sep 17 00:00:00 2001 From: "Nurul Huda (Apon)" Date: Tue, 2 Jun 2026 17:15:07 +0600 Subject: [PATCH] fix: wasi run step --- README.md | 6 ++++++ example/build.zig | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2432015..6ae8587 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,12 @@ cd temporalz ```bash zig build run + +# Node.js +zig build run -Dtarget=wasm32-freestanding + +# wasmtime +zig build run -Dtarget=wasm32-wasi ``` #### Run Tests diff --git a/example/build.zig b/example/build.zig index 5b93c18..b121d51 100644 --- a/example/build.zig +++ b/example/build.zig @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void { }); exe.root_module.addImport("temporalz", temporalz.module("temporalz")); b.installArtifact(exe); - b.enable_wasmtime = true; + b.enable_wasmtime = true; // This doesn't work since Zig 0.17.0 release const run_step = b.step("run", "Run the app"); switch (target.result.os.tag) { @@ -29,6 +29,12 @@ pub fn build(b: *std.Build) void { run_cmd.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_cmd.step); }, + .wasi => { + const run_cmd = b.addSystemCommand(&.{"wasmtime"}); + run_cmd.addFileArg(exe.getEmittedBin()); + run_cmd.step.dependOn(b.getInstallStep()); + run_step.dependOn(&run_cmd.step); + }, else => { const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep());