angularjs-service-inventory
Read-only mining codemod that inventories AngularJS .service(), .factory(), .provider(), .constant(), and .value() registrations for migration assessment. Each finding is classified with a risk level, an automation confidence, an effort-point estimate, and a recommended migration phase. No files are written to the target repo.
What it does
Scans .js/.ts/.jsx/.tsx files for AngularJS DI-container registrations shaped like <module-or-provider>.<method>('Name', ...):
| Registration | Angular equivalent | Automation | Risk | Effort | Phase |
|---|---|---|---|---|---|
.constant(name, value) | Plain TS constant / InjectionToken | full | low | 1 | phase-1 |
.value(name, value) | Plain TS constant / InjectionToken | full | low | 1 | phase-1 |
.service(name, ctor) | @Injectable() class | full | low | 2 | phase-2 |
.factory(name, fn) | @Injectable() class (needs restructuring from a returned object literal to a class) | partial | medium | 3 | phase-2 |
.provider(name, fn) | Factory provider / InjectionToken (needs re-modeling the $get pattern) | partial | high | 5 | phase-2 |
The service/constant/value name is only recorded when it is a string literal; dynamically computed names (e.g. .service(dynamicName, ...)) are skipped since they can't be resolved statically. Calls with no arguments are also skipped safely.
Heuristic limitation: detection is name-based (matches any call whose callee property is
service/factory/provider/constant/value), so it does not verify that the receiver is actually an AngularJS module or provider object. In practice this is rarely an issue for AngularJS codebases, but unrelated APIs that happen to share these method names could produce false positives.
Metrics
| Metric | Cardinalities |
|---|---|
angularjs_service | file, line, snippet, service_name, registration_type (service|factory|provider|constant|value), migration_category (service), risk, automation, effort_points, recommended_phase |
Installation
bash
Usage
bash
Development
bash
License
MIT