chore: update err text for export

This commit is contained in:
Nurul Huda (Apon) 2026-07-13 16:58:17 +06:00
parent 21070e277b
commit 760fdf289d
No known key found for this signature in database
GPG Key ID: 5D3F1DE2855A2F79
3 changed files with 9 additions and 9 deletions

View File

@ -27,11 +27,11 @@ fn bundle(ctx: zli.CommandContext) !void {
const install_prefix = ctx.flag("install-prefix", []const u8);
const program_path = util.resolveExePath(io, ctx.allocator, install_prefix, binpath) catch |err| {
if (err == error.ExecutableNotFound) {
try ctx.writer.print("Run \x1b[34mzig build\x1b[0m to build the ZX executable first!\n", .{});
if (err == error.ExecutableNotFound or err == error.FileNotFound) {
std.log.err("Run \x1b[34mzig build\x1b[0m to build your app first!\n", .{});
return;
}
try ctx.writer.print("Error finding ZX executable! {any}\n", .{err});
std.log.err("Error finding app manifest executable! {any}\n", .{err});
return;
};
defer ctx.allocator.free(program_path);
@ -42,10 +42,10 @@ fn bundle(ctx: zli.CommandContext) !void {
var printer = tui.Printer.init(ctx.allocator, .{ .file_path_mode = .flat, .file_tree_max_depth = 1 });
defer printer.deinit();
printer.header("{s} Bundling ZX site!", .{tui.Printer.emoji("")});
printer.header("{s} Bundling your app!", .{tui.Printer.emoji("")});
printer.info("{s}", .{outdir});
log.debug("Bundling ZX site! binpath={s} staticdir={s}", .{ program_path, staticdir });
log.debug("Bundling your app! binpath={s} staticdir={s}", .{ program_path, staticdir });
log.debug("Outdir: {s}", .{outdir});
const bin_name = std.fs.path.basename(program_path);
@ -68,7 +68,7 @@ fn bundle(ctx: zli.CommandContext) !void {
return err;
};
printer.footer("Now run {s}\n\n{s}(cd {s} && ./{s}{s}", .{ tui.Printer.emoji(""), tui.Colors.cyan, outdir, bin_name, tui.Colors.reset });
printer.footer("Now run {s}\n\n{s}(cd {s} && ./{s}){s}", .{ tui.Printer.emoji(""), tui.Colors.cyan, outdir, bin_name, tui.Colors.reset });
}
const std = @import("std");

View File

@ -115,7 +115,7 @@ fn @"export"(ctx: zli.CommandContext) !void {
var printer = tui.Printer.init(ctx.allocator, .{ .file_path_mode = .flat, .file_tree_max_depth = 1 });
defer printer.deinit();
printer.header("{s} Building static ZX site!", .{tui.Printer.emoji("")});
printer.header("{s} Bundling static site!", .{tui.Printer.emoji("")});
printer.info("{s}", .{outdir});
// delete the outdir if it exists
// std.Io.Dir.cwd().deleteTree(outdir) catch |err| switch (err) {
@ -125,7 +125,7 @@ fn @"export"(ctx: zli.CommandContext) !void {
const staticdir = try std.fs.path.join(ctx.allocator, &.{ DEFAULT_INSTALL_PREFIX, "static" });
defer ctx.allocator.free(staticdir);
log.debug("Building static ZX site! binpath={s} rootdir={s}", .{ exe_path, DEFAULT_INSTALL_PREFIX });
log.debug("Building static app! binpath={s} rootdir={s}", .{ exe_path, DEFAULT_INSTALL_PREFIX });
log.debug("Port: {d}, Outdir: {s}, Staticdir: {s}", .{ port, outdir, staticdir });
log.debug("Processing routes! {d}", .{manifest.routes.len});

View File

@ -63,7 +63,7 @@ pub fn app(comptime H: type, instance: *Server(H), alloc: std.mem.Allocator) !Ap
const holder = try alloc.create(Holder);
holder.* = .{ .instance = instance, .alloc = alloc };
instance.info();
if (impl.cli_cmd != .@"export") instance.info();
return .{ .userdata = @ptrCast(holder), .vtable = &Holder.vtable };
}