Files
Kristiyan Kostadinov d298d25426 feat(migrations): add schematic to clean up unused imports (#59353)
In v19 we added a warning about unused standalone imports, however we didn't do anything about existing code which means that users have to clean it up manually. These changes add the `ng g @angular/core:cleanup-unused-imports` schematic which will remove the unused dependencies automatically.

There isn't any new detection code since all the manipulations are based on the produced diagnostics, but there's a bit of code to remove the import declarations from the file as well.

Fixes #58849.

PR Close #59353
2025-01-06 16:21:26 +00:00

57 lines
2.6 KiB
JSON

{
"schematics": {
"standalone-migration": {
"description": "Converts the entire application or a part of it to standalone",
"factory": "./bundles/standalone-migration#migrate",
"schema": "./ng-generate/standalone-migration/schema.json",
"aliases": ["standalone"]
},
"control-flow-migration": {
"description": "Converts the entire application to block control flow syntax",
"factory": "./bundles/control-flow-migration#migrate",
"schema": "./ng-generate/control-flow-migration/schema.json",
"aliases": ["control-flow"]
},
"inject-migration": {
"description": "Converts usages of constructor-based injection to the inject() function",
"factory": "./bundles/inject-migration#migrate",
"schema": "./ng-generate/inject-migration/schema.json",
"aliases": ["inject"]
},
"route-lazy-loading-migration": {
"description": "Updates route definitions to use lazy-loading of components instead of eagerly referencing them",
"factory": "./bundles/route-lazy-loading#migrate",
"schema": "./ng-generate/route-lazy-loading/schema.json",
"aliases": ["route-lazy-loading"]
},
"signal-input-migration": {
"description": "Updates `@Input` declarations to signal inputs, while also migrating all relevant references.",
"factory": "./bundles/signal-input-migration#migrate",
"schema": "./ng-generate/signal-input-migration/schema.json",
"aliases": ["signal-inputs", "signal-input"]
},
"signal-queries-migration": {
"description": "Updates query declarations to signal queries, while also migrating all relevant references.",
"factory": "./bundles/signal-queries-migration#migrate",
"schema": "./ng-generate/signal-queries-migration/schema.json",
"aliases": ["signal-queries", "signal-query", "signal-query-migration"]
},
"output-migration": {
"description": "Updates @output declarations to the functional equivalent, while also migrating all relevant references.",
"factory": "./bundles/output-migration#migrate",
"schema": "./ng-generate/output-migration/schema.json",
"aliases": ["outputs"]
},
"signals": {
"description": "Combines all signals-related migrations into a single migration",
"factory": "./bundles/signals#migrate",
"schema": "./ng-generate/signals/schema.json"
},
"cleanup-unused-imports": {
"description": "Removes unused imports from standalone components.",
"factory": "./bundles/cleanup-unused-imports#migrate",
"schema": "./ng-generate/cleanup-unused-imports/schema.json"
}
}
}