renovate/lib/manager/index.js
Sergio Zharinov b7848757cb feat(dart): Add support for Dart (#3468)
It works for most of Dart pubfiles (except invalid YAML). Later maybe we should implement own "weaker" parser.

Closes #3301
2019-04-15 15:07:54 +02:00

88 lines
1.6 KiB
JavaScript

const managerList = [
'ansible',
'bazel',
'buildkite',
'bundler',
'cargo',
'circleci',
'composer',
'docker-compose',
'dockerfile',
'github-actions',
'gitlabci',
'gomod',
'gradle',
'gradle-wrapper',
'kubernetes',
'maven',
'meteor',
'npm',
'nuget',
'nvm',
'pip_requirements',
'pip_setup',
'pipenv',
'poetry',
'pub',
'terraform',
'travis',
'ruby-version',
];
const managers = {};
for (const manager of managerList) {
// eslint-disable-next-line global-require,import/no-dynamic-require
managers[manager] = require(`./${manager}`);
}
const languageList = [
'dart',
'docker',
'dotnet',
'golang',
'js',
'node',
'php',
'python',
'ruby',
'rust',
];
const get = (manager, name) => managers[manager][name];
const getLanguageList = () => languageList;
const getManagerList = () => managerList;
module.exports = {
get,
getLanguageList,
getManagerList,
};
const managerFunctions = [
'extractAllPackageFiles',
'extractPackageFile',
'getPackageUpdates',
'supportsLockFileMaintenance',
'updateDependency',
];
for (const f of managerFunctions) {
module.exports[f] = (manager, ...params) => {
if (managers[manager][f]) {
return managers[manager][f](...params);
}
return null;
};
}
module.exports.getRangeStrategy = config => {
const { manager, rangeStrategy } = config;
if (managers[manager].getRangeStrategy) {
// Use manager's own function if it exists
return managers[manager].getRangeStrategy(config);
}
if (rangeStrategy === 'auto') {
// default to 'replace' for auto
return 'replace';
}
return config.rangeStrategy;
};