mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 17:16:25 +00:00
079afe1820
Closes #2914
26 lines
601 B
JavaScript
26 lines
601 B
JavaScript
const supportedSchemes = require('../config/definitions')
|
|
.getOptions()
|
|
.find(option => option.name === 'versionScheme').allowedValues;
|
|
|
|
const schemes = {};
|
|
|
|
for (const scheme of supportedSchemes) {
|
|
schemes[scheme] = require('./' + scheme); // eslint-disable-line
|
|
}
|
|
|
|
module.exports = {
|
|
get,
|
|
};
|
|
|
|
function get(versionScheme) {
|
|
if (!versionScheme) {
|
|
logger.debug('Missing versionScheme');
|
|
return schemes.semver;
|
|
}
|
|
const scheme = schemes[versionScheme];
|
|
if (!scheme) {
|
|
logger.warn({ versionScheme }, 'Unknown version scheme');
|
|
return schemes.semver;
|
|
}
|
|
return scheme;
|
|
}
|