mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-24 18:11:39 -04:00
23 lines
613 B
TypeScript
23 lines
613 B
TypeScript
import {ignoreCache as readPkg} from './fs/readPkg'
|
|
import writePkg = require('write-pkg')
|
|
import {DependenciesType} from './getSaveType'
|
|
import {Package} from './types'
|
|
|
|
export default async function (
|
|
pkgJsonPath: string,
|
|
removedPackages: string[],
|
|
saveType: DependenciesType
|
|
): Promise<Package> {
|
|
const packageJson = await readPkg(pkgJsonPath)
|
|
packageJson[saveType] = packageJson[saveType]
|
|
|
|
if (!packageJson[saveType]) return packageJson
|
|
|
|
removedPackages.forEach(dependency => {
|
|
delete packageJson[saveType][dependency]
|
|
})
|
|
|
|
await writePkg(pkgJsonPath, packageJson)
|
|
return packageJson
|
|
}
|