Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created January 7, 2012 23:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmalecki/1576534 to your computer and use it in GitHub Desktop.
Save mmalecki/1576534 to your computer and use it in GitHub Desktop.
A little script to analyze how many packages in `npm` have GitHub repositories
var registry = require('./registry');
console.log('Analyzing ' + registry.total_rows + ' rows');
var haveGithub = 0;
registry.rows.forEach(function (row) {
var doc = row.doc;
if (!doc['dist-tags'] || !doc['dist-tags'].latest) {
return console.error(doc.name + ' has no dist-tags');
}
var repo = doc.versions[doc['dist-tags'].latest];
if (!repo) {
return console.error(doc.name + ' is fucked');
}
repo = repo.repository;
repo && repo.url && ~repo.url.indexOf('github.com') && haveGithub++;
});
console.log(haveGithub + ' packages have github');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment