🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

file-dependency-analyzer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-dependency-analyzer

Tool used to analyze and cleanup unused files

1.0.4
latest
Source
npm
Version published
Weekly downloads
2
-75%
Maintainers
1
Weekly downloads
 
Created
Source

File dependency analyzer

Maintaining a project is not easy, especially large ones. To help, this tool is used to detect and optionally cleanup not dependent files.

You can analyze and cleanup any files you want (svg, js, etc). Just provide configuration and you are ready to go. Tool is fully customizable, you can specify folders you want to analyze files in, or exclude folders from analyzing.

Installation

 npm install -D file-dependency-analyzer

Usage

To run a script you need npx (npm is not currently supported)

// package.json

"scripts": {
  "analyze": npx file-dependency-analyzer ./path-to-config-file.json
}

Config

Default ignore patterns (analyzing will be excluded in below folders)

[
    'node_modules',
    'git',
    'vscode',
    'idea',
    'package.json',
    'package-lock.json',
    'README.md',
    'dist',
]

You can add specific globalIgnorePatterns in config

PropertyTypeDefaultDescription
globalIgnorePatternsArray[]List of all folders/paths you want exclude from analyzing
extensionsObject{}Object of extensions with specific configuration

Extensions

Is a key value object with specific configuration

PropertyTypeDefaultDescription
analyzeFromArray[]List of folders where files to analyze are located
analyzeInArray[]List of folders you want to analyze files
ignorePatternsArray[]List of folders you exclude from analyzing
modeStringanalyzeanalyze or cleanup (analyze and remove unused files)

If analyzeFrom, analyzeIn are empty or not defined, files will be analyzed for all project files.

Config example

{
  "globalIgnorePatterns": [".docker-cache"],
  "extensions": {
    "svg": {
      "analyzeFrom": [], <- it will search for all svg files throughout the project
      "analyzeIn": ["/components"],
      "ignorePatterns": ["/configs"],
      "mode": "cleanup",
    },
    "js": {
      "analyzeFrom": ["/configs", "/assets"],
      "analyzeIn": [], <- files will be analyzed throughout the project
      "ignorePatterns": [],
      "mode": "analyze"
    }
  }
}

License

Copyright (c) 2022 Rafal Poreba. Licensed under the MIT license.

Keywords

svg

FAQs

Package last updated on 01 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts