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).
This commit is contained in:
David Sherret 2024-03-07 20:16:32 -05:00 committed by GitHub
parent 2ed984ba3a
commit 2dfc0aca7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 1017 additions and 222 deletions

View file

@ -388,23 +388,20 @@ fn collect_coverages(
initial_cwd.to_path_buf(),
)])
} else {
PathOrPatternSet::from_relative_path_or_patterns(
PathOrPatternSet::from_include_relative_path_or_patterns(
initial_cwd,
&files.include,
)?
}
}),
exclude: PathOrPatternSet::from_relative_path_or_patterns(
exclude: PathOrPatternSet::from_exclude_relative_path_or_patterns(
initial_cwd,
&files.ignore,
)
.context("Invalid ignore pattern.")?,
};
let file_paths = FileCollector::new(|file_path, _| {
file_path
.extension()
.map(|ext| ext == "json")
.unwrap_or(false)
let file_paths = FileCollector::new(|e| {
e.path.extension().map(|ext| ext == "json").unwrap_or(false)
})
.ignore_git_folder()
.ignore_node_modules()