Only choose prerelease package versions if asked

Make sure 'meteor add foo' gives the same constraint to the solver as
'foo' from .meteor/packages: namely, '>=0.0.0' not
'unconstrained' (since the first rules out rcs and the second doesn't)
This commit is contained in:
David Glasser
2014-08-25 19:57:28 -07:00
parent 35d882f935
commit bfb8359499
2 changed files with 10 additions and 3 deletions

View File

@@ -362,6 +362,12 @@ ConstraintSolver.Constraint.prototype.isSatisfied = function (candidateUV,
var self = this; var self = this;
check(candidateUV, ConstraintSolver.UnitVersion); check(candidateUV, ConstraintSolver.UnitVersion);
// Pre-releases only match precisely; @1.2.3-rc1 doesn't necessarily match
// 1.2.4, and @1.2.3 doesn't necessarily match 1.2.4-rc1.
if (/-/.test(candidateUV.version) || /-/.test(self.version)) {
return self.version === candidateUV.version;
}
if (self.type === "exactly") if (self.type === "exactly")
return self.version === candidateUV.version; return self.version === candidateUV.version;

View File

@@ -1746,9 +1746,10 @@ main.registerCommand({
packages[constraint.name] = constraint.constraintString; packages[constraint.name] = constraint.constraintString;
// Also, add it to all of our combined dependencies. // Also, add it to all of our combined dependencies.
var constraintForResolver = _.clone(constraint); // This matches code in project.calculateCombinedConstraints.
constraintForResolver.packageName = constraintForResolver.name; var constraintForResolver = _.extend(
delete constraintForResolver.name; { packageName: constraint.name },
utils.parseVersionConstraint(constraint.constraintString));
allPackages.push(constraintForResolver); allPackages.push(constraintForResolver);
}); });