Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update multiple dependencies with Bower

I listed (and/or installed) several dependencies with Bower inside the bower.json file and/or with

bower install https://github.com/username/project.git 

That worked fine.

Now I can list all them with

bower list 

and then I can pick the name of each dependency of my project and run

bower update dependency-name 

Question: How can I bulk update all of them? Or do I have to write a shell script to loop through and update them?

like image 800
kaiser Avatar asked Aug 07 '13 14:08

kaiser


People also ask

How do I update my bower package?

If there aren't that many bower packages you have installed, try writing bower install [package_name] --save . This will just update your bower. json file.

Is bower deprecated?

Bower has been deprecated. However, it is not recommended given the rise of other package managers like NPM.

What is bower dependency?

Bower is a great dependency manager that's specially created to help you manage different frontend libraries. It reduces the time and energy you need to spend hunting around the web for libraries like Susy and jQuery by helping you install, update or delete them with a single command.

How do you use bower link?

The link functionality allows developers to easily test their packages. Linking is a two-step process. Using 'bower link' in a project folder will create a global link. Then, in some other package, bower link <name> will create a link in the components folder pointing to the previously created link.


2 Answers

You can update all by running bower update.

Use the -h flag on any command to see how you can use it. Eg bower update -h.

like image 154
Sindre Sorhus Avatar answered Oct 04 '22 19:10

Sindre Sorhus


This process is a little slow but is secure because you can realize when your app gets broken.

lets say that you want to update bootstrap you just need to run bower install --save bootstrap and you bower.json file will be updated

Before

 {    "name": "my-awesome-app",    "version": "0.0.0",    "dependencies": {      "bootstrap": "~3.0.0",      "requirejs": "~2.1.11",      "modernizr": "~2.8.2",      "jquery": "~2.1.1",      "underscore-amd": "~1.5.2",      "backbone-amd": "~1.1.0",                                                                                                                                                      "require-handlebars-plugin": "~0.8.0"    }  } 

After

 {    "name": "my-awesome-app",    "version": "0.0.0",    "dependencies": {      "bootstrap": "~3.3.1",      "requirejs": "~2.1.11",      "modernizr": "~2.8.2",      "jquery": "~2.1.1",      "underscore-amd": "~1.5.2",      "backbone-amd": "~1.1.0",                                                                                                                                                      "require-handlebars-plugin": "~0.8.0"    }  } 
like image 32
Ricardo Rivas Avatar answered Oct 04 '22 17:10

Ricardo Rivas