No description
Find a file
Ersin KOÇ 6e2ddfb6c0
Merge pull request #1 from ersinkoc/claude/repo-bug-analysis-fixes-015QNcSViR1L39ZMPWWUWfjN
Comprehensive repository bug analysis and fix system
2025-11-18 10:14:15 +02:00
.github Update LICENSE year, enhance README with new features, improve test cases, and add issue templates 2025-08-17 08:48:55 +03:00
scripts init 2025-08-16 17:11:13 +03:00
src fix: comprehensive bug fixes addressing 12 critical issues 2025-11-18 07:53:28 +00:00
test-fixtures init 2025-08-16 17:11:13 +03:00
tests fix: resolve module import bugs and improve error handling 2025-08-18 19:44:29 +03:00
web-ui/public web 2025-08-16 17:32:22 +03:00
.eslintrc.json fix: resolve module import bugs and improve error handling 2025-08-18 19:44:29 +03:00
.gitignore init 2025-08-16 17:11:13 +03:00
.nmcrc.example init 2025-08-16 17:11:13 +03:00
.npmignore init 2025-08-16 17:11:13 +03:00
AUTHORS Update LICENSE year, enhance README with new features, improve test cases, and add issue templates 2025-08-17 08:48:55 +03:00
BUG_FIX_REPORT.md fix: comprehensive bug fixes addressing 12 critical issues 2025-11-18 07:53:28 +00:00
CHANGELOG.md chore: release v1.0.1 with bug fixes and improvements 2025-08-18 19:47:01 +03:00
CONTRIBUTING.md Update LICENSE year, enhance README with new features, improve test cases, and add issue templates 2025-08-17 08:48:55 +03:00
LICENSE Update LICENSE year, enhance README with new features, improve test cases, and add issue templates 2025-08-17 08:48:55 +03:00
package-lock.json tests 2025-08-16 19:23:07 +03:00
package.json chore: release v1.0.1 with bug fixes and improvements 2025-08-18 19:47:01 +03:00
README.md Update LICENSE year, enhance README with new features, improve test cases, and add issue templates 2025-08-17 08:48:55 +03:00
tsconfig.json Refactor imports to remove file extensions and improve consistency 2025-08-17 08:26:55 +03:00
tsconfig.test.json init 2025-08-16 17:11:13 +03:00

@oxog/nmc - Node Modules Cleaner

npm npm downloads Codecov License Dependencies Node GitHub stars

🚀 A zero-dependency, lightning-fast CLI tool for managing node_modules directories

InstallationQuick StartCommandsWeb UIContributing

🎯 Why NMC?

Ever wondered how much disk space your node_modules folders are consuming? NMC helps you:

  • 📊 Visualize disk usage across all your projects
  • 🔍 Find duplicate packages and outdated modules
  • 🧹 Clean unused node_modules with confidence
  • 💾 Save gigabytes of disk space
  • Speed up your development environment

Features

Core Features

  • 🚫 Zero Dependencies - Built entirely with Node.js native APIs
  • 🌍 Cross-Platform - Works seamlessly on Windows, macOS, and Linux
  • Lightning Fast - Parallel scanning with optimized algorithms
  • 🛡️ Safe Operations - Dry-run mode, backup options, validation checks
  • 🎨 Beautiful CLI - Colored output, progress bars, interactive mode
  • 🌐 Web Interface - Modern browser-based UI for visual management

Advanced Features

  • 📈 Smart Analysis - Find duplicates, analyze trends, get insights
  • 🔄 Multiple Strategies - Clean by age, size, or duplicates
  • 📝 Detailed Reports - Export results in JSON, CSV, or HTML
  • 🎯 Precise Filtering - Glob patterns, size thresholds, age limits
  • 🔒 Security First - Path validation, gitignore checks, safe deletion
  • 🌙 Dark Mode - Eye-friendly interface for the web UI

📦 Installation

