Skip to content

Commit ace116f

Browse files
authored
fix(migrations): also handle cases for licensed package name (#16547)
1 parent f9b739b commit ace116f

File tree

1 file changed

+5
-4
lines changed
  • projects/igniteui-angular/migrations/update-21_0_0_import-migration

1 file changed

+5
-4
lines changed

projects/igniteui-angular/migrations/update-21_0_0_import-migration/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ function migrateImportDeclaration(node: ts.ImportDeclaration, sourceFile: ts.Sou
718718
const importPath = moduleSpecifier.text;
719719

720720
// Only process igniteui-angular imports (not already using entry points)
721-
if (importPath !== 'igniteui-angular') {
721+
if (importPath !== 'igniteui-angular' && importPath !== '@infragistics/igniteui-angular') {
722722
return null;
723723
}
724724

@@ -768,7 +768,7 @@ function migrateImportDeclaration(node: ts.ImportDeclaration, sourceFile: ts.Sou
768768
const newImports: string[] = [];
769769
for (const [entryPoint, imports] of entryPointGroups) {
770770
const sortedImports = imports.sort();
771-
newImports.push(`import { ${sortedImports.join(', ')} } from 'igniteui-angular/${entryPoint}';`);
771+
newImports.push(`import { ${sortedImports.join(', ')} } from '${importPath}/${entryPoint}';`);
772772
}
773773

774774
return {
@@ -799,7 +799,7 @@ function migrateFile(filePath: string, content: string): string {
799799

800800
// Track old type names that were imported
801801
const moduleSpecifier = node.moduleSpecifier;
802-
if (ts.isStringLiteral(moduleSpecifier) && moduleSpecifier.text === 'igniteui-angular') {
802+
if (ts.isStringLiteral(moduleSpecifier) && (moduleSpecifier.text === 'igniteui-angular' || moduleSpecifier.text === '@infragistics/igniteui-angular')) {
803803
const importClause = node.importClause;
804804
if (importClause?.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
805805
for (const element of importClause.namedBindings.elements) {
@@ -877,7 +877,8 @@ export default function migrate(): Rule {
877877
const originalContent = content.toString();
878878

879879
// Check if file has igniteui-angular imports
880-
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"')) {
880+
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"') &&
881+
!originalContent.includes("from '@infragistics/igniteui-angular'") && !originalContent.includes('from "@infragistics/igniteui-angular"')) {
881882
return;
882883
}
883884

0 commit comments

Comments
 (0)