Created
April 2, 2015 21:06
-
-
Save thibauts/9e90e7fbfc46a4d27b54 to your computer and use it in GitHub Desktop.
Packages used along some package
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
$ node index.js gl-shader | |
11 gl-buffer | |
11 gl-vao | |
10 gl-texture2d | |
10 ndarray | |
6 glslify | |
6 a-big-triangle | |
5 gl-fbo | |
5 gl-mat4 | |
5 typedarray-pool | |
4 ndarray-ops | |
3 barycentric | |
3 colormap | |
3 binary-search-bounds | |
3 glsl-specular-cook-torrance | |
3 normals |
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
$ node index.js dom-events | |
5 inherits | |
3 events | |
3 xtend | |
3 domready | |
2 bower | |
2 insert-css | |
2 hapi | |
2 hoek | |
2 request | |
2 handlebars | |
2 browserify | |
2 brfs | |
2 moment | |
2 mouse-event-offset | |
2 mkdirp |
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
$ node index.js glslify | |
19 gl-buffer | |
18 gl-vao | |
15 gl-mat4 | |
10 gl-texture2d | |
9 ndarray | |
6 gl-matrix | |
6 gl-shader | |
5 a-big-triangle | |
5 typedarray-pool | |
4 bit-twiddle | |
4 gl-fbo | |
4 dup | |
4 brfs | |
4 colormap | |
4 glsl-specular-cook-torrance |
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 getDependents = require('npm-get-dependents'); | |
var async = require('async'); | |
var request = require('request'); | |
var packageName = process.argv[2]; | |
getDependents(packageName, function(err, packages) { | |
if(err) throw err; | |
async.map(packages, getDependencies, function(err, results) { | |
if(err) throw err; | |
packages = results.reduce(function(memo, result) { | |
return memo.concat(result); | |
}, []); | |
var counts = {}; | |
packages.forEach(function(packageName) { | |
if(!counts[packageName]) counts[packageName] = 1; | |
else counts[packageName]++; | |
}); | |
var items = Object.keys(counts) | |
.map(function(key) { | |
return [key, counts[key]]; | |
}) | |
.sort(function(a, b) { | |
return b[1] - a[1]; | |
}) | |
items | |
.slice(0, 15) | |
.forEach(function(item) { | |
console.log(item[1] + '\t' + item[0]); | |
}); | |
}); | |
}); | |
function getDependencies(packageName, callback) { | |
var url = 'http://registry.npmjs.org/' + packageName + '/latest'; | |
request.get(url, function(err, res) { | |
if(err) return callback(err); | |
var info = JSON.parse(res.body); | |
var deps = Object.keys(info.dependencies); | |
callback(null, deps); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment