Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eject CLI command to re-create native folders #12162

Closed
wants to merge 1 commit into from
Closed

Conversation

ericvicenti
Copy link
Contributor

The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

New Functionality

Now it will be possible to:

  1. Remove the native iOS or Android folders
  2. Create an app.json for your app, with at least a name and displayName
  3. Run react-native eject, and the native code for your app will be generated

Then, as usual, you can run react-native run-ios and react-native run-android, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the ios and android folders from version control.

Test Plan

Eject step tested in RN app by deleting native folders.

@mkonicek, what is the best way to test react-native init?

Followup

As follow-up items, we can enable the following:

  • Configuring app icon and launch screen from the app.json
  • Automatically run react-native link for native libraries
  • Allow app.json to configure app linking
  • Allow react-native run-[android/ios] to work without any ios or android folder at all
  • Run your app in Exponent, without ejecting

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Feb 2, 2017
@mkonicek
Copy link
Contributor

mkonicek commented Feb 2, 2017

Nice! 👍

To test 'react-native init', see https://github.com/facebook/react-native/blob/master/react-native-cli/README.md

const path = require('path');
const fs = require('fs');

function eject() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some comment explaining what this does? People reading this code won't see the commit message from this pull request.


const doesIOSExist = fs.existsSync(path.resolve('ios'));
const doesAndroidExist = fs.existsSync(path.resolve('android'));
if (doesIOSExist && doesAndroidExist) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if just one exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we don't want to show this error because maybe the user just wants to generate one

