diff --git a/lib/core/Manager.js b/lib/core/Manager.js index 48844af0..528e7292 100644 --- a/lib/core/Manager.js +++ b/lib/core/Manager.js @@ -9,7 +9,6 @@ var defaultConfig = require('../config'); var copy = require('../util/copy'); var createError = require('../util/createError'); var endpointParser = require('../util/endpointParser'); -var F = require('../util/flow'); function Manager(config) { this._config = config || defaultConfig; @@ -126,7 +125,7 @@ Manager.prototype.install = function () { promises.push(promise); }); - return F.all(promises); + return Q.all(promises); }) .then(function () { // Resolve with an object where keys are names and values diff --git a/lib/core/Project.js b/lib/core/Project.js index ee884441..c74eddc6 100644 --- a/lib/core/Project.js +++ b/lib/core/Project.js @@ -242,45 +242,46 @@ Project.prototype.uninstall = function (names, options) { // If the package has no dependants or the force config is enabled, // mark it to be removed if (!dependants.length || that._config.force) { - packages[name] = decEndpoint.dir; + packages[name] = decEndpoint.canonicalPkg; + return; + } + // Otherwise we need to figure it out if the user really wants to remove it, // even with dependants - } else { - message = dependants.map(function (dep) { return dep.name; }).join(', ') + ' depends on ' + decEndpoint.name; - data = { - package: decEndpoint.name, - dependants: dependants.map(function (decEndpoint) { - return decEndpoint.name; - }) - }; + message = dependants.map(function (dep) { return dep.name; }).join(', ') + ' depends on ' + decEndpoint.name; + data = { + package: decEndpoint.name, + dependants: dependants.map(function (decEndpoint) { + return decEndpoint.name; + }) + }; - // If interactive is disabled, error out - if (!that._config.interactive) { - throw createError(message, 'ECONFLICT', { - skippable: true, - data: data - }); - // Question the user - } else { - deferred.notify({ - level: 'conflict', - id: 'mutual', - message: message, - data: data - }); - - return Q.nfcall(promptly.confirm, 'Continue anyway? (y/n)') - .then(function (confirmed) { - // If the user decided to skip it, remove from the array so that it won't - // influence subsequent dependants - if (!confirmed) { - mout.array.remove(names, name); - } else { - packages[name] = decEndpoint.dir; - } - }); - } + // If interactive is disabled, error out + if (!that._config.interactive) { + throw createError(message, 'ECONFLICT', { + skippable: true, + data: data + }); } + + // Question the user + deferred.notify({ + level: 'conflict', + id: 'mutual', + message: message, + data: data + }); + + return Q.nfcall(promptly.confirm, 'Continue anyway? (y/n)') + .then(function (confirmed) { + // If the user decided to skip it, remove from the array so that it won't + // influence subsequent dependants + if (!confirmed) { + mout.array.remove(names, name); + } else { + packages[name] = decEndpoint.canonicalPkg; + } + }); }); }); @@ -597,7 +598,7 @@ Project.prototype._restoreNode = function (node, flattened, jsonKey) { } node.dependencies = {}; - node.dependants = {}; + node.dependants = node.dependants || {}; mout.object.forOwn(node.pkgMeta[jsonKey || 'dependencies'], function (value, key) { var local = flattened[key];