diff --git a/blog/2016/12/05/easy-upgrades-processed-by-git.html b/blog/2016/12/05/easy-upgrades-processed-by-git.html new file mode 100644 index 00000000000..23e17454c0f --- /dev/null +++ b/blog/2016/12/05/easy-upgrades-processed-by-git.html @@ -0,0 +1,54 @@ +Easy upgrades, relying on Git
React Native Blog
Stay up-to-date with the latest React Native news and events.

Easy upgrades, relying on Git

Each release of React Native may come with changes inside the iOS and Android sub-projects that you have to report in your project. This synchronisation has always been a major pain point because of the poor changes detection within your source files. Today, I'm proud to announce a new upgrading process relying on the most popular version control system: Git.

The key concept in this operation is the generation of a Git patch that contains all the changes required by React Native from your current version to the requested one.

To obtain this patch, we need to generate the iOS and Android apps from the templates embedded in the react-native package inside your node_modules directory, exactly like the init and upgrade commands do. Then, after the native apps have been computed from the templates in both current version and requested versions, Git is be able to produce a patch that is completely adapted to your project (i.e. with your app name):

[...] + +diff --git a/ios/MyAwesomeApp/Info.plist b/ios/MyAwesomeApp/Info.plist +index e98ebb0..2fb6a11 100644 +--- a/ios/MyAwesomeApp/Info.plist ++++ b/ios/MyAwesomeApp/Info.plist +@@ -45,7 +45,7 @@ + <dict> + <key>localhost</key> + <dict> +- <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> ++ <key>NSExceptionAllowsInsecureHTTPLoads</key> + <true/> + </dict> + </dict> + +[...]

All we need now is to apply this patch on your current source files. While the old process would have prompted you for any difference (even from a single character), Git is able to merge most of the changes automatically, fallback on a 3-way merge and eventually leave familiar conflict delimiters:

13B07F951A680F5B00A75B9A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; +<<<<<<< ours + CODE_SIGN_IDENTITY = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/HockeySDK.embeddedframework", + "$(PROJECT_DIR)/HockeySDK-iOS/HockeySDK.embeddedframework", + ); +======= + CURRENT_PROJECT_VERSION = 1; +>>>>>>> theirs + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../node_modules/react-native/React/**", + "$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**", + );

These conflicts are generally easy to reason about. The delimiter ours actually stands for "your team" whereas their could be seen as "the React Native team".

Usage #

As I mentioned in the Upgrading guide, the most important change concerns the automatic installation of the new react-native package.

You should not install the new react-native package by yourself, the upgrading process needs to be initiated on your current version of React Native. Otherwise, the current and requested versions would be the same, Git would produce an empty patch and the upgrade would be ineffective.

Install the react-native-git-upgrade package globally:

$ npm install -g react-native-git-upgrade

Then, run the react-native-git-upgrade command with an optional version (latest if not specified) inside your project directory:

Git needs to be available in the PATH.

Note that this new upgrade method aims at preserving your changes in your native files, so you don't need to run react-native link after an upgrade.

I have designed the implementation to be as less intrusive as possible. It is entirely based on a local Git repository created on-the-fly in the system temporary directory. It won't interfere with your project repository (no matter the VCS you use: Git, SVN, Mercurial, ... or none). Your sources are restored in case of unexpected errors.

Why a separated package ? #

React Native comes with a global CLI (the react-native-cli package) which delegates the command to the local CLI embedded in the node_modules/react-native/local-cli directory.

As I mentioned above, the process has to be started upon your current React Native version. If we had embedded the implementation in the local-cli, you wouldn't have been able to enjoy this feature until the upcoming React Native release was in use on your project.

This Git upgrading feature is a huge improvement in developer experience and I really wanted it to be available for any users including those who are stuck in old versions of React Native (who said 0.28 ?) because of the painful upgrading process. That's why we came with the react-native-git-upgrade package, installed globally, no matter the version of React Native being used.

