0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/config/migrations/custom/node-migration.ts
RahulGautamSingh 8b9d038fa3
refactor(migrations): migrate node (#16422)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2022-07-06 04:39:48 +00:00

23 lines
682 B
TypeScript

import type { RenovateConfig } from '../../types';
import { AbstractMigration } from '../base/abstract-migration';
export class NodeMigration extends AbstractMigration {
override readonly propertyName = 'node';
override run(value: unknown): void {
const node = this.get('node') as RenovateConfig;
if ((value as RenovateConfig).enabled === true) {
// validated non-null
delete node.enabled;
const travis = (this.get('travis') ?? {}) as RenovateConfig;
travis.enabled = true;
if (Object.keys(node).length) {
this.rewrite(node);
} else {
this.delete('node');
}
this.setSafely('travis', travis);
}
}
}