How to support multiple private npm packages living in one git repo?

You could also set up your own local npm repository.

  • Instructions for *nix/OSX
  • Instructions for Windows

I would suggest that one repo with multiple packages is a bad idea to start with for several reasons. You should be viewing a package as its own entity: independently built, tested, and deployed. All that to say, each package should live in its own repo.

That being said, I definitely understand the benefit of being able to do an npm install <package-group> of one "commons" package and have it grab all the packages you need in one shot. I would suggest looking at the grunt-contrib model for accomplishing this. In short, they have a bunch of grunt-contrib- packages (ex. grunt-contrib-coffee) each living in their own repositories. They then create a separate repository that defines the parent "grunt-contrib" package. All this parent package does is specify dependencies on all of the sub-packages. This allows you to do an npm install grunt-contrib-coffee (for example) and get just the grunt-contrib-coffee package; or you can do npm install grunt-contrib and get their entire suite all in one shot.

Hope this helps!