Skip to content

Instantly share code, notes, and snippets.

@mlms13
Created February 2, 2015 18:22
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 mlms13/bb0a07a762e474672884 to your computer and use it in GitHub Desktop.
Save mlms13/bb0a07a762e474672884 to your computer and use it in GitHub Desktop.
Audit Browserify Dependencies
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