consolex-cli
v1.1.0
Published
A CLI tool to remove console statements from your project
Downloads
41
Maintainers
Readme
Consolex CLI
A TypeScript command-line tool for removing console statements from your project.
Installation
Install from npm
npm install -g consolex-cliInstall from source
git clone <repository-url>
cd consolex-cli
pnpm i
pnpm build
# use
pnpm start options
# e.g
pnpm start --types log,error,warn --path <"your project path"> --extensions ts,tsx --dry-runUsage
Basic Usage
# Remove all types of console statements from current directory
consolex
# Remove only console.log
consolex --types log
# Remove multiple types of console statements
consolex --types log,error,warn
# Specify project path
consolex --path /path/to/your/project
# Preview mode (don't actually modify files)
consolex --dry-run
# Specify file extensions
consolex --extensions js,ts,jsx,tsx
# Exclude specific directories
consolex --exclude node_modules,dist,buildOptions
-t, --types <types>: Console types to remove (comma-separated), removes all types by default-p, --path <path>: Project path, defaults to current directory-e, --extensions <extensions>: File extensions to process (comma-separated), defaults to js,ts,jsx,tsx--dry-run: Preview mode, shows what would be removed without actually modifying files--exclude <patterns>: Directory patterns to exclude (comma-separated), defaults to node_modules,dist,build,.git-u, --update: Check for updates and upgrade to the latest version
Special Notes
- Registry Handling: Update checking and installation functions automatically use the npm official registry (
https://registry.npmjs.org/), unaffected by user's local private registry configuration, ensuring correct version information retrieval.
Supported Console Types
- log
- error
- warn
- info
- debug
- table
- time
- timeEnd
- group
- groupEnd
- clear
- count
- trace
Examples
# Remove only console.log and console.error
consolex --types log,error
# Process TypeScript files in specific directory
consolex --path ./src --extensions ts,tsx
# Preview console statements that would be removed
consolex --dry-run --types log
# Check for updates (automatically uses npm official registry)
consolex --update
# Check for updates without auto-installing
consolex check-updateLicense
MIT
