Add lookup command, minor tweaks to the info command.

This commit is contained in:
André Cruz
2013-06-23 14:58:54 +01:00
parent 17f793a4bb
commit 97edd21784
9 changed files with 102 additions and 9 deletions

View File

@@ -423,7 +423,7 @@ Manager.prototype._dissect = function () {
// Sort semver ones DESC
semvers.sort(function (first, second) {
return semver.rcompare(first, second);
return semver.rcompare(first.pkgMeta.version, second.pkgMeta.version);
});
// Filter non-semver ones

View File

@@ -217,6 +217,7 @@ Project.prototype.uninstall = function (names, options) {
.then(function () {
var message;
var data;
var dependantsNames;
var dependants = [];
// Walk the down the tree, gathering dependants of the package
@@ -226,6 +227,9 @@ Project.prototype.uninstall = function (names, options) {
}
}, true);
// Remove duplicates
dependants = mout.array.unique(dependants);
// Note that the root is filtered from the dependants
// as well as other dependants marked to be uninstalled
dependants = dependants.filter(function (dependant) {
@@ -241,12 +245,20 @@ Project.prototype.uninstall = function (names, options) {
// Otherwise we need to figure it out if the user really wants to remove it,
// even with dependants
message = dependants.map(function (dep) { return dep.name; }).join(', ') + ' depends on ' + decEndpoint.name;
// As such we need to prompt the user with a meaningful message
dependantsNames = dependants
.map(function (dep) {
return dep.name;
})
.sort(function (name1, name2) {
return name1.localeCompare(name2);
});
dependantsNames = mout.array.unique(dependantsNames);
message = dependantsNames.join(', ') + ' depends on ' + decEndpoint.name;
data = {
name: decEndpoint.name,
dependants: dependants.map(function (decEndpoint) {
return decEndpoint.name;
})
dependants: dependants
};
// If interactive is disabled, error out