From 2dfc0aca7c6a04d54fe6f9a73be70fc4c591d552 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 7 Mar 2024 20:16:32 -0500 Subject: fix(publish): make include and exclude work (#22720) 1. Stops `deno publish` using some custom include/exclude behaviour from other sub commands 2. Takes ancestor directories into account when resolving gitignore 3. Backards compatible change that adds ability to unexclude an exclude by using a negated glob at a more specific level for all sub commands (see https://github.com/denoland/deno_config/pull/44). --- cli/args/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cli/args') diff --git a/cli/args/mod.rs b/cli/args/mod.rs index acdc96526..d72b41947 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1258,7 +1258,7 @@ impl CliOptions { pub fn resolve_config_excludes(&self) -> Result { let maybe_config_files = if let Some(config_file) = &self.maybe_config_file { - config_file.to_files_config()? + Some(config_file.to_files_config()?) } else { None }; @@ -1750,14 +1750,14 @@ fn resolve_files( if let Some(file_flags) = maybe_file_flags { if !file_flags.include.is_empty() { maybe_files_config.include = - Some(PathOrPatternSet::from_relative_path_or_patterns( + Some(PathOrPatternSet::from_include_relative_path_or_patterns( initial_cwd, &file_flags.include, )?); } if !file_flags.ignore.is_empty() { maybe_files_config.exclude = - PathOrPatternSet::from_relative_path_or_patterns( + PathOrPatternSet::from_exclude_relative_path_or_patterns( initial_cwd, &file_flags.ignore, )?; @@ -1886,7 +1886,7 @@ mod test { temp_dir.write("pages/[id].ts", ""); let temp_dir_path = temp_dir.path().as_path(); - let error = PathOrPatternSet::from_relative_path_or_patterns( + let error = PathOrPatternSet::from_include_relative_path_or_patterns( temp_dir_path, &["data/**********.ts".to_string()], ) @@ -1897,7 +1897,7 @@ mod test { Some(FilePatterns { base: temp_dir_path.to_path_buf(), include: Some( - PathOrPatternSet::from_relative_path_or_patterns( + PathOrPatternSet::from_include_relative_path_or_patterns( temp_dir_path, &[ "data/test1.?s".to_string(), @@ -1908,7 +1908,7 @@ mod test { ) .unwrap(), ), - exclude: PathOrPatternSet::from_relative_path_or_patterns( + exclude: PathOrPatternSet::from_exclude_relative_path_or_patterns( temp_dir_path, &["nested/**/*bazz.ts".to_string()], ) @@ -1919,7 +1919,7 @@ mod test { ) .unwrap(); - let mut files = FileCollector::new(|_, _| true) + let mut files = FileCollector::new(|_| true) .ignore_git_folder() .ignore_node_modules() .ignore_vendor_folder() -- cgit v1.2.3