# Global installation (recommended)
npm install -g @oxog/nmc

# Or using yarn
yarn global add @oxog/nmc

# Or run directly with npx
npx @oxog/nmc scan

🚀 Quick Start

# Scan current directory for node_modules
nmc scan

# Analyze your projects folder
nmc analyze ~/projects

# Clean with interactive selection
nmc clean ~/projects --interactive

# Launch web interface
nmc web --open

📖 Commands

🔍 scan [path]

Find all node_modules directories in the specified path.

nmc scan ~/projects --depth 5 --sort size

Options:

  • --depth <n> - Maximum directory depth (default: 10)
  • --sort <field> - Sort by: size, date, name, packages
  • --limit <n> - Limit number of results
  • --min-size <MB> - Minimum size threshold
  • --exclude <patterns> - Exclude paths (glob patterns)
  • --json - Output as JSON

Example Output:

📦 Found 12 node_modules directories (3.2 GB total)

┌─────┬──────────────────────┬──────────┬──────────┬───────────┐
│ #   │ Project              │ Size     │ Packages │ Modified  │
├─────┼──────────────────────┼──────────┼──────────┼───────────┤
│ 1   │ my-app               │ 523 MB   │ 1,234    │ 2 days    │
│ 2   │ another-project      │ 412 MB   │ 987      │ 1 week    │
└─────┴──────────────────────┴──────────┴──────────┴───────────┘

📊 analyze [path]

Analyze node_modules for duplicates and statistics.

nmc analyze ~/projects --find-duplicates

Options:

  • --find-duplicates - Find duplicate packages
  • --min-size <MB> - Minimum size threshold
  • --max-age <days> - Maximum age in days
  • --show-versions - Show package versions

Example Output:

📊 Analysis Results

Total Size: 3.2 GB
Total Projects: 12
Total Packages: 5,432
Unique Packages: 892

🔄 Top Duplicates:
• react (18.2.0): Found in 8 projects (120 MB total)
• lodash (4.17.21): Found in 6 projects (45 MB total)
• webpack (5.89.0): Found in 5 projects (230 MB total)

💡 Recommendations:
• Consider using pnpm for better deduplication
• 5 projects haven't been used in 30+ days
• Potential space savings: 1.8 GB

🧹 clean [paths...]

Clean specified node_modules directories.

nmc clean ./old-project --backup --dry-run

Options:

  • --dry-run - Preview what would be deleted
  • --backup - Create backup before deletion
  • --force - Skip confirmation prompts
  • --interactive - Interactive selection mode
  • --older-than <days> - Clean if older than X days
  • --larger-than <MB> - Clean if larger than X MB

🌐 web [path]

Launch web interface for visual management.

nmc web --port 3001 --open

Options:

  • --port <n> - Server port (default: 3001)
  • --host <string> - Server host (default: localhost)
  • --open - Open browser automatically
  • --no-color - Disable colored output

🎨 Web Interface

The web UI provides:

  • 📊 Interactive dashboard with charts
  • 🗂️ Project explorer with search
  • 📈 Disk usage visualization
  • 🔄 Real-time updates
  • 🎯 Bulk operations
  • 📱 Responsive design

⚙️ Configuration

Create .nmcrc or nmc.config.json in your home directory:

{
  "defaultPath": "~/projects",
  "maxDepth": 5,
  "excludePaths": ["**/vendor/**", "**/.*"],
  "autoBackup": true,
  "colors": true,
  "interactive": true
}

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/ersinkoc/NodeModulesCleaner.git
cd NodeModulesCleaner

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Build for production
npm run build

Project Structure

NodeModulesCleaner/
├── src/
│   ├── cli/          # CLI components
│   ├── core/         # Core functionality
│   ├── lib/          # Utilities
│   └── types/        # TypeScript types
├── tests/            # Test files
└── web-ui/           # Web interface

📄 License

MIT © Ersin Koç


Made with ❤️

⬆ Back to top