mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-31 13:32:18 -04:00
fix: uninstall should remove dependency from any property
This commit is contained in:
@@ -46,14 +46,6 @@ export async function uninstallInContext (pkgsToUninstall: string[], ctx: PnpmCo
|
||||
const pkgJsonPath = path.join(ctx.root, 'package.json')
|
||||
const saveType = getSaveType(opts)
|
||||
const pkg = await removeDeps(pkgJsonPath, pkgsToUninstall, saveType)
|
||||
if (ctx.shrinkwrap.dependencies) {
|
||||
for (let depName in ctx.shrinkwrap.dependencies) {
|
||||
if (!isDependentOn(pkg, depName)) {
|
||||
delete ctx.shrinkwrap.dependencies[depName]
|
||||
delete ctx.shrinkwrap.specifiers[depName]
|
||||
}
|
||||
}
|
||||
}
|
||||
const newShr = await pruneShrinkwrap(ctx.shrinkwrap, pkg)
|
||||
const removedPkgIds = await removeOrphanPkgs(ctx.privateShrinkwrap, newShr, ctx.root, ctx.storePath)
|
||||
await saveShrinkwrap(ctx.root, newShr)
|
||||
@@ -67,15 +59,6 @@ export async function uninstallInContext (pkgsToUninstall: string[], ctx: PnpmCo
|
||||
await removeOuterLinks(pkgsToUninstall, path.join(ctx.root, 'node_modules'), {storePath: ctx.storePath})
|
||||
}
|
||||
|
||||
function isDependentOn (pkg: Package, depName: string): boolean {
|
||||
return [
|
||||
'dependencies',
|
||||
'devDependencies',
|
||||
'optionalDependencies',
|
||||
]
|
||||
.some(deptype => pkg[deptype] && pkg[deptype][depName])
|
||||
}
|
||||
|
||||
async function removeOuterLinks (
|
||||
pkgsToUninstall: string[],
|
||||
modules: string,
|
||||
|
||||
Reference in New Issue
Block a user