https://github.com/basemax/js-logs-remover-rust
js-logs-remover is a command-line utility written in Rust that removes specified console logging methods (e.g., console.log(), console.error()) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.
https://github.com/basemax/js-logs-remover-rust
console-log console-logging console-logs javascript js logs logs-remover regex replace replacer rust
Last synced: about 1 month ago
JSON representation
js-logs-remover is a command-line utility written in Rust that removes specified console logging methods (e.g., console.log(), console.error()) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.
- Host: GitHub
- URL: https://github.com/basemax/js-logs-remover-rust
- Owner: BaseMax
- License: mit
- Created: 2025-04-06T11:11:09.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-06T11:20:19.000Z (about 1 year ago)
- Last Synced: 2025-08-11T02:54:28.779Z (11 months ago)
- Topics: console-log, console-logging, console-logs, javascript, js, logs, logs-remover, regex, replace, replacer, rust
- Language: Rust
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-logs-remover in Rust
`js-logs-remover` is a command-line utility written in Rust that removes specified `console` logging methods (e.g., `console.log()`, `console.error()`) from JavaScript/TypeScript files within a directory. This tool is useful for cleaning up log statements before deploying or publishing code.
## Features
- Removes specified `console` methods from JavaScript, TypeScript, JSX, and TSX files.
- Processes files recursively within directories, excluding certain common directories such as `node_modules`, `.git`, `dist`, and `build`.
- Supports both specified log methods and a global "all" option to remove all defined `console` methods.
## Installation
To install `js-logs-remover`, you must have Rust installed on your machine.
1. Clone the repository:
```bash
git clone https://github.com/BaseMax/js-logs-remover-rust.git
```
2. Navigate to the directory:
```bash
cd js-logs-remover-rust
```
3. Build the Rust application:
```bash
cargo build --release
```
After building, you will have a js-logs-remover binary in the project directory.
```
target
├── debug
└── release
└── js-logs-remover.exe
```
## Usage
Run the tool from the command line:
```bash
$ js-logs-remover [path] [log-methods]
```
`[path]`: The directory or file path where you want to remove the logs from. If no path is provided, it defaults to the current directory (.).
`[log-methods]`: A comma-separated list of console methods you want to remove (e.g., log,error,warn). If you specify all, it will remove all known console methods.
## Example Usage
Remove specific console methods: To remove console.log and console.warn from all .js, .ts, .jsx, and .tsx files within the src directory:
```bash
$ js-logs-remover src log,warn
```
Remove all console methods: To remove all console methods (like console.log, console.error, etc.) from all files in the src directory:
```bash
$ js-logs-remover src all
```
Process the current directory: To process the current directory and remove console.log:
```bash
$ js-logs-remover . log
```
### Excluded Directories
The following directories are automatically excluded from processing:
- node_modules
- .git
- dist
- build
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Copyright
© 2025 Max Base. All rights reserved.