aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
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);