Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 296
kongaraju Avatar asked Oct 20 '22 17:10

kongaraju


People also ask

How do you get the latest version of the dependencies as per the json file installed?

You can find the latest version of the npm added in package. json file. If you want to add the latest version either you can run npm install or npm install @latest .

How do you add bower components to a project?

To add a new Bower package to your project you use the install command. This should be passed the name of the package you wish to install. As well as using the package name, you can also install a package by specifying one of the following: A Git endpoint such as git://github.com/components/jquery.git.


2 Answers

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.

like image 123
Helder Robalo Avatar answered Oct 24 '22 14:10

Helder Robalo


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)

like image 21
Sebastien Horin Avatar answered Oct 24 '22 16:10

Sebastien Horin