Publish to Bower : Reusable Angular Utility (Love for Open-Source)
Developers came across weird yet simple issues every day, normalizing data, filtering array, splitting objects etc… are their routines like breakfast, lunch and dinner.
You wrote any piece of code, It might be and might not be perfect, it might be or might not as advanced compared to other projects build with the similar technology, but you built it, and it works. You find it beautiful. I hope other developers share the same feeling about their own creations. The passion you put into your code to successfully create whatever you wish for.
It is not only what developers should thrive for, but love. It can be more by sharing your work, making it public to use by others. Yeah, I am talking about Open Source.
There are lots of people who were willing to help, who shared their code, who contributed to the community without asking for a reward. People who spent much time and effort teaching each other how this all works.
Steps to publish your Angular Module to Bower.
Step 1:
To make your Angular module open-source on bower (so that anyone can reuse it) you need to publish it on Github first.
Create a new repo on GitHub
https://help.github.com/articles/create-a-repo/
Step 2:
Create-
Create your local directory/folder:mkdir my-module
cd my-module
Clone your git repo onto your local machine
Create package.json and bower.json and add desired dependencies to support your angular module.
or
Clone this repo https://github.com/rob-in/ng-ismobile and install dependencies.# install dependencies
npm install
bower install
Customize-
Customize the cloned repo to include your angular module:
- Update
src
folder with your angular module. - Update
package.json
andbower.json
to match your module name and other informations. - Include
buildconf.js
to include your file name (buildJsFilename: 'your-file-name.js')
Step 3:
Publish to bower registry-
Now since we are ready with everything, we have to publish it to bower registry to make it usable for others
bower register your-ng-module git@github.com:your-github-name/your-repo-name.git
Note: Don’t forget to out private: false
as a field in your bower.json
then only bower register
will work.
The beauty of open-source is that you can pick up right where someone left off and start right there.
Happy coding , Happy writing and Happy Sharing.
— Robin