An other reason is the recent Yeoman wipeout by Martin Konicek. We didn't want to get these Yeoman dependencies back into the react-native package !

About the future #

The standalone package is a temporary situation for a few months, it would probably never see the 1.0.0 release: when most users will have migrated their projects to the post-Yeoman era using this package, it will replace the actual react-native upgrade and the global package react-native-git-upgrade will be deprecated.

As a conclusion, I would say, enjoy the feature and feel free to suggest improvements, report issues and send pull requests. Each user has its own runtime environment, each React Native project is different, so we need you to make this process completely reliable and universal !

\ No newline at end of file diff --git a/blog/feed.xml b/blog/feed.xml index 8716e43d755..3c2e277c92e 100644 --- a/blog/feed.xml +++ b/blog/feed.xml @@ -2,12 +2,24 @@ https://facebook.github.io/react-native/blog/ React Native Blog - 2016-11-08T00:00:00Z + 2016-12-05T00:00:00Z The best place to stay up-to-date with the latest React Native news and events. https://facebook.github.io/react-native/img/header_logo.png Copyright © 2016 Facebook Inc. Feed for Node.js + + <![CDATA[Easy upgrades, relying on Git]]> + https://facebook.github.io/react-native/blog/2016/12/05/easy-upgrades-processed-by-git.html + + + 2016-12-05T00:00:00Z + + + Nicolas Cuillery + https://twitter.com/ncuillery + + <![CDATA[Introducing Button, Faster Installs with Yarn, and a Public Roadmap]]> https://facebook.github.io/react-native/blog/2016/11/08/introducing-button-yarn-and-a-public-roadmap.html diff --git a/blog/img/git-upgrade-output.png b/blog/img/git-upgrade-output.png new file mode 100644 index 00000000000..147596ecde3 Binary files /dev/null and b/blog/img/git-upgrade-output.png differ diff --git a/blog/index.html b/blog/index.html index 77fd2fcfa2a..f055b049583 100644 --- a/blog/index.html +++ b/blog/index.html @@ -1,4 +1,4 @@ -React Native Blog
React Native Blog
Stay up-to-date with the latest React Native news and events.

San Francisco Meetup Recap

Last week I had the opportunity to attend the React Native Meetup at Zynga’s San Francisco office. With around 200 people in attendance, it served as a great place to meet other developers near me that are also interested in React Native.

Toward Better Documentation

Part of having a great developer experience is having great documentation. A lot goes into creating good docs - the ideal documentation is concise, helpful, accurate, complete, and delightful. Recently we've been working hard to make the docs better based on your feedback, and we wanted to share some of the improvements we've made.

Introducing Hot Reloading

React Native's goal is to give you the best possible developer experience. A big part of it is the time it takes between you save a file and be able to see the changes. Our goal is to get this feedback loop to be under 1 second, even as your app grows.

React Native Blog
Stay up-to-date with the latest React Native news and events.

Easy upgrades, relying on Git

Each release of React Native may come with changes inside the iOS and Android sub-projects that you have to report in your project. This synchronisation has always been a major pain point because of the poor changes detection within your source files. Today, I'm proud to announce a new upgrading process relying on the most popular version control system: Git.

San Francisco Meetup Recap

Last week I had the opportunity to attend the React Native Meetup at Zynga’s San Francisco office. With around 200 people in attendance, it served as a great place to meet other developers near me that are also interested in React Native.

Toward Better Documentation

Part of having a great developer experience is having great documentation. A lot goes into creating good docs - the ideal documentation is concise, helpful, accurate, complete, and delightful. Recently we've been working hard to make the docs better based on your feedback, and we wanted to share some of the improvements we've made.

Introducing Hot Reloading

React Native's goal is to give you the best possible developer experience. A big part of it is the time it takes between you save a file and be able to see the changes. Our goal is to get this feedback loop to be under 1 second, even as your app grows.