Ever find yourself cringing when a debugging or test command sneaks its way into your production code? ๐ฑ Donโt worry, ERA's got your back!
Imagine ERA as your digital "magic wand" ๐ช for code cleanup. Itโs like having a superpower that sweeps through your codebase, banishing those pesky output command that slipped through the cracks and ensuring your production environment remains pristine. ๐
Just run ERA, and watch it work its magic! Itโll zap away any unwanted output command from your code , leaving your codebase cleaner than ever. ๐
- Instant Cleanup: ERA swiftly removes those unintended commands with a flick of your wrist (or a click of your mouse).
- Stress-Free: No more second-guessing or frantic searches. ERA makes sure your production environment stays squeaky clean.
- Developerโs Best Friend: ERA is designed to solve the problem every developer facesโkeeping your code spotless and professional.
So, why wait? Give ERA a spin and make your codebase sparkle! โจ
This guide will help you install the latest version of Eradicate(ERA) on your system. The installation script supports Linux, macOS, and Windows.
- Bash shell (for Linux and macOS)
- PowerShell (for Windows)
curlcommand-line tool- Internet connection
sudoaccess (for Linux and macOS)
-
Download the installation script:
curl -O https://raw.githubusercontent.com/wadmit/era/master/scripts/install.sh -
Make the script executable (Linux and macOS only):
chmod +x install.sh -
Run the installation script:
- On Linux and macOS:
./install.sh - On Windows (using PowerShell):
bash install.sh
- On Linux and macOS:
-
The script will automatically detect your operating system, fetch the latest version of ERA, download the appropriate binary, and install it in the correct location.
-
After successful installation, you should be able to run ERA by typing
erain your terminal or command prompt.
This section provides a step-by-step guide on how to use Eradicate (era) effectively in your project.
To set up Eradicate in your project, run the following command:
erd init- What It Does: This command initializes Eradicate in your project workspace. It creates a default configuration file named
erd.yamlin the current directory. - After Initialization: You will see the
erd.yamlfile generated. This file contains default settings that you can customize according to your project's needs.
To remove console output and other specified patterns from your project, use the command:
erd clean- Functionality: This command searches for the
erd.yamlfile in your project directory and applies the cleaning rules defined in it. It will scan through your codebase and remove any matching patterns, such as console logs or other specified outputs. - Default Configuration:
- If the
erd.yamlfile is not found, Eradicate will automatically use a default configuration to perform the cleaning. - The default settings will target common console output functions for various programming languages.
- If the
If you need to clean up specific files or folders, you can use:
erd remove -f <filelocation/filename> -d <directory>-
Parameters:
-f <filelocation/filename>: This flag specifies the path to a single file that you want to clean. It verifies the existence of the file before proceeding with the removal of specified patterns.-d <directory>: This flag allows you to specify a directory from which you want to remove outputs. Eradicate will check all files within the specified directory and apply the cleaning rules.
-
Functionality:
- The command first checks if the
-fflag is present. If it is, the tool verifies the provided file location and removes specified patterns (like console logs) from that file. - If the
-dflag is provided, it will clean all supported files in the specified directory. Files that are not supported or specified in the ignore list will be skipped.
- The command first checks if the
After navigating to your project directory, run:
erd initThis creates an erd.yaml file. You can open this file to adjust the cleaning rules according to your preferences.
To clean your project based on the rules in erd.yaml, simply run:
erd cleanThis command will traverse your project files and remove unwanted console outputs based on your configuration.
If you want to remove console outputs only from a specific file, you can do:
erd remove -f src/main.jsThis will check the file main.js in the src directory and remove specified outputs.
To clean all files in a directory, use:
erd remove -d src/componentsThis command will apply the cleaning rules to all relevant files in the components directory.
- Ensure that you have the necessary permissions to read and write files in the directories you specify.
- Review your
erd.yamlconfiguration before running thecleancommand to make sure it meets your requirements. - For further details on the configuration options, refer to the Configuration Section.
The configuration for Eradicate (era) is defined in the erd.yaml file generated during the initialization process. This configuration controls how the tool operates, what files to ignore, and where to store reports.
The configuration is structured as follows:
-
Root: Specifies the root directory for the project. It defaults to the current directory (
"."). This is where Eradicate will start searching for files to process. -
ReportPath: Indicates the directory where the reports will be stored. By default, it is set to
"era-reports". After cleaning or processing files, the reports detailing the changes made will be saved in this location. -
IgnoreKeyword: An array of keywords that, if found in the code, will instruct Eradicate to ignore the associated lines or sections. By default, it includes
["erd:ignore", "erd:ignoreAll"]. You can customize this list to add any keywords relevant to your project that you want to ignore. Exampleprint("hello world") #erd:ignore
Above code will ignore that print statement from being removed.It will go similar with other languages like Javascript, Java, Ruby,Php etc.
-
IgnoreFileExtensions: A list of file extensions that Eradicate will skip during the cleaning process. This is useful for excluding binary files or archives that should not be processed. The default extensions are:
.exe.dll.so.dylib.zip.tar.gz.rar
-
IgnoreDirs: An array of directory names that will be ignored by Eradicate. Common directories like
node_modules, version control directories (.git,.svn, etc.), and IDE configurations are included by default. You can customize this list to add any directories that should not be processed. -
IgnoreFiles: A list of specific files to ignore during processing. This is an empty array by default, allowing you to add specific files that you want to exclude from cleaning.
-
ListenType: Defines the type of listening method for Eradicate. Currently, it supports only the
"command"type, which means the tool will execute commands based on user input from the command line. This is where you can specify if you want to add additional types in future versions.
Here's an example of how your erd.yaml file might look after customization:
root: "."
reportPath: "era-reports"
ignoreKeyword:
- "erd:ignore"
- "erd:ignoreAll"
ignoreFileExtensions:
- ".exe"
- ".dll"
- ".so"
ignoreDirs:
- "node_modules"
- ".git"
ignoreFiles: []
listenType: "command"- Ensure that your
erd.yamlfile is saved in the root directory of your project for Eradicate to function properly. - Customize the configuration fields according to your project's needs to optimize the cleaning process.
If you encounter any issues during installation, please check the following:
- Ensure you have an active internet connection.
- Verify that you have the necessary permissions to install software on your system.
- For Linux and macOS users, make sure you have
sudoaccess and write permissions to/usr/local/bin/. - For Windows users, ensure you're running PowerShell as an administrator.
If problems persist, please open an issue on our GitHub repository with details about the error you're experiencing.
To uninstall ERA:
- On Linux and macOS:
sudo rm /usr/local/bin/era - On Windows:
Remove-Item $env:USERPROFILE\era.exe
To update ERA to the latest version, simply run the installation script again. It will automatically fetch and install the most recent release.
If you need help or have any questions, please open an issue on our GitHub repository or contact our support team.
Thank you for using ERA!