0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/config/migrations/custom/match-datasources-migration.ts
2023-04-12 13:43:59 +00:00

26 lines
701 B
TypeScript

import is from '@sindresorhus/is';
import { AbstractMigration } from '../base/abstract-migration';
export class MatchDatasourcesMigration extends AbstractMigration {
override readonly propertyName = 'matchDatasources';
override run(value: unknown): void {
if (Array.isArray(value)) {
const newValue = value.filter(is.nonEmptyString).map((datasource) => {
switch (datasource) {
case 'adoptium-java':
return 'java-version';
case 'dotnet':
return 'dotnet-version';
case 'node':
return 'node-version';
default:
return datasource;
}
});
this.rewrite(newValue);
}
}
}