Files
renovate/lib/util/package-rules/files.ts
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

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;
}
}