0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-11 13:48:55 +00:00
renovatebot_renovate/lib/config/migrations/custom/custom-managers-migration.ts
RahulGautamSingh 6f9d37a6c0
feat(migrate): regexManagers -> customManagers (#24451)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-09-24 08:55:56 +00:00

20 lines
699 B
TypeScript

import is from '@sindresorhus/is';
import type { CustomManager } from '../../../modules/manager/custom/types';
import { AbstractMigration } from '../base/abstract-migration';
export class CustomManagersMigration extends AbstractMigration {
override readonly propertyName = 'customManagers';
override run(value: unknown): void {
if (is.nonEmptyArray(value)) {
const customManagers = (value as CustomManager[]).map((mgr) => {
if (mgr.customType) {
return mgr;
}
return Object.assign({ customType: 'regex' }, mgr); // to make sure customType is at top, looks good when migration PR is created
});
this.rewrite(customManagers);
}
}
}