summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-02-20 13:30:34 +0100
committerGitHub <noreply@github.com>2024-02-20 13:30:34 +0100
commit54a3eb585df170c14bdc0e237a8a2276dd705f38 (patch)
treeb816cb29f2bf76b024e8050857e3a5b83a3cf7b8
parent8fdd65556299efa58512467b4d19d2612441d376 (diff)
fix(publish): print files that will be published (#22495)
-rw-r--r--cli/tools/registry/mod.rs10
-rw-r--r--cli/tools/registry/tar.rs2
-rw-r--r--tests/testdata/publish/dry_run.out4
-rw-r--r--tests/testdata/publish/symlink.out3
4 files changed, 19 insertions, 0 deletions
diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs
index 586115f27..37bd3616b 100644
--- a/cli/tools/registry/mod.rs
+++ b/cli/tools/registry/mod.rs
@@ -828,6 +828,16 @@ pub async fn publish(
}
if publish_flags.dry_run {
+ for (_, package) in prepared_data.package_by_name {
+ log::info!(
+ "{} of {} with files:",
+ colors::green_bold("Simulating publish"),
+ colors::gray(package.display_name()),
+ );
+ for file in &package.tarball.files {
+ log::info!(" {} ({})", file.specifier, human_size(file.size as f64),);
+ }
+ }
log::warn!("{} Aborting due to --dry-run", colors::yellow("Warning"));
return Ok(());
}
diff --git a/cli/tools/registry/tar.rs b/cli/tools/registry/tar.rs
index 2fdb60f63..3dc2616fa 100644
--- a/cli/tools/registry/tar.rs
+++ b/cli/tools/registry/tar.rs
@@ -160,6 +160,8 @@ pub fn create_gzipped_tarball(
write!(&mut hash, "{:02x}", byte).unwrap();
}
+ files.sort_by(|a, b| a.specifier.cmp(&b.specifier));
+
Ok(PublishableTarball {
files,
hash,
diff --git a/tests/testdata/publish/dry_run.out b/tests/testdata/publish/dry_run.out
index 1fa593294..679aa8f39 100644
--- a/tests/testdata/publish/dry_run.out
+++ b/tests/testdata/publish/dry_run.out
@@ -1,3 +1,7 @@
Checking for slow types in the public API...
Check [WILDCARD]
+Simulating publish of @foo/bar@1.0.0 with files:
+ [WILDCARD]deno.json (140B)
+ [WILDCARD]mod.ts (114B)
+ [WILDCARD]std_http.ts (119B)
Warning Aborting due to --dry-run
diff --git a/tests/testdata/publish/symlink.out b/tests/testdata/publish/symlink.out
index 952449421..e7fc0c2a2 100644
--- a/tests/testdata/publish/symlink.out
+++ b/tests/testdata/publish/symlink.out
@@ -8,4 +8,7 @@ warning[unsupported-file-type]: unsupported file type 'symlink'
info: the file was ignored and will not be published
docs: https://jsr.io/go/unsupported-file-type
+Simulating publish of @foo/bar@1.0.0 with files:
+ [WILDCARD]deno.json (87B)
+ [WILDCARD]mod.ts (56B)
Warning Aborting due to --dry-run