Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(composer): support providers without a hash #13000

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions lib/datasource/packagist/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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