Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage internal Node.JS modules

What would be the preferred way to handle internal modules within a node.js application?

I mean, currently we have a fairly big application and there are several dependencies, installed via npm. We have node_modules in .gitignore. Therefore it's not in the repository. We use npm shrinkwrap to freeze the modules versions, so, upon deployment, an npm install puts together eveything we need into node_modules.

The problem is, since out app is getting bigger, we want to split it to smaller modules. Now, if I create a foo module and put it in node_modues, I need to allow it in the repo, which does not seem so neat to have both ignored and checked out modules in node_modules.

We can not publish these on npm registry because they are not really "public".

Is there any obvious solution that I'm not aware of?

like image 312
Ekin Koc Avatar asked Aug 31 '12 22:08

Ekin Koc


1 Answers

I agree with your aesthetic of not mixing 3rd-party non-repo stuff with your in-house revision-controlled contents.

The NODE_PATH search path variable can help you here, you can use a different directory with contents under revision control.

http://nodejs.org/api/modules.html

Depending on your appetite for flexibility vs complexity, you can consider a build step that actually copies your various node modules from wherever you keep them, into an output directory (probably "named node_modules" but not necessarily).

like image 65
david van brink Avatar answered Sep 30 '22 20:09

david van brink