mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
35 lines
794 B
TypeScript
35 lines
794 B
TypeScript
import { isArray, isUndefined } from '@sindresorhus/is';
|
|
import type {
|
|
PackageRule,
|
|
PackageRuleInputConfig,
|
|
} from '../../config/types.ts';
|
|
import {
|
|
anyMatchRegexOrGlobList,
|
|
matchRegexOrGlobList,
|
|
} from '../string-match.ts';
|
|
import { Matcher } from './base.ts';
|
|
|
|
export class FileNamesMatcher extends Matcher {
|
|
override matches(
|
|
{ packageFile, lockFiles }: PackageRuleInputConfig,
|
|
{ matchFileNames }: PackageRule,
|
|
): boolean | null {
|
|
if (isUndefined(matchFileNames)) {
|
|
return null;
|
|
}
|
|
if (isUndefined(packageFile)) {
|
|
return false;
|
|
}
|
|
|
|
if (matchRegexOrGlobList(packageFile, matchFileNames)) {
|
|
return true;
|
|
}
|
|
|
|
if (isArray(lockFiles)) {
|
|
return anyMatchRegexOrGlobList(lockFiles, matchFileNames);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|