Permalink
Browse files

bug fix: if installed packages is shipped with node_modules/deps alre…

…ady, dont overwrite it

	modified:   nmod
  • Loading branch information...
1 parent 28d6960 commit 573117abacb41ac29fa0d4d5826b42b8ca261c5d @jeromeetienne committed Mar 10, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 nmod
View
@@ -559,9 +559,13 @@ var nmod = function(cmdline, cmdopts){
// get the root directory basename from the package
var basenames = require('fs').readdirSync(tmpDirname);
console.assert(basenames.length === 1)
- //console.log("moving", tmpDirname+"/"+basenames[0], "to", dstDirname)
+ console.log("moving", tmpDirname+"/"+basenames[0], dstDirname)
// move the untar package from tmpDirname to dstDirname
- require('fs').renameSync(tmpDirname+"/"+basenames[0], dstDirname);
+ // - NOTE iif dstDirname doesnt exist. not to overwrite
+ // - e.g. npm is shipped with a node_modules already
+ if( utils.existSync(dstDirname) === false ){
+ require('fs').renameSync(tmpDirname+"/"+basenames[0], dstDirname);
+ }
// remove tmpDirname
utils.rm_rfSync(tmpDirname);
// overwrite the package.json with the one from the server

0 comments on commit 573117a

Please sign in to comment.