How to install Bower Programmatic API? - bower

I'm new to Bower.
Where I can find bower.js file?
var bower = require('bower');
Chrome says 'bower' not found.
Thank you.

If you are using node.js then you will need to run 'npm install bower' to get the bower package installed into your path.

Related

Inform bower new plugin release

I've created an open source javascript plugin. It is located on github public repository. When I want to release new version, I'm doing it with github features. My plugin is also indexed in bower repository. How to inform bower, that I have released new version of plugin?
You can update any bower dependency using the "update" command. See below:
bower update <name>
Where is the name of your bower package/dependency.
However, this is assuming that the semvar range provided in the bower.json configuration file allows the installation of the new (versioned) plugin.
As it is authored by you, I doubt very much it would be an issue.
If the above command doesn't work, you can always un-install it and reinstall it as follows:
bower uninstall <name>
bower install <name> --save-dev //or --save, this depends on how you installed it earlier.

Install tweenmax using bower

Is there a way to install tweenmax using bower?
I've been looking into angular animations and I noticed the egghead tutorial uses tweenmax but it imports it directly into the html. I want to use bower to import so that I can have my imported packages all managed take advantage of the gulp build process to create the minified vendor script.
It seems that they name tweenmax as GSAP. Correct me if I'm mistaken but I believe this is the same thing esp looking at the main section of the bower file (git repo) which points to tweenmax. Thus, I installed using:
bower install gsap --save

bower show package dependencies tree before install

Is it possible to get a list of package dependencies (as produced by bower list) before installing the packages?
bower install does not complete successfulfy in my project as some package has a dependency to a non existing package version, therefore I would like to be able to quickly find that package that has this incorrect dependency instead of having to inspect bower.json of every package.
You could try bower-dependency-tree. npm install -g bower-dependency-tree && bower-dependency-tree name_of_the_package_you_are_interested_in should do it.
disclosure: I am the maintainer of the project.

how do I specify the installation location of a bower package?

I'd like to use bower in install packages. I'd also like to have the packages in specific places. In particular, I'd like my javascript in '/js'.
You can set a custom directory for where you would like bower to install all the listed dependencies in the bower.json file. Here's a quick from bower's documentation of .bowerrc:
Custom install directory
A custom install location can be set in a .bowerrc file using the
directory property. The .bowerrc file should be a sibling of your
project's bower.json.
{
"directory": "public/bower_components"
}
One of the benefits of Bower is how simple it is. One of the main downfalls of Bower is how simple it is. I do not believe that bower supports setting custom install locations for each dependency. You may have to rely on another tool to do that.
Here's a similar Stack Overflow question about install bower dependencies to different folders. While bower itself is not able to do what you ask, there are a number of tools that add such functionality:
npm bower installer (using npm)
grunt bower task (using
grunt)
grunt bower organizer (using grunt)

Make a Bower package using other Bower packages

I'm making a Bower package like Bootstrap but for my own projects. My Bower package is using some other Bower packages, so, I'd like to know how to register a Bower package using other bower packages ?
Anthony
I guess you should read the bower.json file specification, and express your dependencies there.

Resources