rails-assets
rails-assets copied to clipboard
ocLazyLoad angular dependency version wildcard not being recognized?
ocLazyLoad currently has a dependency on angular (from here):
"dependencies": {
"angular": ">=1.2.x <=1.4.x"
}
After upgrading to angular 1.4.1, we cannot get the latest ocLazyLoad. Looking at Gemfile.lock, it looks like the dependency is requiring angular <= 1.4. So, the wildcard version format they're using doesn't seem to be recognized by rails-assets.
>=1.2.x <=1.4.x
is interpreted by rails-assets as >= 1.2, <= 1.4
. This seems to be correct behavior.
I think <=1.4.x
means < 1.5
.
I can't upgrade to backbone 1.3.3 because I use backbone.babysitter. https://github.com/marionettejs/backbone.babysitter/blob/master/bower.json#L20
@milk1000cc you are correct, it does. See here: https://github.com/npm/node-semver/blob/master/semver.js#L967
Although we're not using node-semvar
, that's the defacto standard and we should be consistent.
We'd gladly accept a pull request for this. The code you'd have to touch, unfortunately, looks like this: https://github.com/tenex/rails-assets/blob/master/app/models/build/utils.rb#L41 :) and the two tests that needs changing are here: https://github.com/tenex/rails-assets/blob/master/spec/models/build/utils_spec.rb#L66
OK. I'll try to fix.
I found Bower uses old semver.
Current version of node-semver
is 5.3.0, but Bower uses v2.
https://github.com/bower/bower/blob/master/package.json#L58
https://github.com/npm/node-semver/blob/master/package.json
In semver v2, <=1.4.x
seems to be interpreted as <1.4
(not <1.5
).
semver.satisfies('1.4.1', '<=1.4.x') // => false
semver.satisfies('1.4.0', '<=1.4.x') // => false
semver.satisfies('1.3.9', '<=1.4.x') // => true
Since I wrote my PR to be consistent with the latest semver, it may have to be rejected once.
Hey @milk1000cc thanks so much for your PR. You're awesome. It's really well articulated and you fixed something pretty surprising. Sorry for the delay in getting back to you; I've been really busy with client work.
Now that you've discovered that Bower's semver is v2, would you say that it works as designed currently?
In master branch of rails-assets, Build::Utils.fix_version_string('<=1.4.x')
returns <= 1.4
.
But it should return < 1.4
to consistent with Bower's semver.
I'm sorry I have no time to fix it now.