mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(datasource): massage github sourceUrl if present
This commit is contained in:
parent
3ba6d79458
commit
2e7e36bb5a
2 changed files with 14 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
const is = require('@sindresorhus/is');
|
||||
const parse = require('github-url-from-git');
|
||||
|
||||
module.exports = {
|
||||
addMetaData,
|
||||
|
@ -78,6 +79,9 @@ function addMetaData(dep, datasource, lookupName) {
|
|||
if (manualSourceUrls[datasource] && manualSourceUrls[datasource][depName]) {
|
||||
dep.sourceUrl = manualSourceUrls[datasource][depName];
|
||||
}
|
||||
if (dep.sourceUrl && dep.sourceUrl.includes('github.com')) {
|
||||
dep.sourceUrl = parse(dep.sourceUrl);
|
||||
}
|
||||
if (
|
||||
!dep.sourceUrl &&
|
||||
dep.changelogUrl &&
|
||||
|
|
|
@ -62,4 +62,14 @@ describe('datasource/index', () => {
|
|||
});
|
||||
expect(res.sourceUrl).toEqual('https://abc.com');
|
||||
});
|
||||
it('massages sourceUrl', async () => {
|
||||
npmDatasource.getPkgReleases.mockReturnValue({
|
||||
sourceUrl: 'scm:git@github.com:Jasig/cas.git',
|
||||
});
|
||||
const res = await datasource.getPkgReleases({
|
||||
datasource: 'npm',
|
||||
depName: 'cas',
|
||||
});
|
||||
expect(res.sourceUrl).toEqual('https://github.com/Jasig/cas');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue