hunk.code_window:   const pkgJson = await readPkg()
     t.equal(pkgJson.dependencies, undefined, 'is-negative has been removed from dependencies')
   })
   test('uninstall scoped package', async function (t) {
     const project = prepare(t)
     await installPkgs(['@zkochan/logger@0.1.0'], testDefaults({ save: true }))
  
hunk.labels: keep keep keep add keep keep keep
hunk.after_edit: test('uninstall package and remove from appropriate property', async function (t: tape.Test) {
     const project = prepare(t)
     await installPkgs(['is-negative@2.1.0'], testDefaults({ saveDev: true }))
     await uninstall(['is-negative'], testDefaults())
     await project.storeHasNot('is-negative', '2.1.0')
     await project.hasNot('is-negative')
     const pkgJson = await readPkg()
     t.equal(pkgJson.dependencies, undefined, 'is-negative has been removed from dependencies')
   })
  
hunk.file_path: test/uninstall.ts
hunk.type: add
file: import fs = require('mz/fs')
  import path = require('path')
  import flatten = require('arr-flatten')
  import pFilter = require('p-filter')
  import logger from 'pnpm-logger'
  
  export default async function (modules: string): Promise<string[]> {
    const dirs = await getDirectories(modules)
    const subdirs = await Promise.all(
      dirs.map((dir: string): Promise<string[]> => {
        return isScopedPkgsDir(dir) ? getDirectories(dir) : Promise.resolve([dir])
      })
    )
    return flatten(subdirs)
  }
  
  async function getDirectories (srcPath: string): Promise<string[]> {
    let dirs: string[]
    try {
      dirs = await fs.readdir(srcPath)
    } catch (err) {
      if ((<NodeJS.ErrnoException>err).code !== 'ENOENT') {
        throw err
      }
      dirs = []
    }
    return pFilter(
      dirs
        .filter(relativePath => relativePath[0] !== '.') // ignore directories like .bin, .store, etc
        .map(relativePath => path.join(srcPath, relativePath)),
      async (absolutePath: string) => {
        try {
          const stats = await fs.stat(absolutePath)
          return stats.isDirectory()
        } catch (err) {
          if (err!.code !== 'ENOENT') throw err
          logger.warn(`Cannot find file at ${absolutePath} although it was listed by readdir`)
          return false
        }
      }
    )
  }
  
  function isScopedPkgsDir (dirPath: string) {
    return path.basename(dirPath)[0] === '@'
  }
  