assets-tracker
v1.0.2
Published
A modern, high-performance CLI tool to identify and remove unused assets in your codebase. Automatically scan for unreferenced images, fonts, and media files to optimize your project size.
Downloads
47
Readme
🚀 Assets Tracker
The ultimate unused assets detector for React, React Native, Web, and Mobile apps.
assets-tracker is a modern, high-performance CLI tool designed to identify and remove unreferenced assets from your project. Whether you're building a React Web App, a React Native Mobile App (iOS/Android), or an Expo project, this tool helps you keep your repository lean and efficient.
✨ Features
- ⚛️ React & React Native Optimized: Built-in support for common patterns in modern frontend and mobile frameworks.
- 📱 Cross-Platform: perfect for Web, Mobile (iOS/Android), and Desktop applications.
- 🔍 Deep Scan: Identifies unused images, videos, fonts, and more across your entire project.
- 🛠️ Smart Analysis: Scans your source files (JS, TS, JSX, TSX, HTML, CSS, etc.) to detect asset references.
- 🏢 Modern CLI: Beautiful, interactive terminal interface with progress indicators and formatted reports.
- 🧹 Interactive Cleanup: Choose to delete all unused assets at once or select specific files to remove safely.
- ⚙️ Fully Configurable: Customize extensions and ignore patterns via
.assettracker.json.
🚀 Installation
Install it as a dev dependency in your project:
npm install --save-dev assets-tracker
# or
yarn add -D assets-tracker
# or
pnpm add -D assets-tracker📖 Usage
🔍 Scan for Unused Assets
Run a full scan to see what can be removed:
npx assets-tracker scan🧹 Clean Up Unused Assets
Start an interactive session to select and delete unused files:
npx assets-tracker clean⚙️ Configuration
Create a .assettracker.json in your project root to customize the behavior:
{
"assetExtensions": ["png", "jpg", "svg", "webp", "gif"],
"sourceExtensions": ["js", "jsx", "ts", "tsx", "html", "css"],
"ignorePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/.expo/**",
"**/ios/build/**",
"**/android/app/build/**"
]
}Options
| Option | Description | Default |
| :--- | :--- | :--- |
| assetExtensions | Array of file extensions to treat as assets. | ["png", "jpg", ...] |
| sourceExtensions | Array of file extensions to scan for references. | ["js", "ts", "jsx", "tsx", ...] |
| ignorePatterns | Glob patterns of directories/files to ignore. | ["node_modules", "dist", ...] |
📂 Supported Asset Types
- Images:
.png,.jpg,.jpeg,.gif,.svg,.webp,.ico - Video/Audio:
.mp4,.webm,.ogg,.mp3,.wav,.flac,.aac - Fonts:
.woff,.woff2,.eot,.ttf,.otf
🧠 How It Works
- Discovery: The tool builds a list of all asset files in your project (excluding ignored paths).
- Analysis: It parses your source code files (including JSX/TSX) to search for any mention of the asset's filename or relative path.
- Reporting: Assets that aren't mentioned anywhere are marked as "unused".
- Action: You get a detailed report and the interactive option to delete them safely.
👥 Authors
- Dheeraj & Vaibhav
🤝 Contributors
Feel free to check the issues page.
📄 License
This project is MIT licensed.
