Skip to content

swapnilmishra/import-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

What it is

It is a cli tool to figure out the usage of any specific import in your source files

  • Supports glob patterns for searching in files.
  • Supports scoping the import search. See --scope argument
  • Supports ignoring directories while searching
  • Supports 3 output report formats - table(default), csv, json

Installing

yarn add import-usage

or

npm install import-usage

How to use

import-usage -h

Options:
  --filepath      File or directory path or glob pattern     [string] [required]
  --components    Comma separated component names            [string] [required]
  --ignore        Directories to ignore i.e node_modules
                                        [string] [default: "**/node_modules/**"]
  --reportformat  stdout format of data
                   [string] [choices: "table", "csv", "json"] [default: "table"]
  --scope         If defined, components only from this package will be searched
                                                                        [string]

Using in package.json

yarn add import-usage

or

npm install import-usage

In your package.json

{ 
  "scripts" : {
    "show-component-usage" : "import-usage --filepath='src/**/*.js' --components='Button,Input' --ignore='**/node_modules/**' --reportformat='csv' --scope='@scoped-package/ui'
  }
}

From CLI

yarn global add import-usage

or

npm -g install import-usage

then from terminal

import-usage --filepath='src/**/*.js' --components='Button,Input' --ignore='**/node_modules/**' --reportformat='csv' --scope='@scoped-package/ui'

Output

image

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published