Skip to content

Instantly share code, notes, and snippets.

@rctay
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rctay/5a12df53eeaebced0471 to your computer and use it in GitHub Desktop.
Save rctay/5a12df53eeaebced0471 to your computer and use it in GitHub Desktop.
demo to filter out 'source' field in deps output
var browserify = require('browserify');
var JSONStream = require('JSONStream');
var through = require('through2');
var b = browserify({basedir: __dirname, entries: ['./main.js']})
b.deps({})
.pipe(through({objectMode: true}, function(chunk, enc, cb) {
// poor man's _.omit()
var o = {};
for (var prop in chunk) {
if (prop === 'source')
continue;
o[prop] = chunk[prop];
}
this.push(o);
cb();
}))
.pipe(JSONStream.stringify())
.pipe(process.stdout);
b.bundle();
require('browserify');
{
"dependencies": {
"browserify": "^4.2.0",
"JSONStream": "^0.8.4",
"through2": "^0.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment