Summary:
The pull request adds the `--port` option to `run-ios` allowing a developer to build and launch a react-native app using a single command line like this:
```
react-native run-ios --port 8088
```
It defaults to the current port 8081.
This pull request fixes issue #9145 and issue #14113.
This patch also extends `run-android` to properly test and launch the packager with the specified port, extending the work done in PR: ##15316
1. Create a new react-native app, or simply clone this branch and then update your version of react-native using `yarn add file:./path/to/this/fork/of/react-native`
2. run `react-native run-ios --port 8088`
3. watch the packager start on the desired port (8088 in this case) and watch your app in your simulator connect to the packager and launch the app.
Closes https://github.com/facebook/react-native/pull/16172
Differential Revision: D6612534
Pulled By: shergin
fbshipit-source-id: 50af449f5e4c32fb76ba95f4cb7bf179e35526d5
Summary:
grabbou: "This has been recently added to Node 8.x. Since it makes our tests to fail, I decided to
do a workaround that works for all the versions."
Originally patched in `0.52-stable` by grabbou
Fixes Node 6 JavaScript tests.
Closes https://github.com/facebook/react-native/pull/17298
Differential Revision: D6616521
Pulled By: hramos
fbshipit-source-id: 7256450d824a60a14006af7a68191222b3a5041a
Summary:
This was introduced as part of a codemod a few months back. Hopefully this edit makes the example code clearer.
Closes https://github.com/facebook/react-native/pull/17189
Differential Revision: D6613378
Pulled By: hramos
fbshipit-source-id: da7263b3ce2b5c45d6e312807c88743fe10cd15d
Summary:
Fixes the Flow failure due to an undefined Ast type.
Before:
```
$ npm run flow -- check
> react-native@1000.0.0 flow /Users/hramos/git/react-native
> flow "check"
Error: local-cli/__tests__/fs-mock-test.js:27
27: beforeEach(() => {
^^^^^^^^^^ beforeEach. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:53
53: expect(content).toEqual('beep');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:88
88: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:100
100: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: node_modules/metro/src/Bundler/util.js.flow:46
46: ): Ast {
^^^ Ast. Could not resolve name
Error: node_modules/metro/src/ModuleGraph/worker/collect-dependencies.js.flow:283
283: const xp = (module.exports = (ast: Ast) =>
^^^ Ast. Could not resolve name
Error: node_modules/metro/src/assetTransformer.js.flow:29
29: ): Promise<{ast: Ast}> {
^^^ Ast. Could not resolve name
```
After
```
$ npm run flow -- check
> react-native@1000.0.0 flow /Users/hramos/git/react-native
> flow "check"
Error: local-cli/__tests__/fs-mock-test.js:27
27: beforeEach(() => {
^^^^^^^^^^ beforeEach. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:53
53: expect(content).toEqual('beep');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:88
88: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:100
100: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
```
[ GENERAL ] [ BUGFIX] [ .flowconfig ] - Have Flow ignore Metro node_nodules
Closes https://github.com/facebook/react-native/pull/17187
Differential Revision: D6572303
Pulled By: hramos
fbshipit-source-id: aa256b9725970fcc2a6da6578c83e7c0875e3cfd
Summary:
<!--
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!
-->
The react-native local-cli does a check to see if it is being run from a global install or not. If running from a global install, an error is printed and the CLI exits.
This check for a global install does not work on Windows. The check of `process.argv` does not contain the expected `node_modules/.bin/react-native`. It instead contains a direct path to the `wrong-react-native.js` file, as determined by the `node_modules/.bin/react-native.cmd` entry point.
This update will, on Windows platforms, do a global check by instead looking for the existence of a package.json above the node_modules. If not found, we assume a global install and print the error.
In a react-native project, I originally tried running the local react-native cli:
```
> yarn react-native --version
yarn run v1.3.2
$ E:\myproject\node_modules\.bin\react-native --version
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
I replaced the `wrong-react-native.js` with the modified version and reran the command:
```
> yarn react-native --version
yarn run v1.3.2
$ E:\myproject\node_modules\.bin\react-native --version
Scanning folders for symlinks in E:\myproject\node_modules (93ms)
0.50.3
Done in 1.86s.
```
<!--
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
-->
[CLI] [BUGFIX] [local-cli/wrong-react-native.js] - Updated local-cli on Windows to check for the absence of a package.json file to determine if being run from a global installation or not.
Closes https://github.com/facebook/react-native/pull/17036
Differential Revision: D6471925
Pulled By: TheSavior
fbshipit-source-id: cc5560d1c102d05f378e5ae537f13d31b5343045
Summary:
`metro-bundler` v0.21 contains a rewritten bundling mechanism, with simplified logic and much faster rebuild times, called delta bundler. This release contains a couple of breaking changes:
* Now, when using a custom transformer, the list of additional babel plugins to apply are passed to the `transform()` method. These are used in non-dev mode for optimization purposes (Check 367a5f5db8 (diff-40653f0c822ac59a5af13d5b4ab31d84) to see how to handle them from the transformer).
* Now, when using a custom transformer outputting `rawMappings`, the transformer does not need to call the `compactMappings` method before returning (check d74685fd1d (diff-40653f0c822ac59a5af13d5b4ab31d84) for more info).
* We've removed support for two config parameters: `postProcessModules` and `postProcessBundleSourcemap`.
Reviewed By: davidaurelio
Differential Revision: D6186035
fbshipit-source-id: 242c5c2a954c6b9b6f339d345f888eaa44704579
Summary:
On Ubuntu (and maybe other distros), the executable for the chromium browser is 'chromium-browser' instead of 'chromium'.
This commit calls 'chromium-browser' before calling 'chromium' if it exists.
Start an example app on Android with "react-native init project && react-native run-android". Open DevTools: it opens chromium correctly.
[CLI] [BUGFIX] [local-cli/server/utils/launchChrome.js] - Fix launchChrome for chromium on Ubuntu
Closes https://github.com/facebook/react-native/pull/16658
Differential Revision: D6241686
Pulled By: hramos
fbshipit-source-id: 5cd435c3c42c29f0916679298e62e7a323468e37
Summary:
The core React Native codebase already has full support for CocoaPods. However, `react-native link` doesn’t play nicely with CocoaPods, so installing third-party libs from the RN ecosystem is really hard.
This change will allow to link projects that contains its own `.podspec` file to CocoaPods-based projects. In case `link` detect `Podfile` in `iOS` directory, it will look for related `.podspec` file in linked project directory, and add it to `Podfile`. If `Podfile` and `.podspec` files are not present, it will fall back to previous implementation.
**Test Plan**
1. Build a React Native project where the iOS part uses CocoaPods to manage its dependencies. The most common scenario here is to have React Native be a Pod dependency, among others.
2. Install a RN-related library, that contains `.podspec` file, with `react-native link` (as an example it could be: [react-native-maps](https://github.com/airbnb/react-native-maps)
3. Building the resulting iOS workspace should succeed (and there should be new entry in `Podfile`)
Closes https://github.com/facebook/react-native/pull/15460
Differential Revision: D6078649
Pulled By: hramos
fbshipit-source-id: 9651085875892fd66299563ca0e42fb2bcc00825
Summary:
Thanks for submitting a PR! Please read these instructions carefully:
- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.
<!-- What existing problem does the pull request solve? -->
Indentation of package.json including Jest is a hard tab. Since package.json generated by npm has two spaces, I want to make it the same.
<!--
A good test plan has the exact commands you ran and their output, provides screenshots or videos if t[he pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.
If you have added code that should be tested, add tests.
-->
![package.json diff](https://cloud.githubusercontent.com/assets/12539/24228268/80421416-0fb6-11e7-9af3-d034c1756379.png)
Sign the [CLA][2], if you haven't already.
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.
For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.
[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13099
Differential Revision: D4770208
Pulled By: ericnakagawa
fbshipit-source-id: 13f91068e40610473cd7b65e182a0fdc59af03ba
Summary:
- [x] Explain the **motivation** for making this change.
It fixes#14313
Closes https://github.com/facebook/react-native/pull/14495
Differential Revision: D6042094
Pulled By: hramos
fbshipit-source-id: d70e42bfee0a22882bad91cb885fb0cfc91c7d38
Summary: When we built packager asset system we were mostly concerned about images. However, this system can also be used to work with videos, animations and other binary resources. The code that sorts assets into Android resource folders currently just shoves all non-drawable resources under `drawable-mdpi`, which is not ideal. Talking to Android experts on the team, `raw` seems like a much better place for other resources.
Reviewed By: jeanlauliac
Differential Revision: D6026633
fbshipit-source-id: cc2199f60da411ea432972a02f52c459ff5c490a
Summary:
This is first PR from the series I am going to be sending as a result of fixing 0.50-stable test suite. This one removes `mockFS` dependency that has been causing failures on Node 6.x container.
Here's build before this change: https://circleci.com/gh/facebook/react-native/22529
Here's build after this change: https://circleci.com/gh/facebook/react-native/22538 (green)
Note that the CI may be still red as there are other PRs to be addressed. You can see this in the wild on 0.50.
Closes https://github.com/facebook/react-native/pull/16301
Differential Revision: D6031352
Pulled By: hramos
fbshipit-source-id: 5c97ae6c87864c094e29e5d8987521071c67f5bd
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.
**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229
Differential Revision: D6009748
Pulled By: TheSavior
fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34