From 70994ddaf48a92d062977bc667c72685a4ccb815 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 18 May 2026 17:02:32 +0200 Subject: try to use bun for bundling --- build.zig | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 0f3fbf1..9379b10 100644 --- a/build.zig +++ b/build.zig @@ -9,6 +9,9 @@ pub fn build(b: *std.Build) void { const disable_auth = b.option(bool, "disable-auth", "disable-authentication") orelse false; opts.addOption(bool, "disable_auth", disable_auth); + const static_path = b.option([]const u8, "static-path", "static-path") orelse "zig-out/dist"; + opts.addOption([]const u8, "static_path", static_path); + const mod = b.addModule("memora", .{ .root_source_file = b.path("src/root.zig"), .target = target, @@ -29,11 +32,29 @@ pub fn build(b: *std.Build) void { }, }), }); - exe.linkLibC(); b.installArtifact(exe); + const fonts_dist = b.addSystemCommand( + &.{ "cp", "-r", "static/fonts", "zig-out/dist" }, + ); + + const dist = b.addSystemCommand( + &.{ + "bun", + "build", + "static/index.html", + "--outdir", + "zig-out/dist", + "--loader", + ".css:text" + } + ); + + b.default_step.dependOn(&dist.step); + dist.step.dependOn(&fonts_dist.step); + const run_step = b.step("run", "Run the app"); const run_cmd = b.addRunArtifact(exe); -- cgit v1.2.3-70-g09d2