-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Verify canary release
- I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
Which canary version will you have in your reproduction?
2.6.1-canary.1
Environment information
Expected behavior
turbo prune should be able to keep necessary packages and snapshots in the lockfile, when hard links exist.
I've also created a reproduction
Actual behavior
Hard linked deps are being removed after turbo prune.
This causes pnpm install --frozen-lockfile to fail
To Reproduce
written in the repro README.md
Additional context
I dug into the turborepo code and I think it's something with the pruned_packages_and_snapshots function
it seems like it tries to handle injected workspaces but it looks like it handles only meta.injected which is no longer the only way in pnpm to have hardlinks.
A snapshot of the code that I think might cause the problem
let (mut pruned_packages, pruned_snapshots) =
self.pruned_packages_and_snapshots(packages)?;
for importer in importers.values() {
// Find all injected packages in each workspace and include it in
// the pruned lockfile
for dependency in
importer
.dependencies_meta
.iter()
.flatten()
.filter_map(|(dep, meta)| match meta.injected {
Some(true) => Some(dep),
_ => None,
})
{
let (_, version) = importer
.dependencies
.find_resolution(dependency)
.ok_or_else(|| Error::MissingInjectedPackage(dependency.clone()))?;
let entry = self
.get_packages(version)
.ok_or_else(|| crate::Error::MissingPackage(version.into()))?;
pruned_packages.insert(version.to_string(), entry.clone());
}MortenOftedal and simensfo