How to update bower.json with installed packages?

In my project I've installed bower components without save option. Now, I would like update to bower.json?

How can I update bower.json with installed packages?


Just list your dependencies:

bower list

Then you should run all install command with param '--save' like this:

bower install bootstrap --save

It's a hard work, but if you have a thousand dependencies, could you create a script to automatize the task.


A little trick if you don't want to write a script for that:

before doing anything rename your bower.json in bower2.json for example.

then you can do a:

$ bower init

(automatically create a bower.json file).

note that all questions should be pre-filled with your current config.

When it will ask you:

set currently installed components as dependencies? say yes,

You now have all your dependencies in the new bower.json file (and you can check if everything is right with the old bower2.json)