From what I’ve understood up til now, in your build.zig.zon, its recommended to list out in the paths field the files and directories that actually make up your package because the ones listed are the ones used to generate the hash that uniquely identifies it. If you’re sure that all the files are always just the ones needed for this, you can leave the empty string "" like you have now, which uses all the files to create the hash.
In you build.zig you can define a module to be imported by users of your lib with addModule, for example:
_ = b.addModule("zig-string", .{
.root_source_file = b.path("src/string.zig"),
.target = target,
.optimize = optimize,
});
If all your public API is in that file, then that’s pretty much it. You can then create tag your commit, say v0.1.0 and users of your lib can do a:
zig fetch --save https://github.com/jnordwick/zig-string/archive/v0.1.0.tar.gz
To add the dependency to their build.zig.zon. Then in their build.zig they can add your module to their executable for example:
const zs = b.dependency("zig-string", .{});
//...
exe.root_module.addImport("zig-string", zs.module("zig-string"));
Then in their source file:
const zs = @import("zig-string");
In your local packages, you can add a path dependency in build.zig.zon
dependencies = .{
.zig-string = .{ .path = "../zig-string" },
},
I haven’t tested it, but I think the dash in zig-string is going to be a problem. If so, I believe zig fetch allows an extra arg after the URL to specify an alternate name for the dependency.
EDIT: Just did a zig fetch and it adds it as @"zig-string to avoid the problem with the dash. So it should all work.