From e9e3ab462863fdaf1c0639c53da16c737a0d913b Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 8 Aug 2024 15:22:18 +0200 Subject: feat: deno clean (#24950) Co-authored-by: Satya Rohith --- cli/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/main.rs') diff --git a/cli/main.rs b/cli/main.rs index 9cb2b2644..534fa92d4 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -32,6 +32,7 @@ use crate::args::flags_from_vec; use crate::args::DenoSubcommand; use crate::args::Flags; use crate::args::DENO_FUTURE; +use crate::cache::DenoDir; use crate::graph_container::ModuleGraphContainer; use crate::util::display; use crate::util::v8::get_v8_flags_from_env; @@ -133,6 +134,14 @@ async fn run_subcommand(flags: Arc) -> Result { .load_and_type_check_files(&check_flags.files) .await }), + DenoSubcommand::Clean => spawn_subcommand(async move { + let deno_dir = DenoDir::new(None)?; + if deno_dir.root.exists() { + std::fs::remove_dir_all(&deno_dir.root)?; + log::info!("{} {}", colors::green("Removed"), deno_dir.root.display()); + } + Ok::<(), std::io::Error>(()) + }), DenoSubcommand::Compile(compile_flags) => spawn_subcommand(async { tools::compile::compile(flags, compile_flags).await }), -- cgit v1.2.3