angularjs-component-inventory
Read-only mining codemod that inventories AngularJS .component('name', { ... })
definitions for migration assessment. It does not modify any source files — it
only emits metrics that can be aggregated into a migration report.
What it mines
For every .component('name', { ... }) call whose config argument is an object
literal, the codemod inspects the top-level bindings, controller,
template, and templateUrl properties and emits one angularjs_component
metric entry.
A complexity score is computed as:
text
which drives risk, automation, effort_points, and recommended_phase:
risk:highwhencomplexity >= 6,mediumwhen>= 3, elselow.automation:manualwhenbinding_count > 5(many inputs/outputs to
re-wire by hand),partialwhen a controller is present (behavior needs
review), otherwisefull.effort_points: a Fibonacci-like scale (1/2/3/5/8/13) that
grows withcomplexity.recommended_phase:phase-4for high-risk components (bundled with
core route work),phase-3(leaf feature migration) otherwise.
Components whose second argument is not an object literal (e.g. a shared
config variable) are intentionally skipped, since bindings/controller/template
cannot be statically resolved.
Metric: angularjs_component
| Cardinality | Description |
|---|---|
file | Relative path of the source file |
line | 1-based line number of the .component(...) call |
snippet | Trimmed source snippet of the call (max 160 chars) |
component_name | The component name string, e.g. invoiceList |
has_bindings | true | false |
has_controller | true | false |
has_template | true | false |
has_template_url | true | false |
binding_count | Number of top-level properties in bindings |
migration_category | Always component |
risk | low | medium | high |
automation | full | partial | manual |
effort_points | 1 | 2 | 3 | 5 | 8 | 13 |
recommended_phase | phase-1 .. phase-5 |
Installation
bash
Development
bash
License
MIT