Constructor for NgModuleManager.
The ng-morph adapter instance
Find the NgModule that declares a specific component.
Uses two-tier detection strategy:
@Component decorators@PageComponent)This enables support for projects with external decorator patterns.
The ts-morph Project instance
The name of the component to find (e.g., 'CashbookOverviewComponent')
The source file containing the NgModule, or undefined if not found
const ngModuleFile = ngModuleManager.findNgModuleForComponent(project, 'CashbookOverviewComponent');
if (ngModuleFile) {
console.info(`Found in: ${ngModuleFile.getFilePath()}`);
}
TIER 1 (ng-morph): Fast path for standard Angular components TIER 2 (ts-morph): Fallback for components with custom decorators
Get the imports array from an NgModule.
Uses ng-morph to locate the module, then extracts imports using ts-morph. Simpler than the previous implementation.
The source file containing the NgModule
Array of import names (e.g., ['CommonModule', 'ReactiveFormsModule'])
Remove components from NgModule declarations and exports arrays.
Uses ng-morph to locate the module and ts-morph to remove array elements. This is simpler than the previous implementation.
The source file containing the NgModule
Array of component class names to remove
NgModule Manager - manages NgModule modifications during migration.
This service provides high-level operations for NgModule cleanup, enabling the removal of standalone components from NgModule declarations.