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

@jayansh123/clean-logs

v1.0.1

Published

A CLI tool to scan and safely remove console statements from JavaScript and TypeScript projects.

Readme

Clean Logs CLI

A lightweight CLI tool to scan and remove console statements from JavaScript and TypeScript projects.

Features

  • 🔍 Scan your project for console statements
  • 🧹 Remove console statements safely
  • 👀 Preview changes with --dry-run
  • ⚡ Remove all supported console methods with --all
  • 💾 Create a backup before modifying files
  • 📦 Works as a reusable CLI across projects
  • 🚫 Automatically ignores common directories such as node_modules, .git, dist, .next, and build

Installation

Using npx

No installation is required:

npx @jayansh123/clean-logs --help

Global installation

npm install -g @jayansh123/clean-logs

After installation, you can use:

clean-logs --help

Usage

Run the CLI from the root directory of your project.

Scan the project

By default, the tool scans for console.log statements:

clean-logs

The tool will show the detected console statements and ask for confirmation before removing them.

Dry Run

To scan the project without modifying any files:

clean-logs --dry-run

This is useful when you want to see what will be removed before making any changes.

Remove All Supported Console Methods

To remove all supported console methods:

clean-logs --all

Dry Run with All Methods

To preview the removal of all supported console methods:

clean-logs --all --dry-run

Skip Confirmation

To remove the detected console statements without the confirmation prompt:

clean-logs --yes

For all supported methods:

clean-logs --all --yes

Supported Console Methods

The CLI supports the following console methods:

  • console.log
  • console.warn
  • console.error
  • console.info
  • console.debug

By default, only console.log is removed.

Use --all to remove all supported methods.

Backup

Before modifying a file, Clean Logs creates a backup containing the console statements that are going to be removed.

For example:

src/example.ts
src/example.ts.clean-logs-backup

The backup contains only the console statements removed during that operation, rather than the entire source file.

If the backup already exists, it is replaced with the latest backup.

Ignored Directories

Clean Logs automatically skips these directories:

node_modules
.git
.next
dist
build
coverage
out

This prevents dependencies, generated files, and build output from being modified.

Examples

Preview console.log removal

npx @jayansh123/clean-logs --dry-run

Remove console.log

npx @jayansh123/clean-logs

Remove all supported console methods

npx @jayansh123/clean-logs --all

Remove all methods without confirmation

npx @jayansh123/clean-logs --all --yes

Help

To see all available options:

npx @jayansh123/clean-logs --help

Options

| Option | Description | | -------------- | ------------------------------------ | | --all | Remove all supported console methods | | --dry-run | Scan only without modifying files | | --yes | Skip the confirmation prompt | | --help, -h | Show help information | | --version | Show the current version |

Supported File Types

Clean Logs scans:

  • .ts
  • .tsx
  • .js
  • .jsx

Requirements

  • Node.js
  • npm

Package

npm: @jayansh123/clean-logs

License

MIT