Console Manager 🧹โจ
Overview
Console Manager is a powerful Visual Studio Code extension designed to streamline your JavaScript and TypeScript development process. It offers efficient tools for managing console.log
statements and other console methods in your code, helping you clean up your projects quickly and effectively.
Features 🚀
- 🗑๏ธ Remove
console.log
statements from the current file or entire project
- 💬 Comment out
console.log
statements instead of removing them
- 🎛๏ธ Customizable settings for included/excluded files and folders
- 🛡๏ธ Safe operation with clear feedback
Installation 📦
- Open Visual Studio Code
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac)
- Search for "Console Manager"
- Click Install
Usage 🛠๏ธ
Commands
Access these commands through the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac):
Remove console.log from Current File
Remove console.log from All Project Files
Comment console.log in Current File
Comment console.log in All Project Files
Command Line Usage
In addition to the Visual Studio Code interface, you can also use the Console Manager through the command line. For more information, visit the โจmanage-console-cli repository.โจ
Examples
Before using Console Manager
function calculateTotal(items) {
console.log("Calculating total...");
let total = 0;
for (let item of items) {
console.log(`Processing item: ${item.name}`);
total += item.price;
}
console.log(`Total calculated: ${total}`);
return total;
}
#### After using "Remove console.log from Current File"
```javascript
function calculateTotal(items) {
let total = 0;
for (let item of items) {
total += item.price;
}
return total;
}
function calculateTotal(items) {
// console.log('Calculating total...');
let total = 0;
for (let item of items) {
// console.log(`Processing item: ${item.name}`);
total += item.price;
}
// console.log(`Total calculated: ${total}`);
return total;
}
Working with Multiple Files 📁
Console Manager excels at processing multiple files simultaneously, making it perfect for cleaning up entire projects quickly. Here's how it works:
Example Project Structure
my-project/
โโโ src/
โ โโโ main.js
โ โโโ utils.js
โ โโโ components/
โ โโโ Header.js
โ โโโ Footer.js
โโโ tests/
โ โโโ test.js
โโโ config.js
Before Using Console Manager
src/main.js
import { helper } from "./utils";
function main() {
console.log("Application starting...");
const result = helper(5);
console.log("Result:", result);
return result;
}
src/utils.js
export function helper(x) {
console.log("Helper function called with:", x);
return x * 2;
}
src/components/Header.js
function Header() {
console.log("Rendering header");
return "<header>Welcome</header>";
}
tests/test.js
function testHelper() {
console.log("Running tests...");
const result = helper(3);
console.log("Test result:", result);
assert(result === 6);
}
After Using "Remove console.log from All Project Files"
src/main.js
import { helper } from "./utils";
function main() {
const result = helper(5);
return result;
}
src/utils.js
export function helper(x) {
return x * 2;
}
src/components/Header.js
function Header() {
return "<header>Welcome</header>";
}
tests/test.js
function testHelper() {
const result = helper(3);
assert(result === 6);
}
Note: config.js
remains unchanged as it's in the excludedFiles
list by default.
Benefits of Bulk Processing
- Time-Saving: Clean up multiple files with a single command.
- Consistency: Ensure all
console.log
statements are removed or commented across your entire project.
- Flexible: Customizable settings allow you to include or exclude specific files or folders.
- Pre-Deployment Ready: Quickly prepare your entire codebase for production by removing debug logs.
Usage Tips for Multiple Files
- Use the "Remove console.log from All Project Files" command to process the entire project.
- Customize the
excludedFolders
and excludedFiles
settings to protect specific areas of your project.
- After bulk processing, review changes in your version control system to ensure desired results.
- For large projects, consider running the command on specific folders or file types first to gauge its impact.
By leveraging Console Manager's ability to process multiple files, you can maintain clean, production-ready code across your entire project with minimal effort.
Configuration โ๏ธ
Customize the extension's behavior through VS Code settings:
{
"consoleLogRemover.includedExtensions": [".js", ".ts", ".jsx", ".tsx"],
"consoleLogRemover.excludedFolders": [
"node_modules",
"dist",
"build",
".git"
],
"consoleLogRemover.excludedFiles": [
"config.js",
"config.json",
"package.json",
"package-lock.json"
]
}
includedExtensions
: File types to process
excludedFolders
: Folders to ignore
excludedFiles
: Specific files to ignore
Why Use Console Manager? 🤔
- 🎯 Targeted Cleaning: Choose between cleaning a single file or the entire project
- โก Fast and Efficient: Quickly remove or comment out debugging statements before deployment
- 🔒 Safe: Excludes sensitive files and folders by default
- 👁๏ธ Clear Feedback: Shows how many files were processed and cleaned
Contributing 🤝
Contributions are welcome! Please feel free to submit a Pull Request.
License 📄
This extension is licensed under the MIT License.
Support 💬
If you encounter any issues or have suggestions, please open an issue on our GitHub repository.
Happy coding! 🚀โจ