Can anyone explain the semantics of bower when specifying the package version?
I understand these:
"requirejs": "2.1.10",
"requirejs": ">=2.1"
But what about something like "requirejs": "~2.1"?
Also, does "requirejs": "*" mean the latest version?
Related
Situation I have is described here: How to resolve Bower dependency version conflicts?
The problem is that proposed solution does not work. Adding a resolution section to bower.json does nothing and it still requires to choose package version manually on each installation.
But, surprisingly, when I install bower packages though Grunt (with grunt-bower-task), it just works, even without resolutions.
I have the latest bower version (1.4.1 for now).
Does anybody know what's going on and is it possible to make bower to install without manual resolution?
You can use "--save" or "--save-dev" when you install and resolve these conflicts - in this way, bower will update accordingly the json file. Next time when you run bower install, bower will read the written sections and will not ask you any more.
No need for manual edits - unless you know what you're doing.
I'm making a Bower package like Bootstrap but for my own projects. My Bower package is using some other Bower packages, so, I'd like to know how to register a Bower package using other bower packages ?
Anthony
I guess you should read the bower.json file specification, and express your dependencies there.
I noticed that when I use yo webapp to make a new web application, it's still using jQuery 1.10.2 even though 1.11.0 is out. Is it because 1.11.0 is not heavily tested yet, so the bower repository is still using 1.10.2? If I keep running bower update once in a while, will jQuery (and any other packages I'm using) eventually upgrade? (I do realize, BTW, that I can force it with bower install jquery#1.11.0 -S)
Related question: This is my current bower.json file:
{
"name": "wut",
"private": true,
"dependencies": {
"sass-bootstrap": "~3.0.0",
"jquery": "~1.10.2"
},
"devDependencies": {}
}
When I run bower update, sass-bootstrap is not updated to the latest available (3.0.2). Why is this?
The version is semver and ~1.10.2 means any patch version (major.minor.patch) higher than 2, but less than 1.11.0. You need to bump up the version in your bower.json to ~1.11.0 to get the 1.11.0 version.
I've created an issue/question about this on
Github but it didn't
receive any attention, except just more people wondering the same
thing, so I decided to try my luck on StackOverflow.
Q: How do you update your bower ?
My problem:
I had Packery 1.0.6 Installed and when I ran bower update it just scanned the directories and didn't update anything at all.
Then I edited the bower.json file and removed Packery 1.0.6 from dependencies and ran:
bower install packery
That confused bower a little, and it asked me which version I wanted - I selected 1.1.2 and now I have 1.1.2.
Why didn't it update to 1.1.2 in the first place ? How can I trust Bower that I have the latest version of everything installed ?
On top of that, running bower update packery doesn't work as well. I thought bower is supposed to be the magical package manager that takes out the hassle of keeping my packages up to date, but as it turns out - it doesn't do much besides installing new packages...
Bower will automatically install your packages with the notation ~x.x.x. It's based on Semantic Versioning and it's package notation.
It doesn't update everything, because it will respect your app's requirements. In your case:
~1.0.6 := >=1.0.6-0 <1.1.0-0
The change from the ~1.0 to ~1.1 could potentially be breaking, and Bower is not willing to update you package unless you are ok with it. Consider it more of a protection.
If you have your bower.json file set as
>= 1.0.6
It should get you nothing less than 1.0.6.
Check out the ranges section on this page.
One of the reasons I'm still using macports is that it is easy to switch between versions of things you download. For example, if I want to change my GCC version to 4.8 all I have to do is
sudo port set --select gcc mp-gcc48
No mucking around in environmental variables. I see that there are multiple versions of gcc to be got from homebrew, but is there an easy way to activate and deactivate versions of things? I didn't notice anything in the documentation.
Option 1 is that you install multiple versioned packages in parallel. Then you'd call gcc-4.7 or gcc-4.8, etc.
Option 2 is to selectively brew link and brew unlink the package versions that you prefer to use. Note that an "unlinked" package is still installed and usable from /usr/local/opt/<package>/, it's just not in the default path.
Which one you use depends on how the individual packages are set up and how often you need to switch around. It's perhaps not quite as clear-cut as with MacPorts, but it works just fine.