authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-01 01:25:18 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-01 01:31:05 -08:00
log2177ace328e18d8452078f7d62b42c8ded35fe50
tree37f4a3734c8a766515d89fc1ac8f682cc7345430
parent6c0021b9315cc1450ca37f2f56493b6b4548a413

cmd/init: write a deps.zig so zls doesn't get mad when u open the new files


1 files changed, 22 insertions(+), 0 deletions(-)

src/cmd/init.zig+22
......@@ -9,6 +9,8 @@ const time = @import("time");
99const extras = @import("extras");
1010
1111const u = @import("./../util/funcs.zig");
12const common = @import("./../common.zig");
13const zigmod = @import("./../lib.zig");
1214
1315//
1416//
......@@ -288,6 +290,26 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
288290 );
289291 }
290292 }
293
294 // write a deps.zig
295 {
296 const alloc = gpa;
297 const cachepath = try u.find_cachepath();
298 const dir = std.fs.cwd();
299
300 var options = common.CollectOptions{
301 .log = true,
302 .update = false,
303 .alloc = alloc,
304 };
305 const top_module = try common.collect_deps_deep(cachepath, dir, &options);
306
307 var list = std.ArrayList(zigmod.Module).init(alloc);
308 try common.collect_pkgs(top_module, &list);
309
310 const fetch = @import("./fetch.zig");
311 try fetch.create_depszig(alloc, cachepath, dir, top_module, &list);
312 }
291313}
292314
293315pub fn writeExeManifest(w: std.fs.File.Writer, id: string, name: string, license: ?string, description: ?string) !void {