mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-03 11:03:39 +00:00
7be38227f0
* feat(package-rules): add matchRegistryUrls option * chore: add patternMatch option * Update docs/usage/configuration-options.md Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com> --------- Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
23 lines
637 B
TypeScript
23 lines
637 B
TypeScript
import { isNullOrUndefined } from '@sindresorhus/is';
|
|
import type {
|
|
PackageRule,
|
|
PackageRuleInputConfig,
|
|
} from '../../config/types.ts';
|
|
import { anyMatchRegexOrGlobList } from '../string-match.ts';
|
|
import { Matcher } from './base.ts';
|
|
|
|
export class RegistryUrlsMatcher extends Matcher {
|
|
override matches(
|
|
{ registryUrls }: PackageRuleInputConfig,
|
|
{ matchRegistryUrls }: PackageRule,
|
|
): boolean | null {
|
|
if (isNullOrUndefined(matchRegistryUrls)) {
|
|
return null;
|
|
}
|
|
if (isNullOrUndefined(registryUrls)) {
|
|
return false;
|
|
}
|
|
return anyMatchRegexOrGlobList(registryUrls, matchRegistryUrls);
|
|
}
|
|
}
|