refactor: configurable github datasource versioning

Closes #2062
This commit is contained in:
Rhys Arkins 2018-06-04 06:38:13 +02:00
parent 7feca361af
commit 188f1d90b6

View file

@ -1,8 +1,6 @@
const ghGot = require('../platform/github/gh-got-wrapper'); const ghGot = require('../platform/github/gh-got-wrapper');
const versioning = require('../versioning'); const versioning = require('../versioning');
const { isVersion } = versioning('semver');
module.exports = { module.exports = {
getDependency, getDependency,
}; };
@ -49,6 +47,8 @@ async function getDependency(repo, options = {}) {
if (!versions) { if (!versions) {
return null; return null;
} }
// Filter by semver if no versionScheme provided
const { isVersion } = versioning(options.versionScheme || 'semver');
versions = versions.filter(version => isVersion(version)); versions = versions.filter(version => isVersion(version));
if (options.clean === 'true') { if (options.clean === 'true') {
versions = versions.map(version => version.replace(/^v/, '')); versions = versions.map(version => version.replace(/^v/, ''));