unbuild.js 659 B

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