mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
ecdcd9df4f
Rewrite of dependency extraction, particularly for npm. Paves way for easier addition of new package managers. Closes #1882
46 lines
935 B
JavaScript
46 lines
935 B
JavaScript
const managerList = [
|
|
'bazel',
|
|
'buildkite',
|
|
'circleci',
|
|
'docker',
|
|
'docker-compose',
|
|
'meteor',
|
|
'npm',
|
|
'nvm',
|
|
'pip_requirements',
|
|
'travis',
|
|
];
|
|
const managers = {};
|
|
for (const manager of managerList) {
|
|
// eslint-disable-next-line global-require,import/no-dynamic-require
|
|
managers[manager] = require(`./${manager}`);
|
|
}
|
|
|
|
const languageList = ['node', 'python'];
|
|
|
|
const get = (manager, name) => managers[manager][name];
|
|
const getLanguageList = () => languageList;
|
|
const getManagerList = () => managerList;
|
|
|
|
module.exports = {
|
|
get,
|
|
getLanguageList,
|
|
getManagerList,
|
|
};
|
|
|
|
const managerFunctions = [
|
|
'extractDependencies',
|
|
'postExtract',
|
|
'getPackageUpdates',
|
|
'updateDependency',
|
|
'supportsLockFileMaintenance',
|
|
];
|
|
|
|
for (const f of managerFunctions) {
|
|
module.exports[f] = (manager, ...params) => {
|
|
if (managers[manager][f]) {
|
|
return managers[manager][f](...params);
|
|
}
|
|
return null;
|
|
};
|
|
}
|