function eject() {

const doesIOSExist = fs.existsSync(path.resolve('ios'));
const doesAndroidExist = fs.existsSync(path.resolve('android'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: doesIOSFolderExist, doesAndroidFolderExist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

try {
appConfig = require(path.resolve('app.json'));
} catch(e) {
console.error('Eject requires an `app.json` config file to be located in your app root, and it must at least specify a `name` and a `displayName`.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in your app root directory.

It would also be very helpful to print the absolute path (path.resolve('app.json')) as part of the error message to make it clear what you mean by app root directory.

appConfig = require(path.resolve('app.json'));
} catch(e) {
console.error('Eject requires an `app.json` config file to be located in your app root, and it must at least specify a `name` and a `displayName`.');
process.exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the error code? Should not be 0?

const appName = appConfig.name;
const displayName = appConfig.displayName;
if (!appName || !displayName) {
console.error('App `name` and `displayName` must be defined in the `app.json` config file.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider explaining in this message what name and displayName are - if they are missing I get this message and want to fill them in. I understand an app needs a name but have no idea what a displayName is - is it a label displayed under the icon on my home screen? Not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll explain that in the error message

const displayName = appConfig.displayName;
if (!appName || !displayName) {
console.error('App `name` and `displayName` must be defined in the `app.json` config file.');
process.exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exit code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, will put error code 1

process.exit();
}

const templateOptions = { displayName };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this { displayName: displayName }? I always get confused by this syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@@ -57,6 +57,7 @@ function copyProjectTemplateAndReplace(srcPath, destPath, newProjectName, option
absoluteSrcFilePath,
path.resolve(destPath, relativeRenamedPath),
{
'Hello App Name': options.displayName || newProjectName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok nice

@@ -0,0 +1,4 @@
{
"name": "HelloWorld",
"displayName": "HelloWorld"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "Hello World"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because this is generated in the init step, where the name is all that exists.

@@ -1,3 +1,3 @@
<resources>
<string name="app_name">HelloWorld</string>
<string name="app_name">Hello App Name</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better use "Hello World"? Is this what's displayed on the home screen? I wouldn't get what "Hello App Name" means.

@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Hello App Name</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "Hello World"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the display name so I wanted to make the replacement string very obvious. I'll rename it to "Hello App Display Name"

@mkonicek
Copy link
Contributor

mkonicek commented Feb 2, 2017

What is the difference between name and displayName? Where is display name used? Is that the label on the home screen?

Will docs for eject come in a separate PR? Probably deserves a new CRNA Guide on the website.

@mkonicek
Copy link
Contributor

mkonicek commented Feb 3, 2017

@ericvicenti Feel free to merge this yourself once you check my comments (feel free to address those you agree with, this PR looks pretty good!).

You can do that using (at)facebook-github-bot shipit-ninja.

@ericvicenti
Copy link
Contributor Author

@facebook-github-bot shipit-ninja

@facebook-github-bot
Copy link
Contributor

Normally, ericvicenti, someone else should review and ship your pull request. However, we will trust that you know what you are doing. Shipping!

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 3, 2017
@facebook-github-bot
Copy link
Contributor

@ericvicenti has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

ide pushed a commit that referenced this pull request Feb 6, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes #12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
edmofro pushed a commit to edmofro/react-native that referenced this pull request Feb 6, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 7, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
normanjoyner pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
nicktate pushed a commit to nicktate/react-native that referenced this pull request Feb 9, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
@ncuillery
Copy link
Contributor

ncuillery commented Feb 16, 2017

I'm a bit late to share my thoughts about this feature, I hope it could help for the future work on this.

If I understand well, it's an alternative way to upgrade the host apps of a RN project (i.e. the ios and android directories).

The upgrade command and react-native-git-upgrade consist in merging the user changes with the RN changes, whereas the eject command resets the host apps from the template of the new version (including RN changes), and the user is supposed to restore his changes by running the link command afterward. Am I right ?

This process (eject followed by link) makes upgrades easier if the user changes can be completely written by the link command.

My point is: we already could do the same by running react-native upgrade and answering "Yes" to any changed file ( 👉 the existing file is overrided by the template file).

Is the eject command doing something else ?

@grabbou
Copy link
Contributor

grabbou commented Feb 17, 2017

@ncuillery it is similar to create-react-app and it's being used in create-react-native-app. This has nothing to do with upgrading itself as far as I understand.

Also, it's not related to my prior work with upgrade tools, haven't finished that yet, but might start once again soon :)

facebook-github-bot pushed a commit that referenced this pull request Feb 19, 2017
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 #12422

Differential Revision: D4585549

Pulled By: mkonicek

fbshipit-source-id: 508ac925c17d02b7739d47f9351a5aa336589f2e
GaborWnuk pushed a commit to GaborWnuk/react-native that referenced this pull request Feb 28, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
GaborWnuk pushed a commit to GaborWnuk/react-native that referenced this pull request Feb 28, 2017
Summary:
**Motivation**

This PR fixes facebook#12420.

For the first time, the version 0.41.2 includes a change in the generator (see facebook#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 facebook#12420
- 👉 The name of the app shouldn't be changed
Closes facebook#12422

Differential Revision: D4585549

Pulled By: mkonicek

fbshipit-source-id: 508ac925c17d02b7739d47f9351a5aa336589f2e
dudeinthemirror pushed a commit to dudeinthemirror/react-native that referenced this pull request Mar 1, 2017
Summary:
**Motivation**

This PR fixes facebook#12420.

For the first time, the version 0.41.2 includes a change in the generator (see facebook#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 facebook#12420
- 👉 The name of the app shouldn't be changed
Closes facebook#12422

Differential Revision: D4585549

Pulled By: mkonicek

fbshipit-source-id: 508ac925c17d02b7739d47f9351a5aa336589f2e
dudeinthemirror pushed a commit to dudeinthemirror/react-native that referenced this pull request Mar 1, 2017
Summary:
**Motivation**

This PR fixes facebook#12420.

For the first time, the version 0.41.2 includes a change in the generator (see facebook#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 facebook#12420
- 👉 The name of the app shouldn't be changed
Closes facebook#12422

Differential Revision: D4585549

Pulled By: mkonicek

fbshipit-source-id: 508ac925c17d02b7739d47f9351a5aa336589f2e
ericvicenti pushed a commit to ericvicenti/react-native that referenced this pull request Mar 16, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
ide pushed a commit that referenced this pull request Mar 18, 2017
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes #12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
@javache javache deleted the rn-eject branch April 19, 2017 17:34
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
The iOS and Android native folders of a React Native app can be difficult to maintain. This introduces a new workflow for creating and maintaining the native code of your app.

Now it will be possible to:

1. Remove the native iOS or Android folders
2. Create an `app.json` for your app, with at least a `name` and `displayName`
3. Run `react-native eject`, and the native code for your app will be generated

Then, as usual, you can run `react-native run-ios` and `react-native run-android`, to build and launch your app

For apps that don't have any native code, it will be possible to ignore the `ios` and `android` folders from version control.

Eject step tested in RN app by deleting native folders.

mkonicek, what is the best way to test `react-native init`?

As follow-up items, we can enable the following:

- Configuring app icon and launch screen from the `app.json`
- Automatically run `react-native link` for native libraries
- A
Closes facebook/react-native#12162

Differential Revision: D4509138

Pulled By: ericvicenti

fbshipit-source-id: 0ee213e68f0a3d44bfce337e3ec43e5024bacc66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants