Reputation: 2007
I have this in a package:
api.use([
'kestanous:[email protected]',
'kestanous:herald-email',
]);
As expected, Meteor uses version 1.1.3 of the Herald package.
If I remove the @1.1.3
version, the package's versions.json
doesn't change.
But now if I run meteor update kestanous:herald
, here's what I get:
$ meteor update kestanous:herald
Changes to your project's package version selections from updating package versions:
kestanous:herald downgraded from 1.1.3 to 1.0.1
It doesn't make sense to me that upgrading a package would actually downgrade it. Especially since kestanous:herald
is used nowhere else in the app. Even stranger, there are still no changes to the package's versions.json
file despite the message.
So it seems either I don't understand how package versioning works, or else something is not working correctly?
Upvotes: 4
Views: 1959
Reputation: 75945
I'm not sure if i'm right on this 100% because the system used is quite weird & has changed so many times until very recently.
Meteor's new package system works on a constraint solver. Each package declares the version of Meteor its designed for, e.g if you designed it for Meteor 0.9.2 and you run it on Meteor 0.1.0 there is a slight difference in the blaze
package.
So if a package one of your other packages is dependent on has uses this older version of blaze then the other packages will be downgraded so that it can match this constraint, such that the latest versions of all included packages are used as long as the constraint is matched.
So this can happen if herald
has a constraint on it of some older Meteor package or version, or has a dependency on some older package.
While the package doesn't have to be defined explicitly it can be defined implicitly from api.versionsFrom("XXX")
too.
Meteor then upgrades or downgrades the packages accordingly.
Additionally there is a "leeway" allowed with the packages allowed depending on the semver spec, minor package version updates are okay, but the major ones force a downgrade, since the new version is deemed incompatible. There's a bit of a discussion on this too.
This is the package.js file for the package for kestanous:herald
:
api.versionsFrom('[email protected]');
api.use(['check', 'underscore', 'tracker','accounts-base', 'blaze', 'artwells:[email protected]']);
This means that all packages in your meteor project will attempt to be downgraded so that all of them can be compatible with these other dependencies.
If you upgraded the versionsFrom
, then meteor would be more accepting to newer versions in other packages.
https://github.com/Meteor-Reaction/Herald/blob/master/package.js#L9
Upvotes: 0