Socket
Socket
Sign inDemoInstall

file-dependency-analyzer

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    file-dependency-analyzer

Tool used to analyze and cleanup unused files


Version published
Weekly downloads
2
decreased by-90.91%
Maintainers
1
Install size
54.5 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 01 Mar 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc