#tool #cli-tool #cli

app rmdev

This is a tool to delete the remaining dependencies and cache files in the development environment, eg: nodule_modules、target

3 unstable releases

0.2.4 Jul 22, 2024
0.2.3 Jul 21, 2024
0.0.0 Jul 20, 2024

#1128 in Development tools

MIT license

200KB
766 lines

Rmdev

中文

Hello

This is a tool to delete the remaining dependencies and cache files in the development environment, eg: nodule_modules、target...

Feature

  • 🌟 batch deletion
  • 🚀 fast deletion
  • 🧹 support multi project type
    • nodejs (nodule_modules)
    • rust (target)
    • ...

Install

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # install cargo

cargo install rmdev

Use

rmdev clear ../ -f

# ../ clear target dir

Help

rmdev clear --help

Skip Scan

Add rmdev.skip file to your project. skip to deletion.

Contribute

I hope that this tool will eventually cover all the major languages, but more of this work needs to be contributed by all of you ❤️!

We can contribute by modifying the src/scan_category.rs file and writing in the PR what tool in what language generated the.

use std::path::Path;

use once_cell::sync::Lazy;

pub(crate) static STRATEGY: Lazy<Vec<ScanCate>> =
    Lazy::new(|| vec![ScanCate::Npm, ScanCate::Cargo]);

#[derive(Debug, Clone)]
pub enum ScanCate {
    Npm,
    Cargo,
}

impl ScanCate {
    pub(crate) fn access_keyfile(&self, path: &Path) -> bool {
        match self {
            Self::Npm => path.join("package.json").exists(),
            Self::Cargo => path.join("Cargo.toml").exists(),
        }
    }

    pub(crate) fn rm_keyfile(&self, path: &Path) -> bool {
        match self {
            Self::Npm => path.to_str().unwrap().contains("node_modules"),
            Self::Cargo => path.to_str().unwrap().contains("target"),
        }
    }

    pub(crate) fn ident(&self) -> String {
        match self {
            Self::Npm => "NPM",
            Self::Cargo => "Cargo",
        }
        .to_string()
    }
}


The whole process is still very easy, everyone is welcome to contribute.

About

MIT

Dependencies

~12–22MB
~298K SLoC