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

codemod-clean

v2.4.3

Published

Monorepo-aware static analysis and codemod engine for JavaScript/TypeScript/Vue. Detect unused code, optimize imports, analyze dependency graphs, and identify architectural hotspots across packages.

Readme

codemod-clean

npm version npm downloads License


⚡ Monorepo-Aware Code Analysis & Codemod Engine

codemod-clean is a static analysis and codemod tool for JavaScript, TypeScript, and Vue that helps you understand, clean, and optimize large codebases and monorepos.

It goes beyond linting by analyzing real dependency relationships across packages, not just file-level rules.


🚀 Why codemod-clean?

Most tools tell you:

  • ❌ You have unused code
  • ❌ You have unused imports

codemod-clean tells you:

  • ✅ @packages/x-axios is used by 4 packages → critical shared dependency
  • ✅ @packages/utils is highly coupled → architecture hotspot
  • ✅ @packages/i18n is unused → safe to remove
  • ✅ Your monorepo dependency graph is not what your folder structure suggests

🔥 Key Insights

  • Identify critical shared packages
  • Detect orphan (unused) packages
  • Reveal architecture coupling hotspots
  • Understand real dependency graph
  • Find risk points in monorepo structure

📊 Example Output

@packages/eslint-config-custom (5)
  used by:
    - @packages/theme
    - @packages/utils
    - @packages/a-axios
    - @packages/a-uploader
    - @packages/a-components

@packages/a-axios (4)
  used by:
    - @application/management
    - @application/approval
    - @packages/api
    - @packages/a-uploader

@packages/utils (3)
  used by:
    - @application/management
    - @application/approval
    - @packages/a-components

🧹 Features

  • 🧹 Console statement detection & cleanup (console.log, console.error, etc.)
  • 🗑️ Unused variable detection (cross-file aware)
  • 📦 Import optimization (ESM / CJS / Vue SFC)
  • 🏷️ Unused class detection
  • 🎯 Full support for JavaScript / TypeScript / Vue

🌳 Monorepo Analysis (Core Feature)

  • Workspace structure visualization
  • Dependency graph analysis (--deps)
  • Shared package analysis (--shared)
  • Package analysis (--package)
  • Orphan package detection
  • Internal vs external dependency mapping

🔍 Safe Execution

  • Dry-run mode by default
  • Safe preview before applying changes
  • CI/CD friendly JSON output
  • Optional auto-fix mode (--fix)

📦 Installation

npm install -g codemod-clean

🚀 Usage

# 1.Analyze project structure (default --tree)
codemod-clean analyze

# 2.Show project json output
codemod-clean analyze --json

# 3.Package analysis
codemod-clean analyze --package

# 4.Dependency graph analysis
codemod-clean analyze --deps

# 5.Shared packages analysis
codemod-clean analyze --shared

# 6.Clean code (dry-run by default)
codemod-clean run ./src

# 7.Apply fixes
codemod-clean run ./src --fix

# 8.JSON output (CI usage)
codemod-clean analyze --json --shared

⚙️ Options

run

| Option | Description | Default | | --------- | --------------------------------- | ------- | | --dry | Preview changes without modifying | true | | --fix | Apply fixes automatically | false | | --json | Output JSON format | false | | --stylish | Human-readable output | true |


analyze

| Option | Description | Default | | --------- | --------------------------- | ------- | | --tree | Show project structure tree | true | | --json | Output JSON format | false | | --package | Package analysis | true | | --deps | Dependency graph analysis | false | | --shared | Shared package analysis | false |


📌 Rules

run

  • --fix and --dry cannot be used together.
  • --json and --stylish cannot be used together.
  • Default behavior: dry + stylish

analyze

  • --tree and --json cannot be used together.
  • --package --shared --deps cannot be used together.
  • Default behavior: tree + package

⚙️ Mental Model

codemod-clean treats your project as a dependency graph, not a folder tree.

Files → symbols → modules → packages → workspace graph

You don’t just clean code — you understand architecture


🧪 Example Use Cases

  • Find safe-to-delete packages in a monorepo
  • Detect architecture coupling issues
  • Identify shared utility hotspots
  • Clean unused code before production release
  • Understand large-scale project structure instantly

📈 Roadmap

  • Cycle dependency detection
  • Impact analysis (--impact)
  • Hot package ranking (--hot)
  • Layer violation detection
  • Migration codemods (API refactors)