Cli: Show new version + upgrade help text in CLI

Created on 25 Feb 2019  Â·  23Comments  Â·  Source: react-native-community/cli

The CLI is a good place to notify people of new releases and give them more information about upgrades.

My proposal:

  • Periodically check for new RN releases when invoking the RN CLI and surface that people can upgrade with react-native upgrade.
  • When running react-native upgrade, show the breaking changes in red with a link to a blog post and the changelog:
React Native 0.60

Breaking Changes:
* Description of a breaking change and a link. 
* Description of a breaking change and a link.
* Description of a breaking change and a link.
For more information read:
* Blog post with link
* See the full changelog

I'm not entirely sure what the best way to implement is. I was thinking that release branches could have a file Upgrade.txt and the CLI could read that file straight from GitHub and display its contents.

What do you think?

feature request good first issue

Most helpful comment

I'll submit a PR soon!

All 23 comments

I'm not entirely sure what the best way to implement is. I was thinking that release branches could have a file Upgrade.txt and the CLI could read that file straight from GitHub and display its contents.

Since we need to check for a release anyway with a network request, we could read a section from the releases tab, e.g: https://github.com/facebook/react-native/releases/tag/v0.58.5

Additionally to what you've said, I'd leave an option to mute this banner on per-project for those who are intentionally using CLI with older versions.

Parsing the info from the release and tagging the CLI output in a special block seems like a great idea to me.

Sounds good. I'd love to pick this up after we cut 0.60-stable branch (around a week from now) and see what are the next steps. What do you think?

Yeah!

(You meant 0.59 stable I assume :) )

I'll try to see if I can make it land before we make 0.59 stable. If not, then it will be a 0.60.0 feature. Will do my best!

May I interest you in some GitHub APIs? Try this in your browser:

https://api.github.com/repos/facebook/react-native/releases/latest

Docs: https://developer.github.com/v3/repos/releases/#get-the-latest-release

The response has all we need:

  • tag_name to check if the release is newer
  • draft and prerelease to filter out newer but undesired releases
  • body which is the entire release markdown as a string that shouldn't be too hard to display.

What about API rate limits?

For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the user making requests.

Docs: https://developer.github.com/v3/#rate-limiting

I don't think this will be a problem, because:

  • It's per IP address, so it should scale well.
  • Displaying this information isn't vital for the CLI's functionality: we could attempt to check only weekly and cache the results.

What do you think? I'd be happy to give this a try 😄

That sounds great. Do you wanna send a PR? :)

Sure, I'll come up with something during the week

Awesome, thanks for taking up the work! If you need any help from the release format perspective, let me know! I think the style for now will be to just keep the "releases" tab small and link to a separate repository, so printing the whole "body" sounds like a plan.

(+1 for some fancy colours)

@grabbou initially I thought to take a similar approach to npm and use boxen to decorate the update message, so I ended up with:

Screenshot 2019-03-22 at 15 34 14

For this particular case, I'm not using our custom logger to avoid printing the info labels to the left of the rows.

Of course, the post-upgrade message can be different and print the entire release body.

What do you think?

I think this is a great start, feel free to send a pull request.

After that we can define a specific template that we'll follow for all releases so that we can print the header of the release section on GitHub right on the terminal, including the top breaking changes so they are shown right in people's faces.

To be even more friendly, and help those upgrading more than 1 version up, we need to batch breaking changes from previous releases (this will also be necessary if e.g. we upgrade from 0.59.0 to 0.60.4 – with naive approach the breaking changes from 0.60.0 would be gone.)

New version is done. Now we can discuss whether we'd like to show the release notes.

I think it would be a great addition to link to the upgrade-helper site.
We know what version they are one and what the new version is, so should be easy to add.

i.e. https://react-native-community.github.io/upgrade-helper/?from=0.58.0&to=0.59.0 as per the image shared above.

@Johan-dutoit we already do that, you'll see it once you update the @react-native-community/cli to the latest version or use v2 directly.

@thymikee I am aware it's part of the upgrade process, but feel it would be useful to view the changes before actually committing to the upgrade process.

A link just under the changelog would be nice.

Ah, yea, you're right!

I'll submit a PR soon!

Is this still open?

We still don't show the "breaking changes" section. It's still not clear how we want to display it.

I can have a go at it if we have some kind of idea what we want to display

That would be awesome! As discussed earlier, feel free to take inspirations from https://github.com/react-native-community/cli/issues/189#issuecomment-475653045

Was this page helpful?
0 / 5 - 0 ratings