rn-diff-purge icon indicating copy to clipboard operation
rn-diff-purge copied to clipboard

USAGE.md should consist of more detailed steps how to do an upgrade RN

Open lpikora opened this issue 5 years ago • 19 comments

1 Check the diff Check the diff of your current version and the version you want to upgrade to.

2 Manually do the changes Do the changes from the diff in your project.

These steps not explain much for people unfamiliar with diffs on github.

Steps should be more explanatory eg.:

1. Check which React Native version is used in your project go to package.json in root of your project and find version on line e.g.: "react-native": "0.58.0" in dependencies

2. Open diff of your version and version you want upgrade to Url of diff is in format: https://github.com/react-native-community/rn-diff-purge/compare/version/[rn-version-in-your-project]...version/[rn-version-you-want-upgrade-to]. For example https://github.com/react-native-community/rn-diff-purge/compare/version/0.58.0...version/0.59.1

3. Manually apply changes from diff to your project source code. In your source code editor manually remove lines and files or add new lines and files as diff suggest...

4. Run npm install or yarn install

There should be also stated more clearly in README.MD, what is rn-diff-purge for and how it works. After reading https://facebook.github.io/react-native/blog/ I thought it is some new command which should replace react-native-git-upgrade. Readme should be also more structured with titles like:

==What is rn-diff-purge is for==

==How use rn-diff-purge to upgrade RN in your project== Look at USAGE.md

lpikora avatar Mar 17 '19 13:03 lpikora

I am thinking of removing this file actually, as react-native upgrade will soon be good enough to replace the usage file. But I would gladly accept a PR to make this file better if people use it.

pvinis avatar Mar 17 '19 14:03 pvinis

@pvinis I thought the purpose of this repo was because react-native upgrade wasn't very good?

karltaylor avatar Mar 19 '19 17:03 karltaylor

Since RN 0.59, react-native upgrade uses rn-diff-purge under the hood.

thymikee avatar Mar 19 '19 17:03 thymikee

Oh I'm on 0.53.0 😬 long way to go!

karltaylor avatar Mar 19 '19 17:03 karltaylor

Yep. Key was here is was. I think it will be much better soon! And I hope we can keep it working well for a long time. :)

pvinis avatar Mar 19 '19 19:03 pvinis

I am confused with how to use this repo as well :)

olanMbakop avatar Apr 22 '19 09:04 olanMbakop

@olanMbakop Just go to https://github.com/react-native-community/rn-diff-purge/compare/release/0.59.4..release/0.59.5

Then choose the base version to the version you have. Then choose the version you wish to upgrade to. Then implement the changes manually in your codes. Most are quite simple and self-explanatory. Let me know if you have any questions or issues.

Then run npm install :)

Aung-Myint-Thein avatar Apr 22 '19 09:04 Aung-Myint-Thein

Thanks @Aung-Myint-Thein. Figured it out after taking some time digging. 👍

olanMbakop avatar Apr 22 '19 10:04 olanMbakop

I have also made https://pvinis.github.io/purge-web/ so its easy to find the diff you need.

pvinis avatar Apr 22 '19 11:04 pvinis

@pvinis Yes, that helps as well... I was able to upgrade successfully! Thank you for this. 👍

olanMbakop avatar Apr 22 '19 12:04 olanMbakop

I think it wouldn't hurt to keep some instructions on how would be the best to apply the changes manually. Just to account for the odd situation when things fail.

For example, I might need to do one since I'm trying to upgrade a project from 56.1 to the latest version (59.8) and it's not working with any automatic solution.

joanbarros avatar May 14 '19 02:05 joanbarros

Hello. I would suggest to go version by version. It will make it easier even if it's a bit slower.

The best way is to start with the diff, make the changes in the package.json, any config files like babel and flow, then go on to the js files, and then the changes to android and iOS files. Be careful with the Xcode project file as you shouldn't do the changes on the actual file, but better to do the changes in Xcode to make sure you get the same "kind" of changes, but got all your targets.

I just have the list of changes on GitHub open, and then just fold the files I'm done with. On the side I have my editor and then my git ui. I see a file from github and make the changes in the editor, then make sure the changes are good in git, fold the file and move on.

Does that make sense?

pvinis avatar May 14 '19 07:05 pvinis

@pvinis thanks for the advice. It's the xcode project file that has always tripped me up. So is what you're saying to basically do the change using all the id values in your own project file rather than the ones provided? In examples like this:

ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };

? Thanks

It will have to be your IDs but this sounds like such a horror show (having done it myself). I completely hosed my project a few times during upgrades from 55 to 58. At one point I even switched to a fresh react-native project (in a temp area) with the same name, re-linked everything, and re-built it that way. In the end I think it was the same time but I felt a lot more confident about the fresh one. Food for that, with regards to iOS project strategy

RN0.60 (with auto-linking, and just switching to pods) can't come soon enough...

mikehardy avatar May 19 '19 20:05 mikehardy

Hmm we are also updating from 0.55. That sounds like a nightmare though as our project is huge and has had so much tweaking to native files over the time, but maybe it's better. i think I'd feel more confident too with a new one tbh.

I have been toying around with xcodegen which will make things waaaay easier. After 0.60 I will make it and make a PR. It should be easier, since the autolinking will relieve some of the problems.

pvinis avatar May 20 '19 06:05 pvinis

Thanks. I was all over the place as to what exactly to do

kiranjd avatar Aug 09 '19 09:08 kiranjd

When I update my version gradle build success, but I got an error in runtime. image_2019_09_16T13_51_35_706Z

Can anyone help me?

sg-tbiswas avatar Sep 17 '19 04:09 sg-tbiswas

@sg-tbiswas I don't believe this is related to rn-diff-purge

This looks like you did the update and you generated a build but you did not restart your packager after doing the update. So the new-version build got an old-version javascript bundle from a packager somewhere.

mikehardy avatar Sep 17 '19 13:09 mikehardy

Closing this. We have instructions here https://github.com/react-native-community/upgrade-helper#%EF%B8%8F-how-to-use. This is a pretty old issue too.

pvinis avatar Nov 12 '22 04:11 pvinis