Files
n8n/packages/cli/src/modules/breaking-changes/breaking-changes.module.ts
T

25 lines
961 B
TypeScript

import { MIGRATION_REPORT_TARGET_VERSION } from '@n8n/api-types';
import type { ModuleInterface } from '@n8n/decorators';
import { BackendModule } from '@n8n/decorators';
import { Container } from '@n8n/di';
@BackendModule({ name: 'breaking-changes', instanceTypes: ['main'] })
export class BreakingChangesModule implements ModuleInterface {
async init() {
if (!MIGRATION_REPORT_TARGET_VERSION) return;
// Import rules so that they are added to the BreakingChangeRuleMetadata registry
await import('./rules/index.js');
// Register rules in the service
const { BreakingChangeService } = await import('./breaking-changes.service.js');
Container.get(BreakingChangeService).registerRules();
// Register the node migrations keyed by rule id
const { MigrationRegistry } = await import('./breaking-changes.migration-registry.service.js');
Container.get(MigrationRegistry).registerAll();
await import('./breaking-changes.controller.js');
}
}