summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/registry/mod.rs6
-rw-r--r--cli/tools/registry/tar.rs14
2 files changed, 10 insertions, 10 deletions
diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs
index 96f2d0f13..990f910a8 100644
--- a/cli/tools/registry/mod.rs
+++ b/cli/tools/registry/mod.rs
@@ -131,9 +131,7 @@ async fn prepare_publish(
let Some((scope, package_name)) = name.split_once('/') else {
bail!("Invalid package name, use '@<scope_name>/<package_name> format");
};
- let exclude_patterns = deno_json
- .to_files_config()
- .map(|files| files.map(|f| f.exclude).unwrap_or_default())?;
+ let file_patterns = deno_json.to_publish_config()?.map(|c| c.files);
let diagnostics_collector = diagnostics_collector.clone();
let tarball = deno_core::unsync::spawn_blocking(move || {
@@ -143,7 +141,7 @@ async fn prepare_publish(
&*source_cache,
&diagnostics_collector,
&unfurler,
- &exclude_patterns,
+ file_patterns,
)
.context("Failed to create a tarball")
})
diff --git a/cli/tools/registry/tar.rs b/cli/tools/registry/tar.rs
index 9bd7f098e..c3fafa4b2 100644
--- a/cli/tools/registry/tar.rs
+++ b/cli/tools/registry/tar.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use bytes::Bytes;
+use deno_config::glob::FilePatterns;
use deno_core::anyhow;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
@@ -13,7 +14,6 @@ use std::path::PathBuf;
use tar::Header;
use crate::util::import_map::ImportMapUnfurler;
-use deno_config::glob::PathOrPatternSet;
use super::diagnostics::PublishDiagnostic;
use super::diagnostics::PublishDiagnosticsCollector;
@@ -37,7 +37,7 @@ pub fn create_gzipped_tarball(
source_cache: &dyn deno_graph::ParsedSourceStore,
diagnostics_collector: &PublishDiagnosticsCollector,
unfurler: &ImportMapUnfurler,
- exclude_patterns: &PathOrPatternSet,
+ file_patterns: Option<FilePatterns>,
) -> Result<PublishableTarball, AnyError> {
let mut tar = TarGzArchive::new();
let mut diagnostics = vec![];
@@ -47,11 +47,13 @@ pub fn create_gzipped_tarball(
while let Some(entry) = iterator.next() {
let entry = entry?;
- if exclude_patterns.matches_path(entry.path()) {
- if entry.file_type().is_dir() {
- iterator.skip_current_dir();
+ if let Some(file_patterns) = &file_patterns {
+ if !file_patterns.matches_path(entry.path()) {
+ if entry.file_type().is_dir() {
+ iterator.skip_current_dir();
+ }
+ continue;
}
- continue;
}
if entry.file_type().is_file() {