0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-12 23:51:55 +00:00
renovatebot_renovate/lib/config/migrations/custom/file-match-migration.ts
RahulGautamSingh bc7d0595d0
feat(config): managerFilePatterns (#34615)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-05-04 08:30:24 +00:00

20 lines
666 B
TypeScript

import is from '@sindresorhus/is';
import { AbstractMigration } from '../base/abstract-migration';
export class FileMatchMigration extends AbstractMigration {
override readonly deprecated = true;
override readonly propertyName = 'fileMatch';
override run(value: unknown): void {
if (is.string(value) || is.array(value, is.string)) {
const fileMatch = is.array(value) ? value : [value];
let managerFilePatterns = this.get('managerFilePatterns') ?? [];
managerFilePatterns = managerFilePatterns.concat(
fileMatch.map((match) => `/${match}/`),
);
this.setHard('managerFilePatterns', managerFilePatterns);
}
}
}