aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-05-18 17:02:32 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-05-18 17:02:32 +0200
commit70994ddaf48a92d062977bc667c72685a4ccb815 (patch)
tree262dd69b72804e00356cd8c98bb2a93d5668d368 /build.zig
parent2115198c6a292dce97cfb411e939b10c39ca24c1 (diff)
try to use bun for bundling
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig23
1 files changed, 22 insertions, 1 deletions
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);