Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider ^ over ~ for default --save option #1123

Closed
ahumphreys87 opened this issue Feb 18, 2014 · 8 comments
Closed

Consider ^ over ~ for default --save option #1123

ahumphreys87 opened this issue Feb 18, 2014 · 8 comments

Comments

@ahumphreys87
Copy link

Currently bower install --save uses ~ in the dependency, consider changing to ^ for better semver compatibility?

@ahumphreys87
Copy link
Author

npm are implementing this feature by the looks of it: npm/npm#4587

@sindresorhus
Copy link
Contributor

👍

@cobbweb
Copy link

cobbweb commented Mar 12, 2014

👎 While semver seems to be quite popular in NodeJS land, some big browsers libraries don't follow semver. Marionette now defines explicit version ranges for its third-party dependencies. Backbone releases can make your whole app can fallover if you're using ~, using ^ sounds even worse.

If you don't agree with the above, maybe consider that pre v1.0.0 dependencies are free to break BC, so avoiding fuzzy matching on those may be desirable.

@sindresorhus
Copy link
Contributor

If you don't agree with the above, maybe consider that pre v1.0.0 dependencies are free to break BC, so avoiding fuzzy matching on those may be desirable.

Pre 1.0.0 only matches patch version even with ^, so no change there. Please read https://github.com/isaacs/node-semver#ranges

If you use Backbone or Marionette just hardcode the version yourself. Bower doesn't and won't care about libs not following semver.

@cobbweb
Copy link

cobbweb commented Mar 20, 2014

Pre 1.0.0 only matches patch version even with ^, so no change there.

👍

If you use Backbone or Marionette just hardcode the version yourself.

That is the solution, still a bit of a trap for unsuspecting devs though. Marionette follows semver, just Backbone/Underscore don't :(

@sheerun
Copy link
Contributor

sheerun commented Apr 12, 2014

I'm only agreeing on this if bower itself will change all ~ to ^ in its package.json

The reality is good part bower component authors don't know what they're doing. You can't expect of them to know what is the difference between ~ and ^. And you can't expect they will be following semver rules (even knowing semver rules it's easy to introduce incompatibility on minor version change).

If you look at npm issue they have problems with it now.

I think this should be closed.

@sheerun
Copy link
Contributor

sheerun commented Apr 12, 2014

Especially bower doesn't have lockfile..

@benmann
Copy link
Member

benmann commented Mar 1, 2016

I guess this was fixed by: #2145
Correct me if I'm wrong.. 🍰

@benmann benmann closed this as completed Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants