0.6.3 โข Published 6 months ago
depsweep v0.6.3
DepSweep ๐งน
Automated dependency cleanup and impact analysis report
Features
Automatically detect and remove unused dependencies
- ๐ Smart Detection: Analyzes your codebase to find unused dependencies.
- ๐ฏ AST-Based Analysis: Uses Abstract Syntax Tree parsing for precise detection.
- ๐ Modern JS/TS Support: Supports the latest JavaScript and TypeScript features.
- ๐ฆ Package Manager Compatibility: Works with npm, yarn, and pnpm.
- ๐ก๏ธ Safe Mode: Prevents accidental removal of specified dependencies.
- ๐๏ธ Monorepo Support: Seamlessly handles projects within monorepos.
- โก Efficient Processing: Utilizes parallel processing for faster analysis.
- ๐งฉ Config File Scanning: Detects dependencies used in configuration files.
- ๐ง Customizable Ignoring: Allows specifying directory patterns to exclude from scanning.
- ๐ง Memory Management: Efficiently manages memory usage during analysis.
- ๐ Impact Reporting: See the impact of removing unused dependencies.
Supports:
- โ ES Modules and CommonJS
- โ TypeScript and JSX
- โ Dynamic Imports
- โ Configuration Files
- โ Workspace Dependencies
- โ Binary File Detection
- โ Monorepos
Usage
Single Run
# Using npx
npx depsweep
# Using yarn
yarn dlx depsweep
# Using pnpm
pnpm dlx depsweep
Install
# Using npm
npm install -g depsweep
# Using yarn
yarn global add depsweep
# Using pnpm
pnpm add -g depsweep
Options
-v, --verbose Display detailed usage information
-a, --aggressive Allow removal of protected dependencies
-s, --safe <deps> Dependencies that will not be removed
-i, --ignore <paths> Patterns to ignore during scanning
-m, --measure-impact Measure unused dependency impact
-d, --dry-run Run without making changes
-n, --no-progress Disable the progress bar
--version Display installed version
-h, --help Display help information
Examples
# Run with verbose output
depsweep --verbose
# Specify dependencies to protect
depsweep --safe react react-dom
# Ignore specific directories or files
depsweep -i "test/**" "scripts/**"
# Preview changes without removing dependencies
depsweep --dry-run
Protected Dependencies
A list of protected dependencies are ignored by default to
prevent accidental removal. Use the -a, --aggressive
flag to override this
protection. Combine with the -s, --safe
flag to enable removal for only some
protected dependencies.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
License
MIT ยฉ chief mikey