#nodejs #cli #cli-tool #tool

应用 rmdev

这是一个用于删除开发环境中剩余的依赖项和缓存文件的工具,例如:nodule_modules、target

3 个不稳定版本

0.2.4 2024年7月22日
0.2.3 2024年7月21日
0.0.0 2024年7月20日

#429开发工具

Download history 71/week @ 2024-07-14 290/week @ 2024-07-21 3/week @ 2024-07-28

每月下载量 364

MIT 许可证

200KB
766

Rmdev

中文

你好

这是一个用于删除开发环境中剩余的依赖项和缓存文件的工具,例如:nodule_modules、target...

特性

  • 🌟 批量删除
  • 🚀 快速删除
  • 🧹 支持多项目类型
    • nodejs (nodule_modules)
    • rust (target)
    • ...

安装

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

cargo install rmdev

使用

rmdev clear ../ -f

# ../ clear target dir

帮助

rmdev clear --help

跳过扫描

rmdev.skip 文件添加到您的项目中。跳过删除。

贡献

我希望这个工具最终能涵盖所有主流语言,但更多的工作需要大家的贡献 ❤️!

我们可以通过修改 src/scan_category.rs 文件并在 PR 中写出由什么语言生成的工具来贡献。

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()
    }
}


整个过程仍然非常简单,欢迎大家贡献。

关于

MIT

依赖

~11–22MB
~281K SLoC