Aalexbit-codemod

angularjs-module-inventory

Mine AngularJS modules, dependencies, root/shared modules; read-only metrics

miningmetricsangularjscode-miningmigration-assessmentangularjs_module
PRO
0 executions

Run locally

npx codemod angularjs-module-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-module-inventory

Read-only mining codemod that inventories AngularJS angular.module(...) usage
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 angular.module('name', [...]) definition and angular.module('name')
getter, the codemod emits one angularjs_module metric entry classifying the
module as a root module (application bootstrap), a shared module (common
naming or many dependents), or a regular feature module.

Heuristics used (single-file, AST-only — no cross-file resolution):

  • kind: definition when the call passes a second argument (the
    dependency array), getter when it only passes the module name.
  • is_root: true when the call is a definition with at least one
    dependency and the module name matches a common app-root name (app,
    myApp, application, main).
  • is_shared: true when the module name contains a common shared
    segment (shared, common, core, ui, utils/util, e.g. app.core),
    or the module name appears as a dependency in 2+ other angular.module()
    calls within the same file.
  • risk / automation / effort_points / recommended_phase: derived
    from the above — root and shared modules are riskier, need more manual
    review, and are recommended earlier in the rollout (phase-1 / phase-2),
    while regular feature modules are fully automatable and scheduled for
    phase-3.

Metric: angularjs_module

CardinalityDescription
fileRelative path of the source file
line1-based line number of the angular.module(...) call
snippetTrimmed source snippet of the call (max 160 chars)
module_nameThe module name string, e.g. app.billing
kinddefinition | getter
dependency_countNumber of string dependencies in the deps array
is_roottrue | false
is_sharedtrue | false
migration_categoryAlways module
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.