0.0.0 • Published 4 years ago

@fforres/cia v0.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

Codebase import analyzer

Why

I wanted to structure a tool to analyze different codebases I'm currently working on. :)

We've all been there: Tou are working in a biiig react codebase. You also have a folder for multiple 'Button' components, under src/some-folder/components/buttons.tsx. One day, your team starts creating a new set of Buttons under src/design-system/buttons/index.tsx, your old buttons folder starts to slowly fade away into oblivion, and into the dreaded "legacy-code" folders.

So, I wanted to create a way to analyze your codebase to figure out:

  • where are specific modules are still being imported.
  • what things every file is importing.

The long-term idea for this:

  • To track this information repeatedly (run on CI for every prod build?)
  • Create data visualizations based on that data.
  • Figure out usage of modules:
    • Folders still in use
    • Usage of legacy modules
    • Track advances towards module deprecation/migrations

How

We are using "@babel/core" that runs with the current project babel configuration to extract the AST for every file, and do some analisys in them.

API

optiondescriptionrequireddefault values
-d, --directoryDirectory to analyze-----
-o, --outputPath to output analysis file./db
-a, --allowedExtensionsComma separated list of extensions to allow certain file extensions.js,.ts,.tsx,.jsx
-i, --ignoreComma separated list of glob patterns to ignore''