A CLI tool that automatically cleans up .next cache folders in Next.js projects.
- Automatic detection of old
.nextcache folders across your system - Identifies cache folders based on last modification date (default: 14 days)
- Validates genuine Next.js projects (package.json verification)
- Supports Dry Run mode
- Detailed logging functionality
git clone https://github.com/code-xhyun/next-cache-cleaner.git
cd next-cache-cleaner
Basic usage:
node next-cleaner.jsSpecify target paths:
node next-cleaner.js --path /path/to/projectsDry Run mode (preview without actual deletion):
node next-cleaner.js --dry-run--path,-p: Specify search paths (multiple paths allowed)--dry-run: Run in preview mode without actual deletion--help,-h: Display help information
You can modify the following settings in the CONFIG object within next-cleaner.js:
MIN_DAYS: Minimum age of cache folders to delete (default: 14 days)LOG_FILE: Log file nameEXCLUDED_DIRS: List of directories to exclude from search
- Always review the list of folders to be deleted before execution
- For critical projects, it's recommended to test first using the
--dry-runoption - Non-Next.js projects (those without package.json) are automatically skipped
All operations are recorded in the next-cleaner.log file.
MIT
Issues and PRs are always welcome. Before contributing, please:
- Create an issue first
- Write test code
- Update documentation