Coder Social home page Coder Social logo

js-ts-import-analyzer's Introduction

Import checker

JS|TS import statement report generator

Why

This project was created to automate the analyzis of which component from @blendle/lego (react component library) is been used in all 4 web projects. With the all imports, an csv file is generated containing:

<file-path>;<component-name>;<project-name>

Later this data is used in a Google Sheets which shows us visually what's the most and less used component within the library.

What's behind

In order to make this analyses, it uses:

  • Typescript (just because it's nice to have types :p)
  • nodeJS file system;
  • @babel/parser: to create an Abstract Syntax Tree object and understand what's an import;
  • glob: to get the absolute path of all desired files

Workflow

It's a very simple workflow, where:

  1. It's defined the absolute path of each project;
  2. With that, it runs glob and get it back all files;
  3. Each file is read by node fs and has its content analyzed babel parser;
  4. It walks through the AST and filters only Statements type of import and which it's from @blendle/lego;
  5. With the component name and file path, it creates a CSV record previously described;
  6. With all CSV records, it generates the report file;

How to run

First, clone this project.

Then, install the dependencies:

yarn

Then, run report command:

yarn report

A file report.csv will be created in the root folder with all data analized.

js-ts-import-analyzer's People

Contributors

raulfdm avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.