• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var Bluebird = require('bluebird')
3var lifecycle = Bluebird.promisify(require('../../utils/lifecycle.js'))
4var packageId = require('../../utils/package-id.js')
5var rmStuff = Bluebird.promisify(require('../../unbuild.js').rmStuff)
6
7module.exports = function (staging, pkg, log) {
8  log.silly('unbuild', packageId(pkg))
9  return lifecycle(pkg.package, 'preuninstall', pkg.path, { failOk: true }).then(() => {
10    return lifecycle(pkg.package, 'uninstall', pkg.path, { failOk: true })
11  }).then(() => {
12    return rmStuff(pkg.package, pkg.path)
13  }).then(() => {
14    return lifecycle(pkg.package, 'postuninstall', pkg.path, { failOk: true })
15  })
16}
17