rails-assets icon indicating copy to clipboard operation
rails-assets copied to clipboard

ocLazyLoad angular dependency version wildcard not being recognized?

Open dnroot opened this issue 9 years ago • 7 comments

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.

dnroot avatar Jun 22 '15 20:06 dnroot

>=1.2.x <=1.4.x is interpreted by rails-assets as >= 1.2, <= 1.4. This seems to be correct behavior.

sheerun avatar Jul 27 '15 19:07 sheerun

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 avatar Aug 20 '16 02:08 milk1000cc

@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

joshjordan avatar Aug 20 '16 04:08 joshjordan

OK. I'll try to fix.

milk1000cc avatar Aug 20 '16 08:08 milk1000cc

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.

milk1000cc avatar Aug 21 '16 02:08 milk1000cc

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?

hut8 avatar Aug 25 '16 18:08 hut8

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.

milk1000cc avatar Aug 28 '16 03:08 milk1000cc