Commit Graph

6 Commits

Author SHA1 Message Date
Nicolas Cuillery 927b356245 Fix react-native-git-upgrade cache busting
Summary:
**Motivation**

This PR fixes #12420.

For the first time, the version 0.41.2 includes a change in the generator (see #12162). The [require cache busting](https://github.com/facebook/react-native/blob/master/react-native-git-upgrade/cliEntry.js#L157-L163) of `react-native-git-upgrade`, designed to face this situation , was ineffective.

The entry in `require.cache` is the file path including the `.js` extension. We have to delete this entry with the same key.

**Test plan**

- Publish `react-native-git-upgrade` to Sinopia,
- Follow the reproduction steps of #12420
- 👉 The name of the app shouldn't be changed
Closes https://github.com/facebook/react-native/pull/12422

Differential Revision: D4585549

Pulled By: mkonicek

fbshipit-source-id: 508ac925c17d02b7739d47f9351a5aa336589f2e
2017-02-18 16:45:50 -08:00
Nicolas Cuillery 1116a59019 Allow binary files to be upgraded
Summary:
`react-native-git-upgrade` doesn't handle the binary files. An error is thrown if the user has changed the default Android icons. See #11402

With this PR, the upgrader would also be ready for the assets optimization: #10408 by GantMan

- Publish `react-native-git-upgrade` to sinopia
- `npm install -g react-native-git-upgrade`

- Init a new project with an old version: `react-native init MyApp --version=0.40.0`
- Replace an Android icon (i.e. `MyApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png`) by any other image file.
- Change the content of a text file.
- Run `react-native-git-upgrade`

👉 The project is upgraded successfully.
👉 The replaced image file is still here.
👉 The text change is still here.

- Replace an Android icon in the RN sources (i.e. https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/android/app/src/mai
Closes https://github.com/facebook/react-native/pull/12201

Differential Revision: D4543190

Pulled By: mkonicek

fbshipit-source-id: f1df32ee064557220deed717a129c3e175a6e9e2
2017-02-10 07:30:44 -08:00
Jirat K 1877e1b1d1 Fix react-native-git-upgrade by get package.json instead of selective field
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

To fixes #11330 and fixes #11334

Regarding to this command (using in `react-native-git-upgrade` - [cliEntry.js#L261](https://github.com/facebook/react-native/blob/master/react-native-git-upgrade/cliEntry.js#L261))
```bash
npm view react-native@latest peerDependencies.react version --json
```
The result from this command are not consistent across a different npm versions.

We better get a whole `package.json` file by calling (remove field and subfield option)

```
npm view react-native@latest  --json
```

**Test plan (required)**

**Setup**
- Publish `react-native-git-upgrade` to `sinopia`
- `npm install -g react-native-git-upgrade`
- Test against multiple npm versions (`2.15.8` or `3.7.5` or `3.10.10` or ` 4.0.3`)
- `react-native init AwesomeApp  --version 0.38.0 && cd AwesomeApp`
- `react-native-git-upgrade` and `react-native-git-upgrade 0.39.0` should be working properly

 ---
Closes https://github.com/facebook/react-native/pull/11348

Differential Revision: D4305894

Pulled By: mkonicek

fbshipit-source-id: 36ea7846926b424f4dd63c77b47db5cb69285027
2016-12-09 07:58:34 -08:00
Martin Konicek bf55df15db Git upgrade: Tweak wording
Reviewed By: mkonicek

Differential Revision:
D4276739
Ninja: OSS

fbshipit-source-id: 7480a3ee77ed8f6ab0d35f92b43a806bfe29a151
2016-12-05 06:28:34 -08:00
Martin Konicek f0490d67ff Git upgrade: Tweak README, bump version, fix a bug
Reviewed By: mkonicek

Differential Revision:
D4276644
Ninja: OSS only

fbshipit-source-id: 7bed331770d06addedf51e2ed09d0b9bde5b45ad
2016-12-05 05:58:29 -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