choose correct resolved package for peer dependencies (#7192)

* fix sometimes failing install test

* loop to make sure it happens
This commit is contained in:
Dylan Conway
2023-11-17 19:15:47 -08:00
committed by GitHub
parent 075c09401a
commit f5bf67bd1b
2 changed files with 27 additions and 25 deletions

View File

@@ -2793,10 +2793,6 @@ pub const PackageManager = struct {
) !?ResolvedPackageResult {
name.assertDefined();
if (resolution < this.lockfile.packages.len) {
return .{ .package = this.lockfile.packages.get(resolution) };
}
if (install_peer and behavior.isPeer()) {
if (this.lockfile.package_index.get(name_hash)) |index| {
const resolutions: []Resolution = this.lockfile.packages.items(.resolution);
@@ -2875,6 +2871,10 @@ pub const PackageManager = struct {
}
}
if (resolution < this.lockfile.packages.len) {
return .{ .package = this.lockfile.packages.get(resolution) };
}
switch (version.tag) {
.npm, .dist_tag => {
if (version.tag == .npm) {