Skip to content
Snippets Groups Projects
Unverified Commit b15909f8 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat: enabledManagers (#1755)

feat: enabledManagers
parent b98a834e
No related branches found
No related tags found
No related merge requests found
...@@ -259,6 +259,13 @@ const options = [ ...@@ -259,6 +259,13 @@ const options = [
cli: false, cli: false,
admin: true, admin: true,
}, },
{
name: 'enabledManagers',
description:
'A list of package managers to enable. If defined, then all managers not on the list are disabled.',
type: 'list',
stage: 'repository',
},
{ {
name: 'packageFiles', name: 'packageFiles',
description: 'Package file paths', description: 'Package file paths',
......
...@@ -39,6 +39,20 @@ async function detectPackageFiles(config) { ...@@ -39,6 +39,20 @@ async function detectPackageFiles(config) {
); );
for (const manager of managerList) { for (const manager of managerList) {
logger.debug(`Detecting package files (${manager})`); logger.debug(`Detecting package files (${manager})`);
const { parentManager } = managers[manager];
// Check if the user has a whitelist of managers
if (
config.enabledManagers &&
config.enabledManagers.length &&
!(
config.enabledManagers.includes(manager) ||
config.enabledManagers.includes(parentManager)
)
) {
logger.debug(manager + ' is not on the enabledManagers list');
continue; // eslint-disable-line no-continue
}
// Check if the manager is manually disabled
if (!(config[manager] && config[manager].enabled)) { if (!(config[manager] && config[manager].enabled)) {
logger.debug(manager + ' is disabled'); logger.debug(manager + ' is disabled');
continue; // eslint-disable-line no-continue continue; // eslint-disable-line no-continue
......
...@@ -20,6 +20,15 @@ describe('manager', () => { ...@@ -20,6 +20,15 @@ describe('manager', () => {
warnings: [], warnings: [],
}; };
}); });
it('skips if not in enabledManagers list', async () => {
platform.getFileList.mockReturnValueOnce([
'package.json',
'backend/package.json',
]);
config.enabledManagers = ['docker'];
const res = await manager.detectPackageFiles(config);
expect(res).toHaveLength(0);
});
it('adds package files to object', async () => { it('adds package files to object', async () => {
platform.getFileList.mockReturnValueOnce([ platform.getFileList.mockReturnValueOnce([
'package.json', 'package.json',
......
...@@ -286,6 +286,28 @@ To disable Renovate for `dependencies` but keep it for `devDependencies` you cou ...@@ -286,6 +286,28 @@ To disable Renovate for `dependencies` but keep it for `devDependencies` you cou
} }
``` ```
## enabledManagers
A list of package managers to enable. If defined, then all managers not on the list are disabled.
| name | value |
| ------- | ----- |
| type | list |
| default | [] |
This is a way to "whitelist" certain package managers and disable all others.
By default, as Renovate supports more package managers we enable them once they are stable, but for some people only interested in perhaps npm dependencies, it can feel like "whack-a-mole" to keep disabling new ones you don't want.
This works for both managers (e.g. npm, circleci, nvm, etc) as well as "parent" managers (docker or node).
Example:
````json
{
"enabledManagers": ["npm"]
}
## encrypted ## encrypted
A configuration object containing strings encrypted with Renovate's public key. A configuration object containing strings encrypted with Renovate's public key.
...@@ -386,7 +408,7 @@ By default, Renovate will "slugify" the groupName to determine the branch name. ...@@ -386,7 +408,7 @@ By default, Renovate will "slugify" the groupName to determine the branch name.
```json ```json
"groupName": "eslint packages", "groupName": "eslint packages",
"groupSlug": "eslint" "groupSlug": "eslint"
``` ````
And then the branchName would be `renovate/eslint` instead. And then the branchName would be `renovate/eslint` instead.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment