mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Improve cost function
It's still not really correct to do it this way, but it passes the existing tests now. In particular, we now prioritize making top-level dependencies newer over making indirect dependencies older. However, this approach is flawed because we only visit the packages in the original solution, before optimization. We should assign a cost to every package version that might be chosen, and let the solver shift things around arbitrarily.
This commit is contained in:
@@ -167,7 +167,17 @@ var newResolveWithInput = function (input, _nudge) {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
});
|
||||
_.each(solution.getTrueVars(), function (x) {
|
||||
if (x.indexOf(' ') >= 0) {
|
||||
var pv = CS.PackageAndVersion.fromString(x);
|
||||
var package = pv.package;
|
||||
var version = pv.version;
|
||||
var otherVersions = cache.getPackageVersions(package); // sorted
|
||||
|
||||
if (! _.has(rootDeps, package)) {
|
||||
// try to make older
|
||||
otherVersions = _.clone(otherVersions);
|
||||
otherVersions.reverse();
|
||||
|
||||
Reference in New Issue
Block a user