Commit Graph

3 Commits

Author SHA1 Message Date
Martin Konicek 6bee16a63d Use Yarn if available
Summary:
**Motivation**

If the project is using yarn to manage its dependencies, we should be running 'yarn add' to upgrade the React Native dependency, rather than 'npm install'.

**Test plan (required)**

Running in a project that's in a bad state:

    Error: react-native version in "package.json" (0.29.2) doesn't match the installed version in "node_modules" (0.38.0).
    Try running "yarn" to fix this.

Removed yarn.lock file, ran again:

    Error: react-native version in "package.json" (0.29.2) doesn't match the installed version in "node_modules" (0.38.0).
    Try running "npm install" to fix this.

Running inside a folder that doesn't contain a `package.json` file:

    Error: Unable to find "/Users/mkonicek/Zero29App/package.json" or "/Users/mkonicek/Zero29App/node_modules/react-native/package.json". Make sure you ran "yarn" and that you are inside a React Native project.

Removed yarn.lock file, ran again:

    Error: Unable to find "/Users/mkonicek/Zero29App/package.json" or "/Users/
Closes https://github.com/facebook/react-native/pull/11225

Differential Revision: D4261102

Pulled By: mkonicek

fbshipit-source-id: b44ae91fe46f2c81b14616ca2868cc171692c895
2016-12-02 00:13:32 -08:00
Martin Konicek be559d9760 Small wording and naming changes
Summary:
Just some small changes that made the core easier for me to understand as I went through it.

**Test plan (required)**

    $ cd react-native
    # "Install globally" without using Sinopia :)
    $ cp -r react-native-git-upgrade /usr/local/lib/node_modules/

    $ cd ~
    $ react-native init Zero29App --version=0.29.2
    $ cd Zero29App

Made a small change in `MainApplication.java` to introduce a conflict with the new template.

    $ git init && git add . && git commit -m "Initial commit"
    $ react-native-git-upgrade

Worked, printed the conflicting file. Output: http://pastie.org/10972793

    $ git reset --hard
    $ react-native-git-upgrade --verbose

Worked, printed the conflicting file. Output: http://pastie.org/10972796

In both cases (with and without --verbose) the output of `git st` was http://pastie.org/10972795
Closes https://github.com/facebook/react-native/pull/11197

Differential Revision: D4251008

Pulled By: mkonicek

fbshipit-source-id: c5bbbeaf996cb5cb46cccc12fd1da7634cc23520
2016-11-30 08:28:33 -08:00
Nicolas Cuillery 7d89b773a7 New upgrading process, relying on Git
Summary:
The upgrading process based on Yeoman is a pain. For each file, Yeoman (or the brand new copyAndReplace solution a477aec) compares the newly generated content with the existing one and prompts the user if it differs, with very basic options: overwrite or skip.

I have digged into this problem and came with [rn-diff](https://github.com/ncuillery/rn-diff) (you may have read [this article](https://medium.com/ncuillery/easier-react-native-upgrades-with-rn-diff-5020b5c3de2d#.llvy2dym5)). This repository helps people to upgrade RN on their projects. An alternative upgrading process using `git apply` instead of Yeoman is described [here](https://github.com/ncuillery/rn-diff/blob/master/USAGE.md).

This PR is the integration of this process into the core. I got rid of the drawbacks mentioned in the link below in order to make it a clean, elegant, one-step operation.

This process is based on some Shell operations that:
- Generate the blank sources of both old and new versions
Closes https://github.com/facebook/react-native/pull/11110

Differential Revision: D4237107

Pulled By: mkonicek

fbshipit-source-id: 15e82e030b762415c925ccb2a62ddb354a6e18b9
2016-11-28 08:28:35 -08:00