Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Generate usage reports of your JS dependencies

Notifications You must be signed in to change notification settings

sailthru/dependency-report

 
 

Repository files navigation

NOTE: Repo has been ARCHIVED!!!

This was a POC that was created as part of the Hackdays 2022.

dependency-report

Generate usage reports for JavaScript dependencies through an AST.

Note: only supports ES2015 import statements (not CommonJS require calls).

Install

yarn add @sailthru/dependency-report
# or
npm install @sailthru/dependency-report

CLI Usage

Input

$ dependency-report './client/**/*.js' --packages=evergreen-ui --exports=SideSheet

Results

[
  [
    {
      "name": "SideSheet",
      "files": 6,
      "filepaths": [
        "./client/components/Customers/Audiences/Audience/Overview/RunOverview/index.js",
        "./client/components/Customers/Destinations/View.js",
        "./client/components/Customers/DestinationSettings.js",
        "./client/components/Destinations/DestinationErrors/ErrorSheet.js",
        "./client/components/WorkspaceSettingsV2/DeletionRequests/RegulationSheet.js",
        "./client/containers/Navigation/UserDropdownApp.js"
      ]
    }
  ]
]

input

$ dependency-report './client/**/*.js' --packages=evergreen-ui --exports=SideSheet,Popover,CornerDialog,RadioGroup

Results

[
  [
    {
      "name": "SideSheet",
      "files": 6,
      "filepaths": [
        "./client/components/Customers/Audiences/Audience/Overview/RunOverview/index.js",
        "./client/components/Customers/Destinations/View.js",
        "./client/components/Customers/DestinationSettings.js",
        "./client/components/Destinations/DestinationErrors/ErrorSheet.js",
        "./client/components/WorkspaceSettingsV2/DeletionRequests/RegulationSheet.js",
        "./client/containers/Navigation/UserDropdownApp.js"
      ]
    },
    {
      "name": "Popover",
      "files": 2,
      "filepaths": [
        "./client/components/WorkspaceSettingsV2/SuppressedUsers/RemoveButton.js",
        "./client/containers/Navigation/UserDropdownApp.js"
      ]
    },
    {
      "name": "CornerDialog",
      "files": 4,
      "filepaths": [
        "./client/components/GDPRNotification.js",
        "./client/components/NewAgreementNotification.js",
        "./client/components/Sources/SourceDebugger/TestConnectionNotice.js",
        "./client/containers/Sources/SourceSchema/DataGovernanceFeedbackApp.js"
      ]
    },
    {
      "name": "RadioGroup",
      "files": 0,
      "filepaths": []
    }
  ]
]

Usage

const DependencyReport = require('@segment/dependency-report')

const report = new DependencyReport({
  files: '**/*.js'
})

About

Generate usage reports of your JS dependencies

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%