1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00

fix(lockfile): don't touch lockfile is npm specifiers are identical (#17973)

We were unconditionally inserting npm specifiers into the lockfile,
marking it as "dirty" and requiring saving.
This commit is contained in:
Bartek Iwańczuk 2023-02-27 21:02:19 +01:00 committed by Yoshiya Hinosawa
parent f1c756f589
commit 5149d07335

View file

@ -297,12 +297,17 @@ Use \"--lock-write\" flag to regenerate the lockfile at \"{}\".",
serialized_package_req: String, serialized_package_req: String,
serialized_package_id: String, serialized_package_id: String,
) { ) {
let maybe_prev = self.content.npm.specifiers.get(&serialized_package_req);
if maybe_prev.is_none() || maybe_prev != Some(&serialized_package_id) {
self.has_content_changed = true;
}
self self
.content .content
.npm .npm
.specifiers .specifiers
.insert(serialized_package_req, serialized_package_id); .insert(serialized_package_req, serialized_package_id);
self.has_content_changed = true;
} }
} }