fix: wasi run step

This commit is contained in:
Nurul Huda (Apon) 2026-06-02 17:15:07 +06:00
parent df3b636f35
commit 2cb7b2709d
No known key found for this signature in database
GPG key ID: 5D3F1DE2855A2F79
2 changed files with 13 additions and 1 deletions

View file

@ -81,6 +81,12 @@ cd temporalz
```bash ```bash
zig build run zig build run
# Node.js
zig build run -Dtarget=wasm32-freestanding
# wasmtime
zig build run -Dtarget=wasm32-wasi
``` ```
#### Run Tests #### Run Tests

View file

@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void {
}); });
exe.root_module.addImport("temporalz", temporalz.module("temporalz")); exe.root_module.addImport("temporalz", temporalz.module("temporalz"));
b.installArtifact(exe); 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"); const run_step = b.step("run", "Run the app");
switch (target.result.os.tag) { switch (target.result.os.tag) {
@ -29,6 +29,12 @@ pub fn build(b: *std.Build) void {
run_cmd.step.dependOn(b.getInstallStep()); run_cmd.step.dependOn(b.getInstallStep());
run_step.dependOn(&run_cmd.step); 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 => { else => {
const run_cmd = b.addRunArtifact(exe); const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep()); run_cmd.step.dependOn(b.getInstallStep());