From d20c9e75d1540b1a27e721d0cf66d29ba6a2c3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 22 Jan 2024 18:37:28 +0100 Subject: refactor: add "UnstableConfig" struct to cli/args/flags.rs (#21993) This commit adds "UnstableConfig" struct which centralizes handling of all "--unstable-*" flags. Closes https://github.com/denoland/deno/issues/21920 --- cli/tools/installer.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cli/tools/installer.rs') diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index fa39b4596..f854eafe4 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -378,7 +378,7 @@ async fn resolve_shim_data( TypeCheckMode::Local => executable_args.push("--check".to_string()), } - if flags.unstable { + if flags.unstable_config.legacy_flag_enabled { executable_args.push("--unstable".to_string()); } @@ -499,6 +499,7 @@ fn is_in_path(dir: &Path) -> bool { mod tests { use super::*; + use crate::args::UnstableConfig; use crate::util::fs::canonicalize_path; use deno_config::ConfigFlag; use std::process::Command; @@ -647,7 +648,10 @@ mod tests { create_install_shim( Flags { - unstable: true, + unstable_config: UnstableConfig { + legacy_flag_enabled: true, + ..Default::default() + }, ..Flags::default() }, InstallFlags { -- cgit v1.2.3