mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Inform the user when a conflict was resolved with a configured resolution.
This commit is contained in:
@@ -507,25 +507,6 @@ Manager.prototype._electSuitable = function (name, semvers, nonSemvers) {
|
||||
picks.push.apply(picks, semvers);
|
||||
}
|
||||
|
||||
// Check if there's a resolution that resolves the conflict
|
||||
resolution = this._resolutions[name];
|
||||
if (resolution) {
|
||||
if (semver.valid(resolution) != null || semver.validRange(resolution) != null) {
|
||||
suitable = mout.array.find(picks, function (pick) {
|
||||
return semver.satisfies(pick.pkgMeta.version, resolution);
|
||||
});
|
||||
} else {
|
||||
suitable = mout.array.find(picks, function (pick) {
|
||||
return pick.pkgMeta._release === resolution;
|
||||
});
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
return Q.resolve(suitable);
|
||||
}
|
||||
}
|
||||
|
||||
// At this point, the user needs to make a decision
|
||||
// Sort picks by version/release
|
||||
picks.sort(function (pick1, pick2) {
|
||||
var version1 = pick1.pkgMeta.version;
|
||||
@@ -576,6 +557,30 @@ Manager.prototype._electSuitable = function (name, semvers, nonSemvers) {
|
||||
};
|
||||
});
|
||||
|
||||
// Check if there's a resolution that resolves the conflict
|
||||
resolution = this._resolutions[name];
|
||||
if (resolution) {
|
||||
if (semver.valid(resolution) != null || semver.validRange(resolution) != null) {
|
||||
suitable = mout.array.findIndex(picks, function (pick) {
|
||||
return semver.satisfies(pick.pkgMeta.version, resolution);
|
||||
});
|
||||
} else {
|
||||
suitable = mout.array.findIndex(picks, function (pick) {
|
||||
return pick.pkgMeta._release === resolution;
|
||||
});
|
||||
}
|
||||
|
||||
if (suitable) {
|
||||
this._logger.conflict('resolved', 'Unable to find suitable version for ' + name, {
|
||||
name: name,
|
||||
picks: dataPicks,
|
||||
resolution: resolution,
|
||||
suitable: dataPicks[suitable]
|
||||
});
|
||||
return Q.resolve(picks[suitable]);
|
||||
}
|
||||
}
|
||||
|
||||
// If interactive is disabled, error out
|
||||
if (!this._config.interactive) {
|
||||
throw createError('Unable to find suitable version for ' + name, 'ECONFLICT', {
|
||||
@@ -584,7 +589,7 @@ Manager.prototype._electSuitable = function (name, semvers, nonSemvers) {
|
||||
});
|
||||
}
|
||||
|
||||
// Otherwise, question the user
|
||||
// At this point the user needs to make a decision
|
||||
this._logger.conflict('incompatible', 'Unable to find suitable version for ' + name, {
|
||||
name: name,
|
||||
picks: dataPicks
|
||||
|
||||
@@ -147,7 +147,6 @@ Project.prototype.update = function (names, options) {
|
||||
var decEndpoint = endpointParser.json2decomposed(key, value);
|
||||
decEndpoint.dependants = {};
|
||||
decEndpoint.dependants[tree.name] = tree;
|
||||
|
||||
targets.push(decEndpoint);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user