next-sweep
v1.0.3
Published
A CLI tool to find and delete .next folders recursively
Maintainers
Readme
next-sweep
A CLI tool to find and delete .next folders recursively, similar to npkill but specifically for Next.js build directories.
Installation
Install globally using npm or pnpm:
# Using npm
npm install -g next-sweep
# Using pnpm
pnpm add -g next-sweep
# Using yarn
yarn global add next-sweepOr run it directly with npx without installing:
npx next-sweepUsage
Once installed, navigate to any directory and run:
next-sweepThe tool will:
- Scan the current directory recursively for
.nextfolders - Show you a list of found folders with their sizes
- Let you select which ones to delete (interactive checkbox interface)
- Delete the selected folders and show how much space was reclaimed
Example
cd ~/my-projects
next-sweepOutput:
🧹 Next.js Cleaner
Found 3 folders. Potential space to reclaim: 245.3 MB
? Select folders to delete (Space to select, Enter to confirm):
◯ project1/.next 125.4 MB
◯ project2/.next 89.2 MB
◯ project3/.next 30.7 MB
✔ Cleanup complete!
🎉 Reclaimed space: 245.3 MBFeatures
- 🔍 Recursively finds all
.nextfolders - 📊 Shows folder sizes in human-readable format
- ✅ Interactive selection (checkbox interface)
- 🚫 Automatically ignores
node_modules,.git,.vscode,dist, andbuilddirectories - 🎨 Beautiful CLI interface with colors and spinners
- ⚡ Fast and efficient scanning
How It Works
next-sweep scans your current directory and all subdirectories (excluding ignored folders) to find .next build directories. It then presents an interactive list where you can select which folders to delete, helping you reclaim disk space from unused Next.js build artifacts.
Development
If you want to contribute or run the development version:
# Clone the repository
git clone https://github.com/ProgrammerAditya36/next-sweep.git
cd next-sweep
# Install dependencies
pnpm install
# Run locally
pnpm start
# or
node index.jsLocal Development Setup
For local development and testing, you can link the package:
# Using pnpm
pnpm link --global
# Using npm
npm linkThen use next-sweep from any directory. To unlink:
# Using pnpm
pnpm unlink --global
# Using npm
npm unlink -g next-sweepLicense
MIT © 2025 next-sweep contributors
