From f2cfa15e4ef9d730fc6842ad8b79fb7ab4c71cb9 Mon Sep 17 00:00:00 2001 From: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Date: Tue, 14 May 2024 04:10:33 +0000 Subject: [PATCH] fix(install): make sure each `has_install_script` value is updated (#11051) Co-authored-by: Jarred Sumner --- src/install/lockfile.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig index 267423cb97..ad546346bf 100644 --- a/src/install/lockfile.zig +++ b/src/install/lockfile.zig @@ -5015,8 +5015,14 @@ pub const Package = extern struct { @memcpy(bytes, stream.buffer[stream.pos..][0..bytes.len]); stream.pos = end_pos; if (comptime strings.eqlComptime(field.name, "meta")) { - if (value.len != 0 and value[0].needsUpdate()) { - needs_update = true; + // need to check if any values were created from an older version of bun + // (currently just `has_install_script`). If any are found, the values need + // to be updated before saving the lockfile. + for (value) |*meta| { + if (meta.needsUpdate()) { + needs_update = true; + break; + } } } } else if (comptime strings.eqlComptime(field.name, "scripts")) {