From 25dda6b31e9a9be6f92873249ef3e1c13c1754a2 Mon Sep 17 00:00:00 2001 From: "Nurul Huda (Apon)" Date: Thu, 16 Apr 2026 00:24:00 +0600 Subject: [PATCH] chore: use b.enable_wasmtime --- build.zig | 24 +++++------------------- example/build.zig | 7 +------ 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/build.zig b/build.zig index dadf93c..e424d76 100644 --- a/build.zig +++ b/build.zig @@ -43,25 +43,11 @@ pub fn build(b: *std.Build) !void { // --- Steps: Run --- // { const run_step = b.step("run", "Run the app"); - switch (target.result.os.tag) { - .freestanding => { - const run_cmd = b.addSystemCommand(&.{ "node", "example/src/main.mjs" }); - 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()); - if (b.args) |args| run_cmd.addArgs(args); - run_step.dependOn(&run_cmd.step); - }, - } + const run_cmd = b.addSystemCommand(&.{ b.graph.zig_exe, "build", "run" }); + run_cmd.setCwd(b.path("example")); + + if (b.args) |args| run_cmd.addArgs(args); + run_step.dependOn(&run_cmd.step); } // --- Steps: Docs --- // diff --git a/example/build.zig b/example/build.zig index 2ff2227..44975b2 100644 --- a/example/build.zig +++ b/example/build.zig @@ -20,6 +20,7 @@ pub fn build(b: *std.Build) void { }); exe.root_module.addImport("temporalz", temporalz.module("temporalz")); b.installArtifact(exe); + b.enable_wasmtime = true; const run_step = b.step("run", "Run the app"); switch (target.result.os.tag) { @@ -28,12 +29,6 @@ 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());