Skip to content

Commit dd0a74d

Browse files
luke-rogerssean-perkins
authored andcommitted
fix: formatting...
1 parent 20d63f7 commit dd0a74d

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

packages/cli/src/angular/migrations/standalone/0004-migrate-import-statements.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@ export const migrateImportStatements = async (
88
project: Project,
99
cliOptions: CliOptions,
1010
) => {
11-
// Get all typescript source files in the project and update any @ionic/angular imports to @ionic/angular/standalone
12-
for (const sourceFile of project.getSourceFiles()) {
13-
if (!sourceFile.getFilePath().endsWith('.ts')) {
14-
continue;
15-
}
11+
// Get all typescript source files in the project and update any @ionic/angular imports to @ionic/angular/standalone
12+
for (const sourceFile of project.getSourceFiles()) {
13+
if (!sourceFile.getFilePath().endsWith(".ts")) {
14+
continue;
15+
}
1616

17-
let hasChanges = false;
17+
let hasChanges = false;
1818

19-
const importDeclarations = sourceFile.getImportDeclarations();
20-
importDeclarations.forEach((importDeclaration) => {
21-
const moduleSpecifier = importDeclaration.getModuleSpecifierValue();
22-
if (moduleSpecifier === "@ionic/angular") {
23-
importDeclaration.setModuleSpecifier("@ionic/angular/standalone");
19+
const importDeclarations = sourceFile.getImportDeclarations();
20+
importDeclarations.forEach((importDeclaration) => {
21+
const moduleSpecifier = importDeclaration.getModuleSpecifierValue();
22+
if (moduleSpecifier === "@ionic/angular") {
23+
importDeclaration.setModuleSpecifier("@ionic/angular/standalone");
2424

25-
const namedImports = importDeclaration.getNamedImports();
26-
const importSpecifier = namedImports.find(
25+
const namedImports = importDeclaration.getNamedImports();
26+
const importSpecifier = namedImports.find(
2727
(n) => n.getName() === "IonicModule",
2828
);
2929

30-
if (importSpecifier) {
31-
if (namedImports.length > 1) {
32-
// Remove the IonicModule import specifier.
33-
importSpecifier.remove();
34-
} else {
35-
// If this is the only import specifier, remove the entire import declaration.
36-
importDeclaration.remove();
37-
}
38-
removeImportFromNgModuleDecorator(sourceFile, "IonicModule");
39-
}
40-
41-
hasChanges = true;
42-
}
43-
});
44-
45-
if (hasChanges) {
46-
await saveFileChanges(sourceFile, cliOptions);
30+
if (importSpecifier) {
31+
if (namedImports.length > 1) {
32+
// Remove the IonicModule import specifier.
33+
importSpecifier.remove();
34+
} else {
35+
// If this is the only import specifier, remove the entire import declaration.
36+
importDeclaration.remove();
37+
}
38+
removeImportFromNgModuleDecorator(sourceFile, "IonicModule");
4739
}
40+
41+
hasChanges = true;
42+
}
43+
});
44+
45+
if (hasChanges) {
46+
await saveFileChanges(sourceFile, cliOptions);
4847
}
48+
}
4949
};

0 commit comments

Comments
 (0)