-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Handle pnpm resolving a dependency to multiple versions #2090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
cli/internal/context/context.go
Outdated
@@ -277,7 +277,7 @@ func (c *Context) populateTopologicGraphForPackageJSON(pkg *fs.PackageJSON, root | |||
pkg.TransitiveDeps = []string{} | |||
seen := mapset.NewSet() | |||
var lockfileWg sync.WaitGroup | |||
c.resolveDepGraph(&lockfileWg, pkg.UnresolvedExternalDeps, externalDepSet, seen, pkg) | |||
c.resolveDepGraph(&lockfileWg, pkg.Name, pkg.UnresolvedExternalDeps, externalDepSet, seen, pkg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be passing down pkg.Dir.ToUnixPath().ToString()
since both pnpm and Yarn identify workspace projects by path and not by name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other thing we need to do is to special case on when pkg
is the root package and pass .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to pkg.Dir
and turbopath.AnchoredUnixPath
} | ||
importer, ok := p.Importers[workspace] | ||
if !ok { | ||
return "", false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably panic in this scenario. If we're querying for dependencies of a non-existent workspace we're doing something wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a panic here, are there other comparisons in here where we should panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Played around with it a bit and everything seemed in working order
} | ||
} | ||
pnpmWorkspacePath := workspacePath.ToString() | ||
if pnpmWorkspacePath == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call pushing this into the lockfile implementation
pnpm
can resolve multiple versions of a package. Resolve the package dependency specific to the workspace that asked for it.pnpm-workspace.yaml
so that we don't try to resolve non-existent workspacesFixes #2075