npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

node-janitor

v1.2.1

Published

๐Ÿงน Smart CLI tool to clean up node_modules folders - free up disk space automatically

Downloads

505

Readme

๐Ÿงน Node-Janitor

Smart CLI tool to clean up node_modules folders - free up disk space automatically

npm version CI License: MIT

โœจ Features

  • ๐Ÿ” Smart Scanner - Find all node_modules in your system
  • โฐ Time-based Cleanup - Delete folders older than X days
  • ๐Ÿงผ Deep Clean - Remove unnecessary files (docs, tests, source maps)
  • ๐Ÿ‘๏ธ Dry Run - Preview before deleting
  • ๐ŸŽฎ Interactive Mode - Step-by-step wizard
  • ๐Ÿ’พ Backup - Save list before deletion
  • ๐Ÿ“Š Reports - Detailed analytics
  • โšก Fast Mode - Native OS commands for speed
  • ๐Ÿ”„ CI/CD Ready - Silent mode with JSON output
  • โš™๏ธ Config File - Persistent settings with .janitorrc
  • ๐Ÿ”€ Git-aware - Skip repos with uncommitted changes
  • ๐ŸŒ Multi-language - 8 languages supported
  • ๐Ÿ‘€ Watch Mode - Continuous monitoring
  • ๐Ÿ“… Scheduled Cleanup - Cron-style automation

๐Ÿ“ฆ Installation

# Global installation
npm install -g node-janitor

# Or use with npx
npx node-janitor

๐Ÿš€ Quick Start

# Scan current directory
node-janitor

# Scan specific path
node-janitor --path ~/projects

# Preview what would be deleted (dry run)
node-janitor --path ~/projects --dry-run

# Delete folders older than 30 days
node-janitor --older-than 30d

# Interactive mode
node-janitor --interactive

๐Ÿ–ฅ๏ธ Interactive TUI Mode (NEW!)

Launch a full-screen, keyboard-navigable interface similar to npkill:

# Start TUI mode
node-janitor --live

# Or use the tui subcommand
node-janitor tui --path ~/projects

Features:

  • โŒจ๏ธ Keyboard Navigation - Use arrow keys or j/k to navigate
  • โ˜‘๏ธ Multi-select - Press SPACE to select/deselect folders
  • ๐Ÿ”„ Sort toggle - Press S to switch between size/age sorting
  • ๐ŸŽจ Color-coded - Green (new), Yellow (medium), Red (old)
  • ๐Ÿ—‘๏ธ Quick delete - Press D to delete selected folders
  • ๐Ÿ“Š Real-time stats - See total size and selection count
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ๐Ÿงน NODE JANITOR - Interactive Mode                               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ“Š Found: 15 folders | Total: 2.5 GB | Selected: 3 (523 MB)     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  > โ–  ~/projects/old-app/node_modules          523 MB    180 days โ”‚
โ”‚    โ–ก ~/projects/test-project/node_modules     312 MB     95 days โ”‚
โ”‚    โ–  ~/projects/archived/node_modules         245 MB     45 days โ”‚
โ”‚    โ–ก ~/projects/client-work/node_modules      198 MB     30 days โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  [โ†‘/โ†“] Navigate  [SPACE] Select  [A] All  [S] Sort  [D] Delete   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“– Usage

Basic Commands

# Scan and show all node_modules
node-janitor --path ~/projects

# Limit scan depth
node-janitor --path ~/projects --depth 3

# Quick scan (skip size calculation)
node-janitor --path ~/projects --quick

Time-based Cleanup

# Delete folders older than 30 days
node-janitor --older-than 30d

# Delete folders older than 3 months
node-janitor --older-than 3m

# Delete folders between 30-90 days old
node-janitor --between 30d-90d

Size Filters

# Only delete folders larger than 500MB
node-janitor --min-size 500MB

# Only delete folders smaller than 10MB
node-janitor --max-size 10MB

Deep Clean Mode

Remove unnecessary files from node_modules without deleting the entire folder:

node-janitor --deep-clean

Files removed:

  • Documentation: *.md, LICENSE, CHANGELOG, docs/
  • Tests: test/, tests/, __tests__/, spec/
  • Source maps: *.map
  • Examples: example/, examples/
  • Config files: .eslintrc, .prettierrc, etc.

Safe Mode

# Preview without deleting
node-janitor --dry-run

# Create backup before deletion
node-janitor --backup

# Only delete if lockfile exists
node-janitor --lock-check

Performance

# Use native OS commands (faster)
node-janitor --fast

# Parallel deletion
node-janitor --parallel 4

Reports

# Generate report
node-janitor report

