Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Allow package-name@x.y.z! override syntax in .meteor/packages.
With this commit, if a top-level package version constraint in .meteor/packages ends with a '!' character, any other (non-!) constraints on that package elsewhere in the application will be weakened to accept any version of the package that is not less than the constraint, regardless of whether the major/minor versions actually match. This functionality is extremely useful in cases where an unmaintained package was last published with api.versionsFrom(<some ancient version>), thus constraining the major version of any Meteor core package it depended on, but you really want to upgrade that core package anyway. Just put a '!' after the core package's version constraint in your .meteor/packages file, and you will almost certainly get your way. The fact that minimum versions are still enforced is good/fine because the constraints you want to override are typically ancient, so they easily match any recent version of the package. Your only recourse before this @x.y.z! syntax was to find a replacement for the unmaintained package, or fork and modify it locally, or somehow persuade the package author to publish a new version with a more reasonable api.versionsFrom. None of these options were easy. Many thanks to @GeoffreyBooth, long-time maintainer of the `coffeescript` package, for originally suggesting a ! syntax similar to this one: meteor/meteor-feature-requests#208 (comment) The limitation of this syntax to .meteor/packages is deliberate, since overriding package version constraints is a power-tool that should be used sparingly by application developers, and never abused by package authors. Also, limiting the scope of this syntax reduces the risk of an arms race between overrides, a la the infamous CSS !important modifier.
- Loading branch information
Showing
6 changed files
with
111 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature will obviously need some tests!
4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks like just the type of UX I was looking for!
One question that I assume you’ve considered: does the version number need to be specified? Like can a
.meteor/packages
file contain justor does it need to be something like
? I’m assuming that both should work (and in either case, the exact version would be specified in
.meteor/versions
).4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has to be a
@x.y.z
version of some kind before the!
. These changes don't clearly enforce that rule, but it's enforced elsewhere, and I think it's what we want.4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it needs to be a full version, i.e.
coffeescript@2.2.1_1!
, then it would be nice if there was some way to upgrade this easily. Like ifmeteor update coffeescript
bumps this to whatever the current latest version is, likecoffeescript@2.3.0_1!
or whatever.4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to check, but it looks like
meteor update coffeescript
does not touch your.meteor/packages
file. There's some behavior for adding version constraints to core packages when you update Meteor itself, but I think non-core packages are left alone.The good news is that a constraint of
coffeescript@2.2.1_1!
is fully compatible withcoffeescript@2.3.0_1
, since it's a later version, and the major versions match. That's an important difference betweencoffeescript@2.2.1_1!
andcoffeescript@=2.2.1_1
: the!
version means "take this version constraint seriously" whereas the=
version means "use exactly this version."4a70b12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so
coffeescript@2.2.1_1
is likepackage.json
’s"^2.2.1_1"
it seems like. I didn’t know that, that’s good to know.Yeah, then this UX works as far as I can tell. Looking forward to it getting merged in!