Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(publish): print files that will be published #22495

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
}
Expand Down
2 changes: 2 additions & 0 deletions cli/tools/registry/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions tests/testdata/publish/dry_run.out
Original file line number Diff line number Diff line change
@@ -1,3 1,7 @@
Checking for slow types in the public API...
Check [WILDCARD]
Simulating publish of @foo/[email protected] with files:
[WILDCARD]deno.json (140B)
[WILDCARD]mod.ts (114B)
[WILDCARD]std_http.ts (119B)
Warning Aborting due to --dry-run
3 changes: 3 additions & 0 deletions tests/testdata/publish/symlink.out
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected] with files:
[WILDCARD]deno.json (87B)
[WILDCARD]mod.ts (56B)
Warning Aborting due to --dry-run