0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/util/package-rules/package-names.ts
Rhys Arkins 879f7cc212 feat(packageRules): migrate matchers and excludes (#28602)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-07-25 15:28:16 +02:00

21 lines
608 B
TypeScript

import is from '@sindresorhus/is';
import type { PackageRule, PackageRuleInputConfig } from '../../config/types';
import { matchRegexOrGlobList } from '../string-match';
import { Matcher } from './base';
export class PackageNameMatcher extends Matcher {
override matches(
{ packageName }: PackageRuleInputConfig,
packageRule: PackageRule,
): boolean | null {
const { matchPackageNames } = packageRule;
if (is.undefined(matchPackageNames)) {
return null;
}
if (!packageName) {
return false;
}
return matchRegexOrGlobList(packageName, matchPackageNames);
}
}