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

next-prune

v1.8.0

Published

Interactive Clack CLI to prune Next.js build artifacts and caches to free disk space

Readme

Next Prune 🧹

Prune Next.js build artifacts and caches from your terminal. Interactive Clack prompts to scan and delete .next, out, .vercel/output, .turbo, workspace node_modules, and package-manager caches to free disk space.

npm version CI License: MIT Bun Version

What Gets Pruned

Safe to delete (recreated by tools):

  • .next/ - Next.js build output and cache
  • distDir output configured in next.config.* (for example build/ or dist/)
  • 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
  • Project and workspace node_modules/ directories
  • Package-manager caches (.npm, .pnpm-store, .yarn/cache, .yarn/unplugged, .bun/install/cache)

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:

  • 🎯 New: Clack-powered interactive workflow
  • 🔍 Scans recursively for Next.js, Vercel, and Turborepo build artifacts
  • 🧭 Detects custom Next.js build output via distDir in next.config.* (including Next.js 16 projects)
  • 📊 Shows disk usage for each directory found
  • 🧭 Guided profile picker (safe, deps-only, cold-storage, custom)
  • 🎛️ Scope and path-filter prompts before candidate selection
  • ⇅ Sort candidates by size, age, or path before selection
  • 🧾 Interactive multi-select with candidate metadata hints
  • ✅ Select multiple directories for batch deletion
  • 🚀 Non-interactive modes for scripting (--list, --json)
  • 🧱 Monorepo/workspace cleanup controls (--monorepo, --cleanup-scope, --workspace-detect)
  • 🛡️ Safe deletion with confirmation prompts

Install

$ bun add --global next-prune

Quick Start

# Scan and interactively select what to delete
$ bunx next-prune

# One-shot cleanup of safe artifacts only (no --apply needed)
$ bunx next-prune --yes --cleanup-scope=safe

# Non-interactive listing
$ bunx next-prune --list

$ bunx next-prune --json

# Include node_modules / PM caches in non-interactive cleanup
$ bunx next-prune --yes --apply

# Aggressive cold-storage cleanup (artifacts + node_modules + PM caches + workspace)
$ bunx next-prune --yes --apply --cold-storage

# Workspace-only scan in a monorepo
$ bunx next-prune --json --cleanup-scope=workspace --monorepo

CLI

$ 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)
    --cold-storage
                  Aggressive slim mode for archival/cold-storage cleanup
    --monorepo    Scan as a monorepo/workspace root
    --cleanup-scope=<scope>
                  Cleanup scope (e.g. all, cold-storage, safe, node-modules, pm-caches)
    --no-node-modules
                  Exclude node_modules candidates
    --no-pm-caches
                  Exclude package-manager cache candidates
    --workspace-detect
                  Enable workspace auto-detection
    --max-depth=<n>
                  Maximum scan depth
    --apply       Required with --yes to delete node_modules/pm-caches

  Examples
    $ next-prune
    $ next-prune --dry-run
    $ next-prune --list --cleanup-scope=safe
    $ next-prune --json --cleanup-scope=workspace --monorepo
    $ next-prune --yes --cleanup-scope=safe
    $ next-prune --yes --apply --cold-storage
    $ next-prune --yes --apply --cleanup-scope=node-modules,pm-caches

One-Shot Cleanup

For quick cleanup without interaction:

# Safe artifacts only (won't touch node_modules or PM caches)
$ next-prune --yes --cleanup-scope=safe

# Include node_modules / PM caches (explicit opt-in required)
$ next-prune --yes --apply

# Purpose-built cold-storage mode (includes monorepo workspace scan)
$ next-prune --yes --apply --cold-storage

--yes without --apply will refuse deletion if the selected candidates include node_modules or package-manager caches.

Pilotty Smoke Test

If you have pilotty installed, run the end-to-end TUI smoke test:

bun run test:pilotty

What it validates:

  • Clack interactive flow launches in a real PTY session
  • sort prompt and candidate multiselect render correctly
  • confirmation and deletion prompts execute in sequence
  • confirmed deletion actually removes an artifact directory

Contributing

See CONTRIBUTING.md. By participating, you agree to our CODE_OF_CONDUCT.md.

License

MIT © next-prune contributors