Last active
August 29, 2015 14:03
-
-
Save rctay/5a12df53eeaebced0471 to your computer and use it in GitHub Desktop.
demo to filter out 'source' field in deps output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('browserify'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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