hunk.code_window:   is-ci: ^1.0.10
     isexe: ^2.0.0
     mkdirp: ^0.5.1
     npm-run-all: ^4.0.1
     pnpm-registry-mock: ^1.7.0
     read-pkg: ^2.0.0
     rimraf: ^2.5.4
     sepia: ^2.0.2
     sinon: ^2.4.1
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit:   pnpm-registry-mock: ^1.8.0
  
hunk.file_path: test/shrinkwrap.yaml
hunk.type: replace
file: import loadJsonFile = require('load-json-file')
  import writePkg = require('write-pkg')
  import {DependenciesType, dependenciesTypes} from './getSaveType'
  import {Package} from './types'
  
  export default async function (
    pkgJsonPath: string,
    removedPackages: string[],
    saveType?: DependenciesType
  ): Promise<Package> {
    const packageJson = await loadJsonFile(pkgJsonPath)
  
    if (saveType) {
      packageJson[saveType] = packageJson[saveType]
  
      if (!packageJson[saveType]) return packageJson
  
      removedPackages.forEach(dependency => {
        delete packageJson[saveType][dependency]
      })
    } else {
      dependenciesTypes
        .filter(deptype => packageJson[deptype])
        .forEach(deptype => {
          removedPackages.forEach(dependency => {
            delete packageJson[deptype][dependency]
          })
        })
    }
  
    await writePkg(pkgJsonPath, packageJson)
    return packageJson
  }
  