Created
February 2, 2015 18:22
-
-
Save mlms13/bb0a07a762e474672884 to your computer and use it in GitHub Desktop.
Audit Browserify Dependencies
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 mdeps = require('module-deps'), | |
_ = require('lodash'), | |
deps = []; | |
var md = mdeps({ | |
transform: 'hbsfy', | |
global: true | |
}); | |
md.on('end', function () { | |
// why does this not get called? | |
console.log('There will be no more data.'); | |
}); | |
md.end({ | |
file: __dirname + '/src/index.js' | |
}); | |
md.on('error', function (err) { | |
console.error(err); | |
}); | |
md.on('package', function (data) { | |
if (data.name && data.version) { | |
deps.push(data.name + ' ' + data.version); | |
} | |
}); | |
setTimeout(function () { | |
var sorted = _.uniq(deps).sort(); | |
sorted.forEach(function (item) { | |
console.log(item) | |
}); | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment