mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 13:48:55 +00:00
6f9d37a6c0
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Rhys Arkins <rhys@arkins.net>
20 lines
699 B
TypeScript
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);
|
|
}
|
|
}
|
|
}
|