next-prune
Version:
Interactive terminal UI to prune Next.js build artifacts and caches to free disk space
97 lines (68 loc) โข 2.91 kB
Markdown
# Next Prune ๐งน
> Prune Next.js build artifacts and caches from your terminal. Interactive TUI to scan and delete `.next`, `out`, `.vercel/output`, `.turbo`, and other safe-to-delete directories to free disk space.
[](https://www.npmjs.com/package/next-prune)
[](https://github.com/khoa-lucents/next-prune/actions/workflows/ci.yml)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
## What Gets Pruned
**Safe to delete (recreated by tools):**
- `.next/` - Next.js build output and cache
- `out/` - Next.js static export output
- `.vercel/output/` - Vercel Build Output API bundle
- `.turbo/` - Turborepo cache (default at `.turbo/cache`)
- `.vercel_build_output/` - Legacy Vercel build output
- `node_modules/.cache/next` - Next.js cache in node_modules
**Always preserved:**
- `.vercel/project.json` - Keeps local folder linked to Vercel project
- `vercel.json` - Vercel project configuration
- `next.config.*` - Next.js configuration
- All source code and project files
**Features:**
- ๐ฏ Interactive terminal UI built with [Ink](https://github.com/vadimdemedes/ink)
- ๐ Scans recursively for Next.js, Vercel, and Turborepo build artifacts
- ๐ Shows disk usage for each directory found
- โ
Select multiple directories for batch deletion
- ๐ Non-interactive modes for scripting (`--list`, `--json`)
- ๐ก๏ธ Safe deletion with confirmation prompts
## Install
```bash
$ npm install --global next-prune
```
## Quick Start
```bash
# Scan and interactively select what to delete
$ npx next-prune
# One-shot cleanup (no prompts)
$ npx next-prune --yes
# Non-interactive listing
$ npx next-prune --list
$ npx next-prune --json
```
## CLI
```text
$ next-prune --help
Usage
$ next-prune
Options
--yes, -y Skip confirmation and delete selected immediately
--dry-run Don't delete anything; just show results
--cwd=<path> Directory to scan (default: current working dir)
--list Non-interactive list of artifacts and sizes, then exit
--json Output JSON (implies --list)
Examples
$ next-prune # interactive TUI
$ next-prune --dry-run # scan only
$ next-prune --list # list found artifacts
$ next-prune --json # machine-readable output
$ next-prune --yes # one-shot cleanup
```
## One-Shot Cleanup
For quick cleanup without interaction:
```bash
# Equivalent to: rm -rf .next out .vercel/output .turbo
$ next-prune --yes
```
## Contributing
See `CONTRIBUTING.md`. By participating, you agree to our `CODE_OF_CONDUCT.md`.
## License
MIT ยฉ next-prune contributors