Skip to content

Commit c8c35d2

Browse files
committed
refactor(migrations): print stats of signal input migration (angular#58035)
Print some stats for the signal input migration. PR Close angular#58035
1 parent 00a79d0 commit c8c35d2

File tree

2 files changed

+11
-1
lines changed
  • packages/core/schematics

2 files changed

+11
-1
lines changed

packages/core/schematics/migrations/signal-migration/src/migration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class SignalInputMigration extends TsurgeComplexMigration<
180180
return result.replacements;
181181
}
182182

183-
override async stats(globalMetadata: CompilationUnitData): Promise<MigrationStats> {
183+
override async stats(globalMetadata: CompilationUnitData) {
184184
let fullCompilationInputs = 0;
185185
let sourceInputs = 0;
186186
let incompatibleInputs = 0;

packages/core/schematics/ng-generate/signal-input-migration/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ export function migrate(options: Options): Rule {
104104
tree.commitUpdate(recorder);
105105
}
106106

107+
const {counters} = await migration.stats(merged);
108+
const migratedInputs = counters.sourceInputs - counters.incompatibleInputs;
109+
107110
context.logger.info('');
108111
context.logger.info(`Successfully migrated to signal inputs 🎉`);
112+
context.logger.info(` -> Migrated ${migratedInputs}/${counters.sourceInputs} inputs.`);
113+
114+
if (counters.incompatibleInputs > 0 && !options.insertTodos) {
115+
context.logger.warn(`To see why ${counters.incompatibleInputs} inputs couldn't be migrated`);
116+
context.logger.warn(`consider re-running with "--insert-todos" or "--best-effort-mode".`);
117+
}
118+
109119
if (options.bestEffortMode) {
110120
context.logger.warn(
111121
`You ran with best effort mode. Manually verify all code ` +

0 commit comments

Comments
 (0)