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

Fix for 17497 #17498

Closed
wants to merge 9 commits into from
Closed

Fix for 17497 #17498

wants to merge 9 commits into from

Conversation

ihenshaw
Copy link
Contributor

@ihenshaw ihenshaw commented Jan 9, 2018

Changed runAndroid.js to generate .packager.bat and launchPackager.ba…t to call it to setup the environment variable

Motivation

Trying to use react-native on a Windows box with a virus killer that runs on port 8081...

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

  1. Start an android emulator
  2. on a react-native project (with the changes), run react-native run-android --port 9988.
  3. When the packager starts, verify that it states the correct port in the terminal window.
  4. verify that the application correctly starts in the Emulator.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

Release Notes

[INTERNAL] [BUGFIX] [./scripts] - Fixed runAndroid to enable the use of a package on port <> 8081 for Windows.

…t to call it to setup the environment variable
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. cla signed labels Jan 9, 2018
@@ -263,17 +263,18 @@ function runOnAllDevices(args, cmd, packageNameWithSuffix, packageName, adbPath)
}

function startServerInNewWindow(port) {
const scriptFile = /^win/.test(process.platform) ?
const isWin = /^win/.test(process.platform);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, don't use abbreviations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed isWin to isWindows everywhere where it's necessary.

// setup the .packager.env file to ensure the packager starts on the right port
const packagerEnvFile = path.join(__dirname, '..', '..', 'scripts', '.packager.env');
const content = `export RCT_METRO_PORT=${port}`;
// setup the .packager.(env|bat) file to ensure the packager starts on the right port
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we decouple file names and command names into separate variables/constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you want here? are you looking for new const variables, one for .packager.bat and one for .packager.env?

I'd have preferred to use just a single filename, unfortunately, Windows doesn't have a source .env equivalent, you can get the same result by using a batch file, but the batch files must have a .bat extension to be invoked with call from the parent script...

@facebook-github-bot
Copy link
Contributor

@ihenshaw I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@sdwilsh sdwilsh removed the cla signed label Mar 1, 2018
@react-native-bot react-native-bot added Bug Fix 🐛 Ran Commands One of our bots successfully processed a command. labels Mar 16, 2018
@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 Jun 28, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
Summary:
Changed runAndroid.js to generate .packager.bat and launchPackager.ba…t to call it to setup the environment variable

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Trying to use react-native on a Windows box with a virus killer that runs on port 8081...

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
1) Start an android emulator
2) on a react-native project (with the changes), run `react-native run-android --port 9988`.
3) When the packager starts, verify that it states the correct port in the terminal window.
4) verify that the application correctly starts in the Emulator.

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[INTERNAL] [BUGFIX] [./scripts] - Fixed runAndroid to enable the use of a package on port <> 8081 for Windows.
Closes facebook/react-native#17498

Differential Revision: D8682067

Pulled By: hramos

fbshipit-source-id: 6604b827077b3a6a2da9914c1fd36dad6ef30e43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 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. Ran Commands One of our bots successfully processed a command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants