Skip to content

Conversation

@blyxyas
Copy link
Member

@blyxyas blyxyas commented Apr 15, 2023

Fixes #11768
Adds a success message when publishing a crate to crates.io (only crates.io).

Why?

The current cargo publish output isn't very helpful or gives a lot of feedback.

It's something like:

$ cargo publish
    [...]
    Updating crates.io index

$

And that's it, it ends with a boring "Updating index" message. It could be very handy if, after a publish, Cargo printed the URL to the crates in crates.io along with a success message with some more ✨ Magic


This PR adds a message that congratulates the user for publishing their crates, so it feels better to publish a crate!

@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-interacts-with-crates.io Area: interaction with registries S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 15, 2023
Comment on lines +248 to +261
// Print success note on publish
if opts.registry.is_none() {
if let Some(ref registries) = pkg.publish() {
if registries[0] == CRATES_IO_REGISTRY {
if let Ok(packages) = opts.to_publish.get_packages(ws) {
for package in packages {
opts.config
.shell().note(format!("Your crate was successfully published to crates.io! You can visit it at https://crates.io/crates/{} .", package.name()))?
}
}
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current cargo publish output isn't very helpful or gives a lot of feedback.

It's something like:
And that's it, it ends with a boring "Updating index" message. I

The message you showed I'm assuming is from a stable release. As you saw in the test, master already ends with

    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Uploaded delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
note: Waiting for `[email protected]` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly.
     Waiting [===>                       ] 11/60
   Published delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo) has been successfully published to registry `crates-io`

See #11713

Adding another success message feels a bit excessive in the amount of output we are showing the user.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right. I guess I just have a weird / old version (I made the issue in February, maybe the stable ver. there has changed a lot?)

Anyways, I'm going to close the PR

Comment on lines +249 to +251
if opts.registry.is_none() {
if let Some(ref registries) = pkg.publish() {
if registries[0] == CRATES_IO_REGISTRY {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking only the first of the potential registries doesn't seem right.

We should instead check what registry we actually published to

@blyxyas
Copy link
Member Author

blyxyas commented Apr 17, 2023

Sorry for wasting your time.

@blyxyas blyxyas closed this Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-interacts-with-crates.io Area: interaction with registries S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Success message containing link to crates.io after cargo publish

4 participants