remove-js-logs is a lightweight CLI tool to automatically remove all console.log
statements from JavaScript and TypeScript files in your project.
Perfect for cleaning up your codebase before production deployment.
You can run this tool as globaly:
npm install -g remove-js-logs
Pass specific path and run this:
remove-logs [path]
For examples:
remove-js-logs . # Remove logs from all files recursively
remove-js-logs ./src # Clean a specific folder
You can also specify which console methods to remove by passing them as a comma-separated list:
npx remove-js-logs . info,log # Remove console.info() and console.log() calls
npx remove-js-logs . all # Remove all console methods (log, warn, error, etc.)
- ✅ Removes specific console methods (by default removes
console.log()
) - ✅ Supports
.js
,.ts
,.jsx
, and.tsx
files - ✅ Recursive directory scan
- ✅ Ignores node_modules, .git, dist, build, etc.
- ✅ Fast, clean CLI with colored output and loading indicators
By default, only console.log()
calls will be removed:
console.log("Debug info");
console.log(user);
If specified, the following methods will also be removed:
console.warn("Warning!");
console.error("An error occurred");
console.info("Information");
To run and test locally:
git clone https://github.com/nafasebra/remove-js-logs.git
cd remove-js-logs
npm install
npm link
This allows you to use it globally during development:
remove-js-logs .
To unlink:
npm unlink
Feel free to open issues or submit pull requests. Suggestions and contributions are always welcome!
MIT © Nafas Ebrahimi