"node_modules" for private modules that need to be committed?

Showing 1-12 of 12 messages
"node_modules" for private modules that need to be committed? Tom 10/10/12 8:09 AM
I've added the node_modules folder to my .gitignore file, which works fine thanks to NPM Shrinkwrap (after deploying I need to run npm install using the shrinkwrap.json file).

However, I've got some private modules now that I won't publish to NPM. I would like to require these modules like the other modules in node_modules.

Unfortunately I cannot put these modules in node_modules, because they'd be ignored by git, messing with my future deployment.

Where should I place these modules instead? I've been told that editing the paths variable for node's module lookup is highly unrecommended.

Note that these are small undocumented nonpublic modules, which is why I don't want to publish them to NPM.

Tom
Re: [nodejs] "node_modules" for private modules that need to be committed? Diogo Resende 10/10/12 8:32 AM
You have 2 choices:

1. Change your .gitignore
2. Change your require() calls

Example for 1:
(instead of having "node_modules")

node_modules/a
node_modules/b
...

Example for 2:
(in case you put your module in priv_modules)

var xpto = require("./priv_modules/xpto");

-- 
Diogo Resende

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Re: "node_modules" for private modules that need to be committed? Jeff Barczewski 10/10/12 8:40 AM
If you are ok with putting them in github then you can just add dependency that points to a github tarball, for example

"dependencies": {
}

where TAG is a named git tag (version), a branch name, or a commit sha. I would recommend using a named git tag (version) for best flexibility.

Once you have added something to package.json, you can install simply be doing `npm install` and it will pull it down from github as a tarball just as if it came from npm.
Re: [nodejs] "node_modules" for private modules that need to be committed? Tom 10/10/12 8:44 AM
Thanks.

I think I will simply go with changing my .gitignore to list all NPM published modules, assuming this is acceptable behavior.

Tom

Op woensdag 10 oktober 2012 22:32:13 UTC+7 schreef Diogo Resende het volgende:
Re: "node_modules" for private modules that need to be committed? Roly Fentanes 10/10/12 9:33 AM
For private github repos

git+ssh://git@github.com:username/repo.git
Re: "node_modules" for private modules that need to be committed? mgutz 10/10/12 10:51 AM
I suggest using a proper git repository. Use bitbucket.org who provides free private repos, and reference them in your package json like this

git+ssh://git@bitbucket.org:USER/PROJECT.git


On Wednesday, October 10, 2012 8:09:27 AM UTC-7, Tom wrote:
Re: [nodejs] "node_modules" for private modules that need to be committed? Alex Kocharin 10/10/12 11:02 AM
Tom,
 
If you want it to be managed by npm, use git+ssh:// scheme, that works. But there are several issues with that. For example, if you use npm update, it will try to update your private package from repository. And if there's a package with the same name, you will have trouble.
 
Another way is to put these packages to another folder, say my_modules and invoke node.js with node_path env like that:
NODE_PATH=my_modules node server.js
This way you can safely separate private modules from the public ones.
--
// alex
 
 
10.10.2012, 19:09, "Tom" <tomm...@gmail.com>:
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
Re: [nodejs] "node_modules" for private modules that need to be committed? Julian Gruber 10/10/12 11:52 PM
use /lib or put modules in a git repo (you can host them yourself too) and reference them with git:// or git+http://.
Re: [nodejs] "node_modules" for private modules that need to be committed? Charles Care 10/11/12 12:52 AM
I had to do this a couple of months ago, and I found that using a private repo for code and building tagged releases using "npm pack" worked well for me. 

The company I was working for stored all of its deployment packages in Amazon S3. We considered using the git+ssh approach, but our general approach to managing releases (with other technologies) was to build archival packages, so installing from a tarball worked well for us.

At the time I put together a simple module to support the workflow we were using: https://github.com/ccare/node-release-utils

Cheers,

Charles

On 11 October 2012 07:52, Julian Gruber <miste...@googlemail.com> wrote:
use /lib or put modules in a git repo (you can host them yourself too) and reference them with git:// or git+http://.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Re: "node_modules" for private modules that need to be committed? Mariusz Nowak 10/11/12 1:37 AM
Tom:

Have you tried following in .gitignore:

node_modules/*
!node_modules/my-private-package1
!node_modules/my-private-package2
Re: [nodejs] Re: "node_modules" for private modules that need to be committed? Aseem Kishore 10/12/12 9:27 AM
Surprised no one has mentioned this yet:

You can .gitignore node_modules but still manually check in files under node_modules. Git will just ask you to add a -f flag if you really mean to check those in.

We do this for our own private modules. (Actually, what we check into node_modules are just symlinks. Our modules live in their own directories alongside the requiring module.)

Aseem

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Re: [nodejs] Re: "node_modules" for private modules that need to be committed? Isaac Schlueter 10/12/12 1:36 PM
You can also put something like this in .gitignore:

```.gitignore
node_modules
!node_modules/foo
```

and it'll ignore everything in node_modules *except* node_modules/foo.