Reputation: 33900
require('./module')
VS require('module')
I want my app be installable from both sources GitHub and NPM. I am struggling with require
directives and folder structures. NPM installs modules in node_modules
but git would clone into newly created directory inside the working directory and I have to require with ./mymodule
syntax.
I have about 10 modules used by my app, each of them has it's own repository.
How to solve this problem? How to organize folders on the development machine? How to organize repositories?
Upvotes: 0
Views: 139
Reputation: 3114
You just have to clone your repositories in the node_modules
folder!
If you want to automatically add your repos via npm install
, you can add your them to your depencies in your package.json
as specified on the docs:
"dependencies" : {
"project": "git://github.com/user/project.git#commit-ish"
}
And if you want to include GitHub projects, you'll just have to refer to GitHub urls as just "foo": "user/foo-project"
:
"dependencies": {
"express": "visionmedia/express",
"mocha": "visionmedia/mocha#4727d357ea"
}
Upvotes: 1