src/index.js
function (opts) {
    var name
    if (opts && opts.name) name = opts.name
    if (opts && opts.package && opts.package.name) name = opts.package.name
    if (!name) throw new TypeError('package name missing')
    opts = defaults(opts, {
      nodeModulesDir: path.resolve(process.cwd(), 'node_modules')
    })
    fs.removeSync(path.resolve(opts.nodeModulesDir, name))
    if (opts.targetPackage) {
      var key = opts.isDev ? 'devDependencies' : 'dependencies'
      var targetPackage = JSON.parse(fs.readFileSync(opts.targetPackage))
      delete targetPackage[key][name]
      fs.writeFileSync(opts.targetPackage, JSON.stringify(targetPackage, null, 2))
    }
  }
function (opts) {
    var name
    if (opts && opts.name) name = opts.name
    if (opts && opts.package && opts.package.name) name = opts.package.name
    if (!name) throw new TypeError('package name missing')
    opts = defaults(opts, {
      nodeModulesDir: path.resolve(process.cwd(), 'node_modules')
    })
    fs.removeSync(path.resolve(opts.nodeModulesDir, name))
    if (opts.targetPackage) {
      var key = opts.isDev ? 'devDependencies' : 'dependencies'
      var targetPackage = JSON.parse(fs.readFileSync(opts.targetPackage))
      delete targetPackage[key][name]
      fs.writeFileSync(opts.targetPackage, JSON.stringify(targetPackage, null, 2))
    }
  }
function ( opts ) { var name if ( opts && opts . name ) name = opts . name if ( opts && opts . package && opts . package . name ) name = opts . package . name if ( ! name ) throw new TypeError ( 'package name missing' ) opts = defaults ( opts , { nodeModulesDir : path . resolve ( process . cwd ( ) , 'node_modules' ) } ) fs . removeSync ( path . resolve ( opts . nodeModulesDir , name ) ) if ( opts . targetPackage ) { var key = opts . isDev ? 'devDependencies' : 'dependencies' var targetPackage = JSON . parse ( fs . readFileSync ( opts . targetPackage ) ) delete targetPackage [ key ] [ name ] fs . writeFileSync ( opts . targetPackage , JSON . stringify ( targetPackage , null , 2 ) ) } }
remove mock package
@param {object} opts
@param {string} opts.name package name to remove
@param {string} [opts.package.name] may be used instead of opts.name for consistency w/ install API
@param {string} [opts.nodeModulesDir] path to node_modules dir
@param {string} [opts.targetPackage] path to package.json file to update with the newly installed dependency's metadata
@param {boolean} [opts.isDev] put into devDependencies vs dependencies. used only with targetPackage
remove mock package