Paul Preibisch
Paul Preibisch

Reputation: 4322

How to generate a new bower.json

I have a project where I have checked in my bower_components folder into github a loooong time ago. The project works with when I run my build script by compiling many files in my bower_components folder into base.js.

The problem is, I unfortunately have not been properly installing bower packages. Instead of typing "bower install package-name --save" I have just been adding packages via "bower install package-name". Thus, my bower.json has not been updated properly.

Since my repo is HUUUGGE due to the checking in of the bower_components folder, I want to start a NEW repo without the bower_components folder. Problem is, my project doesn't build properly unless I have all the files from my checked in bower_components folder.

What I need done: I need a program that will go through all of the sub-folders in my bower_components folder and build a new bower.json file.

Upvotes: 1

Views: 6351

Answers (2)

Mohammad Ayoub Khan
Mohammad Ayoub Khan

Reputation: 2960

First initialise the bower: type this command

 bower init

bower.json file will be created.

Now you can add dependency to it. You can install the package with following syntax:

bower install <package> 

Example:

 bower install jquery-nice-select 

You can add it to bower.json be adding --save next to it

bower install jquery-nice-select --save


Enjoy :)

Upvotes: 4

user2699761
user2699761

Reputation: 61

enter on your project directory and type: bower init

answer all of the prompted questions as you need to(ie: name, description, main, license, homepage..etc) and put Yes on this one:

set currently installed components as dependencies? Yes

it will create a bower.json with your actual installation packages.

Upvotes: 5

Related Questions