I've been developing with react-native for over a year now and I love it.
The only major issue with it for me is the state of running react-native upgrade.
It only seems to work if you're using a blank project or a very simple one. You start doing any serious work on a project and it may as well not exist.
I thought I'd give it another try to upgrade to 0.62 rc 2 since I wanna give Flipper a try.
Here's the output
warn Excluding files that exist in the template, but not in your project:
- App.js
- ios/appname.xcodeproj/xcshareddata/xcschemes/appname-tvOS.xcscheme
error Excluding files that failed to apply the diff:
- .gitignore
- android/app/build.gradle
- android/app/src/main/AndroidManifest.xml
- android/app/src/main/java/com/appname/MainApplication.java
- android/build.gradle
- android/gradle.properties
- android/gradle/wrapper/gradle-wrapper.properties
- android/gradlew
- android/gradlew.bat
- ios/Podfile
- ios/appname.xcodeproj/project.pbxproj
- ios/appname.xcodeproj/xcshareddata/xcschemes/appname.xcscheme
- ios/appname/AppDelegate.m
- ios/appnameTests/appnameTests.m
Wow. So helpful lmao.
Sarcasm aside and I know this is a very tough task -- but is there anyway to realistically improve this tool? My project setup is pretty standard with a modest amount of dependencies.
As the the last year or so have went on it's went from a couple files needing manual updates (mostly the podfile) to sometimes all of the files needing manual updates.
Just wanted to throw this out here as a issue and see if anyone else is having trouble. Could there be something I am doing wrong?
Thanks for reporting!
As a first step I've added this to our issue tracking the Flipper integration #27565
@bobber205 I've never managed to get it to work except with a blank project so you're not alone :man_shrugging:
Best option for upgrading is semi-manually via https://react-native-community.github.io/upgrade-helper/ - 90% of the time it's really helpful. It sometimes has some issues with stuff like incorrectly telling you to downgrade dependencies or remove files where changes have been made on a release branch of this repo and not cherry-picked back to master before the next release branch is cut. Feels like there should be a better process around those kind of changes but other than that the technique itself is pretty solid (diffing two new apps created with the two versions you're trying to upgrade between)
馃憢 @bobber205!
So, first off I would like to check with you that you are using the correct react-native upgrade command - because there is a likely chance that you are still using the old react-native CLI which was embedded in the main repo - it was extracted to its own repo -> https://github.com/react-native-community/cli (yes, it's a bit confusing sadly 馃槗)
Currently the new react-native CLI is at v3, and I think you should be able to check which version you are using via react-native -v (or react-native --version? Can't really recall). As a rule of thumb, if you installed the cli via npm install -g react-native-cli you are using the old version (because of limitations of npm we can't remove packages that are already published AFAIK).
My guts would tell me that if you are trying to upgrade from v0.61 and you do yarn react-native upgrade instead the result may be slightly different.
All of that said, that command in itself is quite complicated to use because of the many changes that land between version, which is why we usually recommend (in particular for RC versions) to do manual upgrades with the help of upgrade-helper, as @mjmasn wrote above.
Last thing - I quickly glanced in the issue section of the dedicated repo and it seems that the upgrade command is not quite perfect yet (https://github.com/react-native-community/cli/issues/926).
What I would recommend is that you check your version of the CLI, try again, then if you are still having issues/ finding bugs you open a new issue in the new repo and close this one.
馃憢 @bobber205!
So, first off I would like to check with you that you are using the correct
react-native upgradecommand - because there is a likely chance that you are still using the oldreact-nativeCLI which was embedded in the main repo - it was extracted to its own repo -> https://github.com/react-native-community/cli (yes, it's a bit confusing sadly 馃槗)Currently the new
react-nativeCLI is at v3, and I think you should be able to check which version you are using viareact-native -v(orreact-native --version? Can't really recall). As a rule of thumb, if you installed the cli vianpm install -g react-native-cliyou are using the old version (because of limitations of npm we can't remove packages that are already published AFAIK).My guts would tell me that if you are trying to upgrade from v0.61 and you do
yarn react-native upgradeinstead the result may be slightly different.All of that said, that command in itself is quite complicated to use because of the many changes that land between version, which is why we usually recommend (in particular for RC versions) to do manual upgrades with the help of upgrade-helper, as @mjmasn wrote above.
Last thing - I quickly glanced in the issue section of the dedicated repo and it seems that the upgrade command is not quite perfect yet (react-native-community/cli#926).
What I would recommend is that you check your version of the CLI, try again, then if you are still having issues/ finding bugs you open a new issue in the new repo and close this one.
Thanks for the reply!
I think last summer I did the big upgrade to 0.60 (whenever it was) and when I had to go from using react-native to running yarn run react-native
yarn run react-native --version says I am running 3.0.4
It makes me feel better than it's not working well for most people and that improvements might arrive someday. I wish I had the time to contribute :(
Anyway thanks for the responses!
Thanks for all the responses here! I'll go ahead and close this since it's not tracking a specific bug.
Most helpful comment
@bobber205 I've never managed to get it to work except with a blank project so you're not alone :man_shrugging:
Best option for upgrading is semi-manually via https://react-native-community.github.io/upgrade-helper/ - 90% of the time it's really helpful. It sometimes has some issues with stuff like incorrectly telling you to downgrade dependencies or remove files where changes have been made on a release branch of this repo and not cherry-picked back to master before the next release branch is cut. Feels like there should be a better process around those kind of changes but other than that the technique itself is pretty solid (diffing two new apps created with the two versions you're trying to upgrade between)