remove-console-logss
v1.0.3
Published
CLI tool that removes all console.log, console.error, console.warn from JS/TS files in a folder.
Maintainers
Readme
Remove Console Logs 🧹⚡
A zero-dependency Node.js CLI tool that cleans all console.* statements from your JavaScript/TypeScript files. Perfect for preparing production code!
Features ✨
- Removes all
consolemethods (log,error,warn,info, etc.) - Supports JS, TS, JSX, and TSX files
- Preserves source formatting
- Dry run mode for safe preview
- Ignore specific files/folders
- Option to comment out instead of removing
Installation 📦
Use npx:
npx remove-console-logss@latestOr install globally:
npm install -g remove-console-logssUsage 🛠️
# Basic usage (process current directory)
remove-console-logss
# Target specific directory
remove-console-logss ./src
# Dry run (preview changes without modifying files)
remove-console-logss --dry-run
# Ignore specific paths
remove-console-logss --ignore "**/test/**,**/mocks/**"
# Comment out instead of removing
remove-console-logss --preserveOptions 🔧
| Option | Description |
| ------------ | --------------------------------------- |
| --dry-run | Preview changes without modifying files |
| --ignore | Comma-separated ignore patterns |
| --preserve | Comment out instead of removing |
| --help | Show help |
| --version | Show version number |
Examples 📝
Before:
// app.js
console.log('Debugging');
console.error('Error occurred');After:
// app.js
/* Production clean! */With --preserve flag:
// app.js
/* console.log('Debugging') */
/* console.error('Error occurred') */FAQ ❓
Q: Is this safe to use? A: Yes! For extra safety:
- Use
--dry-runfirst - Commit your code before running
- Consider using
--preserveflag
Q: What console methods are removed?
A: All standard methods: log, error, warn, info, debug, table, time, timeEnd, etc.
License 📄
MIT © [Your Name]
Recommended Additions
- 📹 Add a GIF demo under Usage
- 🤝 Include a Contributing section if open source
- ✅ Add GitHub Actions/CI badges if available
Let me know if you want this localized or expanded further!
