diff --git a/src/cmd/init.zig b/src/cmd/init.zig index 3737db3b423dd2f425cec3d37ae721160689f53a..8741a0883b641f109a03ef7f83b3fb44f2cd8a33 100644 --- a/src/cmd/init.zig +++ b/src/cmd/init.zig @@ -9,6 +9,8 @@ const time = @import("time"); const extras = @import("extras"); const u = @import("./../util/funcs.zig"); +const common = @import("./../common.zig"); +const zigmod = @import("./../lib.zig"); // // @@ -288,6 +290,26 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { ); } } + + // write a deps.zig + { + const alloc = gpa; + const cachepath = try u.find_cachepath(); + const dir = std.fs.cwd(); + + var options = common.CollectOptions{ + .log = true, + .update = false, + .alloc = alloc, + }; + const top_module = try common.collect_deps_deep(cachepath, dir, &options); + + var list = std.ArrayList(zigmod.Module).init(alloc); + try common.collect_pkgs(top_module, &list); + + const fetch = @import("./fetch.zig"); + try fetch.create_depszig(alloc, cachepath, dir, top_module, &list); + } } pub fn writeExeManifest(w: std.fs.File.Writer, id: string, name: string, license: ?string, description: ?string) !void {