fix(packagist): use static endpoint for org lookups

Closes #2785
This commit is contained in:
Rhys Arkins 2018-11-11 07:42:35 +01:00
parent 603f21d9bc
commit 2533fb0751
2 changed files with 7 additions and 4 deletions

View file

@ -173,12 +173,15 @@ async function getAllPackages(regUrl) {
async function packagistOrgLookup(name) {
const regUrl = 'https://packagist.org';
const pkgUrl = URL.resolve(regUrl, `/packages/${name}.json`);
const pkgUrl = URL.resolve(regUrl, `/p/${name}.json`);
const res = (await got(pkgUrl, {
json: true,
retry: 5,
})).body.package;
const dep = extractDepReleases(res.versions);
})).body.packages[name];
if (!res) {
return null;
}
const dep = extractDepReleases(res);
dep.name = name;
logger.trace({ dep }, 'dep');
return dep;

File diff suppressed because one or more lines are too long