diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-07 20:16:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 20:16:32 -0500 |
commit | 2dfc0aca7c6a04d54fe6f9a73be70fc4c591d552 (patch) | |
tree | 58fb01c46364e4888097e7135b2f829f38ce990c /cli/args/mod.rs | |
parent | 2ed984ba3aa638c3f088ac1edc5c779c7d9195d1 (diff) |
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).
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<PathOrPatternSet, AnyError> { 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() |