Skip to content

Commit

Permalink
feat(composer): support providers without a hash (#13000)
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm committed Dec 8, 2021
1 parent 3192235 commit 3f586ef
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
30 changes: 30 additions & 0 deletions lib/datasource/packagist/__snapshots__/index.spec.ts.snap
Expand Up @@ -700,3 +700,33 @@ Array [
},
]
`;

exports[`datasource/packagist/index getReleases supports providers without a hash 1`] = `
Object {
"homepage": "https://wordpress.org/plugins/1beyt/",
"registryUrl": "https://composer.renovatebot.com",
"releases": Array [
Object {
"gitRef": "1.0",
"version": "1.0",
},
Object {
"gitRef": "1.1",
"version": "1.1",
},
Object {
"gitRef": "1.4",
"version": "1.4",
},
Object {
"gitRef": "1.5",
"version": "1.5",
},
Object {
"gitRef": "1.5.1",
"version": "1.5.1",
},
],
"sourceUrl": "https://plugins.svn.wordpress.org/1beyt/",
}
`;
28 changes: 28 additions & 0 deletions lib/datasource/packagist/index.spec.ts
Expand Up @@ -305,6 +305,34 @@ describe('datasource/packagist/index', () => {
expect(res).not.toBeNull();
expect(httpMock.getTrace()).toMatchSnapshot();
});
it('supports providers without a hash', async () => {
const packagesJson = {
packages: [],
'providers-url': '/p/%package%.json',
providers: {
'wpackagist-plugin/1337-rss-feed-made-for-sharing': {
sha256: null,
},
'wpackagist-plugin/1beyt': {
sha256: null,
},
},
};
httpMock
.scope('https://composer.renovatebot.com')
.get('/packages.json')
.reply(200, packagesJson)
.get('/p/wpackagist-plugin/1beyt.json')
.reply(200, beytJson);
const res = await getPkgReleases({
...config,
datasource,
versioning,
depName: 'wpackagist-plugin/1beyt',
});
expect(res).toMatchSnapshot();
expect(res).not.toBeNull();
});
it('handles providers miss', async () => {
const packagesJson = {
packages: [],
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/packagist/index.ts
Expand Up @@ -238,7 +238,7 @@ async function packageLookup(
return includesPackages[name];
}
let pkgUrl;
if (providerPackages?.[name]) {
if (name in providerPackages) {
pkgUrl = URL.resolve(
regUrl,
providersUrl
Expand Down

0 comments on commit 3f586ef

Please sign in to comment.