mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
69dab293f5
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
24 lines
746 B
TypeScript
24 lines
746 B
TypeScript
import is from '@sindresorhus/is';
|
|
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
|
|
import { isCustomManager } from '../../modules/manager/custom';
|
|
import { matchRegexOrGlobList } from '../string-match';
|
|
import { Matcher } from './base';
|
|
|
|
export class ManagersMatcher extends Matcher {
|
|
override matches(
|
|
{ manager }: PackageRuleInputConfig,
|
|
{ matchManagers }: PackageRule,
|
|
): boolean | null {
|
|
if (is.undefined(matchManagers)) {
|
|
return null;
|
|
}
|
|
if (is.undefined(manager) || !manager) {
|
|
return false;
|
|
}
|
|
if (isCustomManager(manager)) {
|
|
return matchRegexOrGlobList(`custom.${manager}`, matchManagers);
|
|
}
|
|
return matchRegexOrGlobList(manager, matchManagers);
|
|
}
|
|
}
|