fix: don't remove importers from current lockfile

When doing some operations on a subset of workspace
packages, do not remove the not selected packages
from the current lockfile (node_modules/.pnpm-lock.yaml)
This commit is contained in:
Zoltan Kochan
2019-06-01 23:12:22 +03:00
parent 3a7dd9edad
commit d8215d2af1
2 changed files with 2 additions and 1 deletions

View File

@@ -286,7 +286,7 @@ export default async function linkPackages (
const importers = importerIds.reduce((acc, importerId) => {
acc[importerId] = newWantedLockfile.importers[importerId]
return acc
}, {})
}, opts.currentLockfile.importers)
currentLockfile = { ...newWantedLockfile, packages, importers }
} else if (
opts.include.dependencies &&

View File

@@ -123,6 +123,7 @@ test('dependencies of other importers are not pruned when installing for a subse
await rootNodeModules.has('.localhost+4873/is-negative/1.0.0')
const lockfile = await rootNodeModules.readCurrentLockfile()
t.deepEqual(Object.keys(lockfile.importers), ['project-1', 'project-2'])
t.deepEqual(Object.keys(lockfile.packages), [
'/is-negative/1.0.0',
'/is-positive/2.0.0',