jetzig-framework / jetzig

Jetzig is a web framework written in Zig
MIT License
457 stars 21 forks source link

build.zig.zon file is missing when running "jetzig init" on Windows #75

Closed rhues closed 3 months ago

rhues commented 3 months ago

Using Zig 0.12.0 on both the latest Ubuntu and Windows 11 and the jetzig downloaded today 2024-05-24.

When running jetzig init, the resulting project in Windows is missing the build.zig.zon file, but the Ubuntu project has it.

The result is the message in Windows:

error: no module named 'jetzig' available within module root.@build

rhues commented 3 months ago

In https://github.com/jetzig-framework/jetzig/blob/main/cli/commands/init.zig, there is this code at line 97 to create the build.zig file in the new project:

try copySourceFile(
    allocator,
    install_dir,
    "demo/build.zig",
    "build.zig",
    &[_]Replace{.{ .from = "jetzig-demo", .to = project_name }},
);

I think there should be a block of code like this for build.zig.zon, but there is no reference at all to build.zig.zon in init.zig.

bobf commented 3 months ago

@rhues The reason we don't create build.zig.zon is because running zig fetch ... automatically creates one, so it is likely that command that is failing.

Could you try running this command directly ?

zig fetch --save=jetzig https://github.com/jetzig-framework/jetzig/archive/a0faada748a99d8665fedbe5a1c1c05e26664d78.tar.gz
rhues commented 3 months ago

After rebuilding, the problem was corrected, and build.zig.zon was fetched successfully.