Permalink
Browse files

Close #1862 Rename .gitignore to .npmignore if not already a .npmigno…

…re present

This is such an awful hack right now.  Really need a cleaner way to set the
name of a file in the tarball while its being created.
  • Loading branch information...
1 parent a3be61d commit 221211817903641df5d33a119c67ee5c00efaae2 @isaacs isaacs committed Dec 14, 2011
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/utils/tar.js
View
@@ -91,7 +91,22 @@ function packFiles (targetTarball, parent, files, pkg, cb_) {
// being installed from some wackey vm-mounted
// read-only filesystem.
this.props.mode = this.props.mode | 0200
- return -1 !== files.indexOf(this.path)
+ var inc = -1 !== files.indexOf(this.path)
+
+ // WARNING! Hackety hack!
+ // XXX Fix this in a better way.
+ // Rename .gitignore to .npmignore if there is not a
+ // .npmignore file there already, the better to lock
+ // down installed packages with git for deployment.
+ if (this.basename === ".gitignore") {
+ if (this.parent._entries.indexOf(".npmignore") !== -1) {
+ return false
+ }
+ var d = path.dirname(this.path)
+ this.basename = ".npmignore"
+ this.path = path.join(d, ".npmignore")
+ }
+ return inc
}
})
.on("error", log.er(cb, "error reading "+parent))

0 comments on commit 2212118

Please sign in to comment.