-
Notifications
You must be signed in to change notification settings - Fork 3
Allow overruling constraint resolver #208
Comments
I believe there's gonna be a serious amount of work to support this. practicalmeteor:mocha was last updated a year ago.... wouldn't it better to just clone it locally inside packages, and just change the version number? Or publish it as a new one? I think this constraint resolver will come with a price in building the app. And even if we do it with "opt-in" ability, someone should still modify the package to support this new "opt-in" ability ? My concern is that this isn't a common problem. And having 2 versions of the same package loading is dangerous, for example, a package extending Mongo.Collection twice, may lead to very unexpected behavior. |
Please read to the bottom of that thread. The suggested actions as of the end of the discussion were:
The last item is the most important, and would actually resolve the problem; hence the new name of the issue. And it doesn’t involve allowing duplicate packages in the same project. |
I've read it, but it seems I got a bit confused by the fact that Mocha had issues with newer coffeescript versions, and I did not see how the constraint overriding could fix the issue: |
It’s not just that one package. See meteor/meteor#9107 (comment). I had this issue with nine packages just in the This issue will come up any time a commonly depended-upon package, like |
Thanks for the clarification. |
@theodorDiaconu While I fall somewhere in between you and @GeoffreyBooth in terms of how common I think this problem will be, I think it's important to be able to fix it reliably (if not easily) when it does happen, regardless of how common it is. In fact, the less common this situation is, the more we can treat the solution as something aimed at power-users, rather than something every Meteor developer needs to know how to do—and that makes designing the solution a little easier! |
How about this?
|
Does it need to only be exact? What about Either way, I’d like to still be able to run |
@benjamn Any word on this? It’s keeping me from being able to upgrade the
In the short term at least, could we at least neuter the version constraint caused by |
This has come up in the wild: https://stackoverflow.com/questions/50757646/meteor-1-6-coffeescript-reserved-word-import/50772818?noredirect=1#comment89003965_50772818 Any plans for a fix? Or at least any direction on what an acceptable fix would look like? |
The last time I gave this some thought, I mostly convinced myself that we would need some sort of configuration (perhaps in the {
"meteor": {
"ignoreConstraints": {
"practicalmeteor:chai": ["coffeescript", ...],
...
}
}
} |
Seems wrong somehow to have some of the package version configuration in |
Another idea was to put it in
though that requires inventing new syntax for that file. |
Rather than finding all the packages that constrain # .meteor/packages
coffeescript !important Or whatever you want to call it. The logic behind this is that if there can only be one installed version of |
@GeoffreyBooth What if |
That would solve this issue. It might be a little risky, in that some packages would get a much newer version than they’re expecting. Most packages aren’t really using most core modules, and few core modules have any breaking changes between major versions as far as I’m aware, but theoretically if a package is using a core module and expecting a certain version via But then again, I don’t know what better option we have. Really this is an issue with any core (or formerly core) module. |
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.
@GeoffreyBooth ☝️😉 |
This was implemented in Meteor 1.8 via meteor/meteor@4a70b12. |
Migrated from: meteor/meteor#9244
The text was updated successfully, but these errors were encountered: