Overcoming open source with NPM
Don’t get me wrong, I love open source libraries and tools. Without them the internet would not be what it is today. But here is the problem: ownership. Outside of the big commonly used libraries that have many maintainers are a set of libraries created out of need and published for the common good. Created as needed by people like you and me who are every day developers looking for a library to do something fairly specific. Of course once you’re done with that task you really don’t have the time to maintain that bit of code - so sometimes pull requests get shoved to the back burner, for that lazy Sunday where you can kick back with a scotch and burn through the backlog.
Where am I getting with all of this? Enter nodejs and NPM. If you’ve never used nodejs before I suggest you try it out. And if you’ve never used NPM then you should see this awesome talk by Jed Schmidt. NPM is littered with these sort of projects - little modules to get the job done when it needed to be done. Occasionally you’ll find a module that you like, it will do 90% of the task and the other 10% you figure you can fill in yourself. Then you hop onto github and have a look at the outstanding pull requests - someone else has done the 10% - winning! Now we just sit back and wait for the pull request to get accepted right? That’ll work for projects that are well maintained but if the pull request has been sitting there stagnant then you may want to take drastic action.
Hit that fork button! Once you’ve forked the project you can clone it locally, then add all the pull request repos as other remotes. This will let you then merge in all the bug fixes that the community is trying to contribute. I’m not going enter into the steps on adding remotes and merging branches, that’s what the internet is for.
On github you’ll see a “git read-only” button next to the repository URL - this usually has something like “git://” at the start. This is the URL that you can use to access the repo using the git protocol and it’s the same URL you can use with npm install. In the folder where you want to use the module you can “npm install <repo URL>” and npm will install as per normal. Awesome right? You can even use this URL in your package.json file - instead of using a version number for the dependancy, use the repo URL.
Hope this helps.