# Detailed report
node-janitor report --detailed

# JSON output
node-janitor report --json

CI/CD Integration

# Silent mode (no prompts, no colors)
node-janitor --silent --older-than 30d

# JSON output for automation
node-janitor --json

Exclude Patterns

# Exclude specific folders
node-janitor --exclude "important-project,client-work"

# Include only matching patterns (whitelist)
node-janitor --include "work-*,client-*"

Git-aware Cleanup

# Skip repos with uncommitted changes
node-janitor --skip-dirty-git

# Only process folders inside git repos
node-janitor --git-only

Config File

Create .janitorrc in your home directory or project:

{
  "exclude": ["important-project"],
  "defaultOlderThan": "30d",
  "defaultPath": "~/projects",
  "lang": "vi"
}

Use custom config:

node-janitor --config ~/.my-janitor-config.json

Multi-language Support

# Vietnamese
node-janitor --lang vi

# Chinese
node-janitor --lang zh

# Japanese  
node-janitor --lang ja

# Available: en, vi, zh, ja, ko, es, fr, de

Watch Mode

Continuously monitor and clean:

# Watch with 60s interval
node-janitor watch --interval 60 --older-than 30d

# Auto-clean when found
node-janitor watch --auto-clean --older-than 60d

Scheduled Cleanup

Cron-style scheduling:

# Daily cleanup at midnight
node-janitor schedule --daily --older-than 30d

# Weekly on Sunday
node-janitor schedule --weekly

# Custom cron expression
node-janitor schedule --cron "0 0 * * *" --older-than 60d

๐Ÿ“‹ All Options

| Option | Description | |--------|-------------| | -p, --path <path> | Directory to scan (default: current) | | -d, --depth <n> | Maximum scan depth | | --older-than <duration> | Only process folders older than (30d, 3m, 1y) | | --between <range> | Age range (30d-90d) | | --min-size <size> | Minimum folder size (500MB) | | --max-size <size> | Maximum folder size (10MB) | | --dry-run | Preview only | | --deep-clean | Remove unnecessary files | | --fast | Use native OS commands | | --parallel <n> | Number of parallel deletions | | --backup | Create backup before deletion | | --lock-check | Only delete if lockfile exists | | --quick | Skip size calculation | | -i, --interactive | Interactive mode | | -v, --verbose | Verbose output | | --debug | Debug mode | | --silent | Silent mode (CI/CD) | | --json | JSON output | | --exclude <patterns> | Exclude patterns (comma-separated) | | --include <patterns> | Include only matching patterns | | -c, --config <path> | Config file path | | --skip-dirty-git | Skip repos with uncommitted changes | | --git-only | Only process git repos | | --lang <code> | Language (en, vi, zh, ja, ko, es, fr, de) |

๐ŸŽฏ Examples

Clean old projects

# Find and delete node_modules older than 90 days
node-janitor --path ~/projects --older-than 90d

Deep clean to save space

# Remove docs, tests, source maps from all node_modules
node-janitor --path ~/projects --deep-clean

CI/CD cleanup

# Automated cleanup in CI
node-janitor --silent --older-than 60d --json

Cautious cleanup

# Preview first
node-janitor --path ~/projects --older-than 30d --dry-run

# Then execute with backup
node-janitor --path ~/projects --older-than 30d --backup

๐Ÿ“Š Sample Output

๐Ÿงน NODE JANITOR

โœ” Found 15 node_modules folders

โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ #   โ”‚ Path                         โ”‚ Size     โ”‚ Age   โ”‚ Packages โ”‚ Lock โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1   โ”‚ ~/projects/old-app           โ”‚ 523 MB   โ”‚ 180d  โ”‚ 1,234    โ”‚ npm  โ”‚
โ”‚ 2   โ”‚ ~/projects/test-project      โ”‚ 312 MB   โ”‚ 95d   โ”‚ 567      โ”‚ yarn โ”‚
โ”‚ 3   โ”‚ ~/projects/archived          โ”‚ 245 MB   โ”‚ 45d   โ”‚ 890      โ”‚ npm  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Total Folders โ”‚ 15       โ”‚
โ”‚ Total Size    โ”‚ 2.5 GB   โ”‚
โ”‚ Oldest        โ”‚ 180 days โ”‚
โ”‚ Newest        โ”‚ 5 days   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Development

# Clone repository
git clone https://github.com/patchybean/node-janitor.git
cd node-janitor

# Install dependencies
npm install

# Build
npm run build

# Run locally
node dist/index.js --help

๐Ÿ“„ License

MIT ยฉ Patchy Bean


Made with โค๏ธ for developers who hate bloated disk space