lineage-ts
lineage-tsCLI to identify all descendant imports of a ts file

Highlights
- :checkered_flag: Fast
- Uses
to analyze the AST import specifiers of a typescript projectts-morph
- Uses
- :large_blue_circle: .ts
- :see_no_evil: Omits imports from
and just picks up your source codenode_modules - :evergreen_tree:
the resolved treecp- Optionally copies the resolved import tree to a new directory for analysis or refactoring. The original relative directory structure is retained
- :wrench: Configurable
- Functionality for complicated typescript projects and use cases
About
ts-lineage takes a typescript file, extracts its dependencies via ts-morph, resolves each relative import to a file on the filesystem, then "recursively" performs those steps on the descendant imports until all relative imports are resolved.Installation
npm install lineage-ts
Options
(required): path to the root file)-f, --file <string>
(optional): path to a typescript config-tsc, --tsconfig <string>
(optional): directory to which the resolved dependency tree should be copied to-dir, --destDir <string>
Use cases
- Debugging and performance testing: When analyzing a single element in a large application, it can be useful to extract only the relevant code to remove any potential side effects and complications from the main app.
- Refactoring: When moving an application to a new architecture, it can be cumbersome to manually
over files that relate to the refactor target.cp
Prior Art
node-dependency-tree is a generic tool for analyzing dependencies that works for multiple languages and module types. lineage-ts is exclusively for typescript, uses ts-morph, and has a utility for cp'ing the resolved dependency tree to a new dirHelp
lineage-ts --help