Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.