How to update scripts with bower? - bower

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.

Related

Is there a Homebrew command to downgrade from HEAD to stable version of a package?

I brew install --HEAD'd node recently to see if the upstream version fixed a bug I was experiencing. (It did!)
Now I'd like to downgrade back to the stable, bottled version. Is there a simple command to do so?
brew reinstall simply pulls & rebuilds the HEAD version from upstream. (Where does Homebrew "remember" my HEAD preference?)
brew uninstall --ignore-dependencies && brew install is of course possible, but annoying given that it would also delete my build history & install receipts, which I'd like to keep around a bit if possible.
I did the same thing for pyenv while waiting for version 2.1.0 to make it into homebrew-core. I figured I'd simply uninstall pyenv and reinstall it without --HEAD, but when I attempted to do so, Homebrew told me:
Only uninstalling HEAD version because multiple versions are installed
(Or something like that.)
The documentation doesn't really explain this, as far as I can tell, but I did find an explanation here:
uninstall first removes whichever version is "active", i.e. linked into the main prefix. What happens when you run uninstall again depends on how many other versions are installed: if there is only one, it is removed, otherwise it errors out because it doesn't know which one to uninstall (unless you pass --force).
So I didn't need to do anything else, aside from delete the pyenv repository that Homebrew cloned under ~/Library/Caches/Homebrew/pyenv--git. (I think the fact that it doesn't remove this might be a bug.)
Now, if you first uninstalled node stable, then installed HEAD, your situation might be different.
(I know this might not be a great answer, but it's too long for a comment.)

Inform bower new plugin release

I've created an open source javascript plugin. It is located on github public repository. When I want to release new version, I'm doing it with github features. My plugin is also indexed in bower repository. How to inform bower, that I have released new version of plugin?
You can update any bower dependency using the "update" command. See below:
bower update <name>
Where is the name of your bower package/dependency.
However, this is assuming that the semvar range provided in the bower.json configuration file allows the installation of the new (versioned) plugin.
As it is authored by you, I doubt very much it would be an issue.
If the above command doesn't work, you can always un-install it and reinstall it as follows:
bower uninstall <name>
bower install <name> --save-dev //or --save, this depends on how you installed it earlier.

Resolution Bower versions conflict

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.

MVC Nuget Installing Multiple Packages

I'm building a new solution/project. I copied all the files over and moved all the packages over to the packages folder. When I reference them via nuget, it says they are installed, but
they are not. If they were, I would see them in the installed tab.
First why does it say installed, next how can I install multiple packages at once, instead of
doing it individually. I have like 10+ packages I need to install. This is pain in
the ass, if I have to install each individually. We should be able to run a command that
checks to see if all the packages in the package folder have been installed, if not, install them. Is there a command for this?
Use nuget.exe for this. see following question and google search
nuget install packages.config
Or with NuGet 2.7 you can restore allpackages in the solution using the command line.
nuget restore YourSolution.sln

How to upgrade existing project scaffolded with Yeoman

I used generator-angular a few months ago to scaffold a project and the whole ecosystem (karma, Node versions, grunt packages) has moved on quite significantly. I keep running into problems running tests, building things, and so on.
I know I can use nvm to downgrade my Node version and install older packages, but that kind of sucks, especially when there are many developers on the team. I have used the generators for 10+ projects over the past few months so I'm very interested in a solution.
Is there a recommended upgrade path for when new versions of generators are released, apart from just regenerating the project and copying files across?
(Just to note: this isn't a problem with upgrading a Yeoman 0.9 project.)
First make sure you have committed everything or have a backup, then just scaffold out over the project again. yo will ask you for each file if you want to overwrite. For those files you haven't edited, just say yes. For the other ones, type d for diff and see what's changed. Then manually do the changes, and run npm install & bower install to get the latest dependencies.
EDIT
As mentionned in comments by Markus Gattol :
yo <generator-name> now already run bower install & npm install i.e. no need to run them explicitly again – Markus Gattol

Resources