Update multiple dependencies with Bower

↘锁芯ラ 提交于 2019-11-28 20:48:14

问题


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?


回答1:


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.




回答2:


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"
   }
 }



回答3:


Used bower-update-all to update all bower dependencies in bower.json, as follows:

npm install -g bower-update-all
bower-update-all



回答4:


If you want to force all dependencies to update you can use bower install --save --force. This is the same as bower install --save [dep1] [dep2] ...

The short version is bower i -S -f



来源:https://stackoverflow.com/questions/18105897/update-multiple-dependencies-with-bower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!