Skip to content
This repository was archived by the owner on Nov 16, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fstream-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) {
entry === '.hg' ||
entry === '.lock-wscript' ||
entry.match(/^\.wafpickle-[0-9]+$/) ||
entry === 'config.gypi' ||
(this.parent && this.parent.packageRoot && this.basename === 'build' &&
entry === 'config.gypi') ||
entry === 'npm-debug.log' ||
entry === '.npmrc' ||
entry.match(/^\..*\.swp$/) ||
Expand Down
39 changes: 32 additions & 7 deletions test/ignores.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,40 @@ test('setup', function (t) {

var included = [
'package.json',
'elf.js'
'elf.js',
join('deps', 'foo', 'config', 'config.gypi')
]

test('follows npm package ignoring rules', function (t) {
var subject = new Packer({ path: pkg, type: 'Directory', isDirectory: true })
var filenames = []
subject.on('entry', function (entry) {
t.equal(entry.type, 'File', 'only files in this package')
var filename = entry.basename
t.ok(
included.indexOf(filename) > -1,
filename + ' is included'
)

// include relative path in filename
var filename = entry._path.slice(entry.root._path.length + 1)

filenames.push(filename)
})
// need to do this so fstream doesn't explode when files are removed from
// under it
subject.on('end', function () { t.end() })
subject.on('end', function () {
// ensure we get *exactly* the results we expect by comparing in both
// directions
filenames.forEach(function (filename) {
t.ok(
included.indexOf(filename) > -1,
filename + ' is included'
)
})
included.forEach(function (filename) {
t.ok(
filenames.indexOf(filename) > -1,
filename + ' is not included'
)
})
t.end()
})
})

test('cleanup', function (t) {
Expand Down Expand Up @@ -78,6 +96,13 @@ function setup () {
"i_wont_be_included_by_fstream='with any luck'"
)

var depscfg = join(pkg, 'deps', 'foo', 'config')
mkdirp.sync(depscfg)
fs.writeFileSync(
join(depscfg, 'config.gypi'),
"i_will_be_included_by_fstream='with any luck'"
)

fs.writeFileSync(
join(build, 'npm-debug.log'),
'0 lol\n'
Expand Down