From eb46296e974c686896486350bb00bf428a84e9fd Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 10 Jul 2024 11:18:10 +1000 Subject: feat: deprecate `deno vendor` (#22183) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit deprecates `deno vendor` subcommand in favor of using `--vendor` flag or `"vendor": true` setting in the config file. The subcommand is still available (until Deno 2) but is hidden from the help output. Closes #20584 --------- Co-authored-by: Bartek Iwańczuk --- cli/args/flags.rs | 7 ++++++- cli/tools/vendor/mod.rs | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index d2321f32e..b07f3783a 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -2804,11 +2804,16 @@ update to a different location, use the --output flag }) } +// TODO(bartlomieju): this subcommand is now deprecated, remove it in Deno 2. fn vendor_subcommand() -> Command { Command::new("vendor") + .hide(true) .about("Vendor remote modules into a local directory") .long_about( - "Vendor remote modules into a local directory. + "⚠️ Warning: `deno vendor` is deprecated and will be removed in Deno 2.0. +Add `\"vendor\": true` to your `deno.json` or use the `--vendor` flag instead. + +Vendor remote modules into a local directory. Analyzes the provided modules along with their dependencies, downloads remote modules to the output directory, and produces an import map that diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index 2dfa71c44..bbb796a2a 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -12,6 +12,7 @@ use deno_core::error::AnyError; use deno_core::futures::FutureExt; use deno_core::resolve_url_or_path; use deno_graph::GraphKind; +use deno_runtime::colors; use log::warn; use crate::args::CliOptions; @@ -38,6 +39,10 @@ pub async fn vendor( flags: Flags, vendor_flags: VendorFlags, ) -> Result<(), AnyError> { + log::info!( + "{}", + colors::yellow("⚠️ Warning: `deno vendor` is deprecated and will be removed in Deno 2.0.\nAdd `\"vendor\": true` to your `deno.json` or use the `--vendor` flag instead."), + ); let mut cli_options = CliOptions::from_flags(flags)?; let raw_output_dir = match &vendor_flags.output_path { Some(output_path) => PathBuf::from(output_path).to_owned(), -- cgit v1.2.3