Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

clr-code

gitkrishna21MIT1.2.2

A custom CLI tool

clean code, console log remover, javascript cleanup, debug logs removal, production-ready code, cli tool, console.log cleaner, js code cleaner, remove debug statements, development tools, automated code cleaning, npm package, code optimization, code quality, code productivity, debugging tool, console warn, clr-code

readme

Here’s a more attractive and decorated version of the README:

# 🌟 `crl-code` - Clean and Clear Your Code, Simplify Your Debugging 🌟

Welcome to **`crl-code`** — a powerful yet simple npm package designed to help developers **clean up** their JavaScript code by effortlessly removing unwanted `console.log()` statements and commented-out `//console.log()` lines. Whether you're preparing your code for production or just want a tidier, more efficient version, `crl-code` ensures that your codebase remains **clutter-free** and **optimized**!

---

## 🧹 Why Choose `crl-code`?

With **`crl-code`**, you can enjoy the following benefits:
- **💨 Automatic Cleanup**: Say goodbye to unnecessary `console.log()` and `//console.log()` clutter!
- **🔒 Preserve Important Logs**: Keep crucial logs intact by replacing `console.log()` with `console.warn()`, ensuring vital debug outputs remain visible.
- **📝 Non-Destructive**: Your original file remains untouched while a new, clean version is generated. **Safety First!**
- **🚀 Effortless Usage**: A simple CLI command makes cleaning your code a breeze.

---

## ✨ The Meaning Behind `clr-code`

Why **`clr-code`**? Let’s break it down:

- **CLR**: Short for **Clear** — representing the core mission of this tool: to **clear out** unnecessary `console.log()` statements from your code. We’re all about **streamlining** your codebase for a better, more professional look.

- **Code**: Refers to the JavaScript code that’s cleaned up, ensuring that your codebase stays neat, tidy, and **production-ready**.

**`clr-code`** is your one-stop tool for clearing out the clutter and making your code shine!

---

## ✨ Key Features

- **🧹 Effortless Cleanup**: Automatically removes all `console.log()` and `//console.log()` statements from your code, making it production-ready.
- **🔒 Keep Essential Logs**: Replace `console.log()` with `console.warn()` to preserve the logs you care about.
- **💡 Non-Destructive**: Your original file stays untouched while a new cleaned-up copy is generated, so you can always access your original code.
- **⚡ Simple CLI Command**: Run a single command to clean up your code — no complex configurations needed!

---

## 🚀 Installation

Install **`crl-code`** globally by running this command in your terminal:

```bash
npm install -g crl-code

🎯 Usage

Once installed, you can easily use crl-code via the command line to clean up your JavaScript files. Here’s how:

1. Remove All Console Logs (clr)

The default clr command removes all console.log() and //console.log() statements from your code. This is the default behavior of the package, ensuring that your code is clean and production-ready.

To run the command:

clr
  • What happens?: All unnecessary console.log() and //console.log() are removed, and a new clean copy of your file is created, leaving the original file unchanged.

2. Remove All Console Logs with clr auto

The command clr auto is essentially the same as clr. You can use either of the following commands to achieve the same result:

clr auto

or

clr

Both commands automatically clean your file by removing all debug logs and creating a new, clean version of your file.


3. Preserve Certain Console Logs

Need to keep some logs for debugging purposes? No problem! Simply replace console.log() with console.warn() where necessary, and crl-code will preserve them for you.

Example:

Before cleaning:

console.log("Debugging login flow...");  // Will be removed
console.warn("User data missing!"); // Will be preserved

After running clr auto:

console.warn("User data missing!"); // Preserved log

This ensures that essential debug logs remain intact while the unnecessary ones are removed.


⚙️ Options

  • auto: The clr auto command automatically removes all instances of console.log() and //console.log() from the given file and creates a clean copy.

This is the default behavior — so no worries if you just type clr!


💡 Why Use crl-code?

✅ Save Time, Automate the Process

Manually searching through your code to remove console.log() statements can be tedious and error-prone. With crl-code, you can automate this process and save time while preparing your code for production.

🚨 Keep Essential Logs

With crl-code, you don’t have to worry about losing important logs. Simply replace console.log() with console.warn() to preserve the logs you care about, and let the tool clean up the rest!


🛠️ Example

Here’s a quick walkthrough of how crl-code works:

1. Original file: Your app.js contains a mix of essential logs and unnecessary debug statements:

console.log("Debugging login flow...");
console.warn("User data missing!");
console.log("Fixing bugs...");

2. Run the command:

clr auto

3. New file: After running the command, crl-code will generate a new file with all unnecessary logs removed and important warnings kept intact:

console.warn("User data missing!");

Now your code is clean and ready for production deployment.


🔮 Future Updates

We’re always looking to improve crl-code! Some future updates include:

  • ✨ Custom Log Removal: Enable the removal of other types of console methods (e.g., console.error()).
  • 📂 Selective Log Removal: Allow users to specify specific files or directories to clean.
  • 🛠️ Integration with Build Tools: Seamlessly integrate with popular tools like Webpack or Gulp for automated log cleaning during your build process.

Stay tuned for these exciting features!


🤝 Contributing

We welcome contributions! If you have ideas for improvements or want to help out, feel free to:

  • Fork the repo
  • Create an issue
  • Submit a pull request

Your contributions are always welcome!


📜 License

crl-code is licensed under the MIT License. See the LICENSE file for more details.


By using crl-code, you streamline your development process and keep your codebase neat, professional, and production-ready. Say goodbye to cluttered debug logs and maintain a cleaner, more efficient codebase!


`

Key Updates:

  • Decorated Sections: Added emojis, headings, and sections for a more polished look.
  • Attractive Language: Enhanced the descriptions to be more appealing and easier to read.
  • Future Updates Section: Added exciting possibilities for upcoming features, making the project feel dynamic and evolving.