Recently I released these libraries under the banner of a larger project, MogulMVC.
Since releasing them on GitHub I’ve been able to install them in any project by just running a
git clone or
git pull in my CSS or JS directory, and this makes it very easy to keep them updated, but it was still lacking something.
git clone or
git pull didn’t insure that jQuery was also cloned into my project.
Then I discovered Bower, a frontend package manager.
If you have ever worked with Node.js’s NPM or PHP’s Composer you know what package managers are.
They allow you to list project dependencies, usually in a JSON file, and then install them with one command. Updating is also a breeze with package managers.
bower install mogul-js into the terminal Bower will install MogulJS in my project. If I had not installed jQuery, Bower would install it for me as jQuery is a dependency of MogulJS.
I had been using Bower for a while, but never with my own libraries, so last night I released them on Bower.
The process was incredibly simple.
bower init. In it you will give the name of your library and a version number. You MUST follow Semantic Versioning for the version number but the name can be nearly anything. I wasn’t sure at first but it can have capital letters in it.
bower register <my-package-name> <git-endpoint>
The package name can be nearly anything you want, but just like NPM, names are given on a first come first serve bases.
If you push up a package and decide you later want to remove it you have to contact the bower registers as there is no automated way of doing this currently.
Update: Bower has added a way to remove packages. Read the documentation.
I was worried about picking the right name with such permanence, but I just bit the bullet and dove in and I am very happy with my choice. I now list my libraries as dependencies of all of my projects and when I update the libraries it takes one command to update the project using them.
Leave a Reply
You must be logged in to post a comment.