A tool to remove all console.log statements from your project
npm install remove-logsconsole.log statements. This tool processes JavaScript, TypeScript, JSX, and TSX files while ignoring the node_modules folder.
npx without needing to install it globally.
bash
npx remove-logs [directory]
`
Options:
[dir]: The directory to process. If not specified, the current directory (.) will be used.
Example:
`bash
npx remove-logs ./src
`
This will remove all console.log statements from the src directory and its
subdirectories.
How It Works
The tool performs the following actions:
- Traverse Files: Recursively traverses through the provided directory and finds all JavaScript (.js), TypeScript (.ts), JSX (.jsx), and TSX (.tsx) files.
- Ignore node_modules: Automatically ignores the node_modules folder.
- Remove console.log: Finds and removes all console.log statements from the files.
- Update Files: Saves the updated content back to the original files.
Example
$3
`javascript
console.log("This is a log");
function test() {
console.log("Another log");
}
`
$3
`javascript
function test() {
}
``