Git-Linked Packages for NPM/Node

By on July 29, 2011 2:30 pm

The new Dojo Foundation Package repository is an easy and powerful new way to host Node packages for installation with NPM. This new repository allows you to directly link packages to git repositories and it works with NPM without changes. Developing a Node package couldn’t be easier. Simply submit your package URL to the repository, and instantly it will be available for installation for NPM! Not only that, but you never have to resubmit version updates. Since the package repository is linked to git, any new version tags that you create on your github package repository will automatically be reflected as a new package version available for NPM installation. NPM does not need to be reconfigured at all, just run install like you would with any other package:

npm install my-new-package

When you have updates for your package that you want to designate as a new version, simply tag it in Git. And that’s it! Next time your package is installed or upgraded the newest version will be there.

As mentioned in the introductory blog post about the repository, this entire toolset is also open source and interoperable. The package repository is based on the CommonJS package specification and registry specification that was developed and is used by Isaac Schlueter for NPM (Node package manager). NPM and the package registry specification was designed for multiple registries, and the package repository is fits into the distributed package registry model used by NPM. To see NPM in action working with the Dojo Foundation Packages, you can install the compose package, which is housed at the Dojo Foundation:

npm install compose

This repository is designed to for JavaScript packages for any platform. Dojo is using this repository for AMD-based browser packages with a browser-targeted package manager (CPM), but the repository can hold packages built for other systems, including Node. This is particularly useful for packages that can be used in the browser and on Node. Give it try with your next Node package for the easiest package maintenance imaginable!

Other posts in the series