Aalexbit-codemod

angularjs-component-inventory

Mine AngularJS .component() definitions, bindings, controllers, templates; read-only metrics

miningmetricsangularjscode-miningmigration-assessmentangularjs_component
PRO
0 executions
Use dashboard

Run locally

npx codemod angularjs-component-inventory

This is a Pro codemod. Preview changes and insights for free, no login or code sharing required. Applying changes and accessing insights requires a paid plan and sign in.Learn more

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: high when complexity >= 6, medium when >= 3, else low.
  • automation: manual when binding_count > 5 (many inputs/outputs to
    re-wire by hand), partial when a controller is present (behavior needs
    review), otherwise full.
  • effort_points: a Fibonacci-like scale (1/2/3/5/8/13) that
    grows with complexity.
  • recommended_phase: phase-4 for 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

CardinalityDescription
fileRelative path of the source file
line1-based line number of the .component(...) call
snippetTrimmed source snippet of the call (max 160 chars)
component_nameThe component name string, e.g. invoiceList
has_bindingstrue | false
has_controllertrue | false
has_templatetrue | false
has_template_urltrue | false
binding_countNumber of top-level properties in bindings
migration_categoryAlways component
risklow | medium | high
automationfull | partial | manual
effort_points1 | 2 | 3 | 5 | 8 | 13
recommended_phasephase-1 .. phase-5

Installation

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.