Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Created July 22, 2018 23:05
Show Gist options
  • Save rudiedirkx/602fdb70d73c7bdcbeed98281158297c to your computer and use it in GitHub Desktop.
Save rudiedirkx/602fdb70d73c7bdcbeed98281158297c to your computer and use it in GitHub Desktop.
var PACKAGE = 'rdx/db';
ghGrapQL(`query { viewer { login, repositories(first: 100, privacy: PUBLIC, orderBy: {direction: DESC, field: PUSHED_AT}) { nodes { name } } } }`).then(rsp => {
return rsp.data.viewer.repositories.nodes.map(repo => `${rsp.data.viewer.login}/${repo.name}`)
}).then(repos => {
return repos.map(repo => {
return (rsps) => {
console.log(repo);
return fetch(`https://rawgit.com/${repo}/master/composer.json`).then(rsp => rsp.ok ? rsp.json() : null).then(rsp => rsps.concat([[repo, rsp]]));
}
});
}).then(cbs => {
return cbs.reduce((P, cb) => P.then(cb), Promise.resolve([]));
}).then(infos => {
return infos.filter(info => info[1] && info[1].require && info[1].require[PACKAGE]).map(info => [info[0], info[1].require[PACKAGE]]);
}).then(list => console.log('packages using ' + PACKAGE, list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment