Commit Graph

858 Commits

Author SHA1 Message Date
Rafael Oleza 38ec30bc2e Fix error appearing when disconnecting HMR client
Reviewed By: cpojer

Differential Revision: D5944285

fbshipit-source-id: 5751f6ad2b999872aa3d33e1c7fca105b3156da4
2017-09-29 18:07:17 -07:00
Rafael Oleza a0e88c2a5b Add gating to the JS delta client on the remote debugger
Reviewed By: jeanlauliac

Differential Revision: D5940923

fbshipit-source-id: 1ef4cd52ef3567f2e726217636253802a2e6bb40
2017-09-29 13:32:02 -07:00
Jean Lauliac b3fc64285e metro-bundler: add fs#writeFileSync to the mock
Reviewed By: rafeca

Differential Revision: D5931412

fbshipit-source-id: 2b51617b57963c424446b04e9381e6500323af56
2017-09-29 10:24:14 -07:00
Rafael Oleza 15130d5fa2 Add Source Map support to e2e deltas in chrome debugger
Reviewed By: jeanlauliac

Differential Revision: D5917380

fbshipit-source-id: 31391bc03c420b8e7af5c840fbea2fb0dd5f7bbc
2017-09-29 05:45:38 -07:00
Rafael Oleza ace7273538 Add Delta Bundler client to JS remote debugger
Reviewed By: jeanlauliac

Differential Revision: D5899825

fbshipit-source-id: 9c5815ef234507034016becaabae754129b96c71
2017-09-29 05:45:38 -07:00
Rafael Oleza ee8aeddc52 Make Module.getName() synchronous
Reviewed By: cpojer

Differential Revision: D5911221

fbshipit-source-id: 2381d70008adff9e0f7613fe43c8fb562222acd6
2017-09-26 17:25:11 -07:00
esbenvb 43d394cb4b Updated support for WebStorm
Summary:
Added the executable path to the `COMMON_EDITORS`
Added the executable name to the arguments selections

<!--
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!

-->

Need to be able to jump to specific files and line numbers in WebStorm and autodetect WebStorm as editor, without setting up any environment vars.

Start a new RN project in WebStorm, make some JS errors and click the errors to confirm that it will jump to the right file and line number in WebStorm.

Make sure that none of the other `COMMON_EDITORS` are running, unless you set the `REACT_EDITOR` environment variable.
Closes https://github.com/facebook/react-native/pull/15984

Differential Revision: D5911698

Pulled By: shergin

fbshipit-source-id: 54fced7539520553dd2a93bf7ca7e4f457b0bfc3
2017-09-26 15:03:52 -07:00
Rafael Oleza 34487c0591 Make the runBeforeMainModule config param to RN repo and make it absolute
Reviewed By: davidaurelio

Differential Revision: D5880700

fbshipit-source-id: 5df6781026030395900388c561283abadefa6511
2017-09-26 13:06:14 -07:00
Rafael Oleza e6596dc102 Move debugger client code to its own folder
Reviewed By: davidaurelio

Differential Revision: D5899764

fbshipit-source-id: 3498dd71a11b47841a492cf77df7c887404c1719
2017-09-26 05:17:40 -07:00
Rajesh Singh 979629504b Allow applicationId to be specified on build
Summary:
Added the ability to define a specific applicationId (in case it's different to the package name)

<details>
  Thanks for submitting a PR! Please read these instructions carefully:

  - [x] Explain the **motivation** for making this change.
  - [ ] 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.

  Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>

We have a specific requirement that our package name differs from the applicationId but not in a way that allows us to add it as a suffix to our package name. I wanted to add the option to specify a specific applicationId.

`react-native run-android --appId <Specific Application Id>`
Closes https://github.com/facebook/react-native/pull/14524

Differential Revision: D5910259

Pulled By: shergin

fbshipit-source-id: 768fbc910f6b520dd18936f6bceeee136fca7025
2017-09-26 00:15:29 -07:00
Steven c1058b1e90 `react-native link` and `react-native unlink` update.
Summary:
1. Fix bug: Android project do not delete font files when run `react-native unlink`.
2. Add feature, link images to iOS project when run `react-native link`.
Closes https://github.com/facebook/react-native/pull/14801

Differential Revision: D5890051

Pulled By: hramos

fbshipit-source-id: 28223d181ac5ed51d70df29a56eb56b2cce9aecb
2017-09-22 05:46:38 -07:00
Andrew Hansen df8d0d1db9 use `uniqBy` for iteratee support
Summary:
I noticed `uniq` does not take a second parameter the way it's being used here. I think the function what was intended is [uniqBy](https://lodash.com/docs/4.17.4#uniqBy)
Closes https://github.com/facebook/react-native/pull/15615

Differential Revision: D5852155

Pulled By: hramos

fbshipit-source-id: 892d0bf7f24d30c24620350f698ffb416907ccc5
2017-09-18 02:45:32 -07:00
Christoph Nakazawa 2f78d19df2 Use the Config type from Metro
Reviewed By: davidaurelio

Differential Revision: D5832633

fbshipit-source-id: 8e4e0e6a2907e485a5627c87161af2d0672b4f56
2017-09-15 05:00:10 -07:00
Adam Miskiewicz 39f83c4a12 Refactor how symlinks are discovered in local-cli, support scoped modules
Summary:
This PR refactors the symlink finding logic in local-cli in order to support nested symlinked modules as well as symlinked scoped NPM modules.

Run tests, or try project with `npm link`'ed or `yarn link`'ed dependencies.
Closes https://github.com/facebook/react-native/pull/15776

Reviewed By: cpojer

Differential Revision: D5823008

Pulled By: jeanlauliac

fbshipit-source-id: f2daeceef37bed2f8a136a0a5918730f9832884c
2017-09-14 04:31:57 -07:00
Stepan Hruda 9731b58879 Add missing Contents.json, delete files that shouldn't be in .xcassets
Reviewed By: dinhviethoa

Differential Revision: D5802851

fbshipit-source-id: 78e4b375bd0a0ed48d30bfb7fc746de6a2bd999e
2017-09-12 22:45:33 -07:00
Christoph Nakazawa 12eb04b236 Branding: "packager" -> "Metro Bundler"
Summary:
This diff renames all the stragglers in comments and strings from variations of "packager" to "Metro Bundler". I did one of three:

* Rename "packager" to "Metro Bundler"
* Rename "react-native-packager" to "Metro Bundler"
* Remove "packager" when code inside of Metro implies that it's about Metro

I also removed `Glossary.md` because it is unmaintained and very old. mjesun is currently starting to write documentation for Metro which will supersede whatever was there before.

Reviewed By: mjesun

Differential Revision: D5802993

fbshipit-source-id: ba99cb5ed04d84b0f7b7a8a0bf28ed99280a940a
2017-09-11 19:43:13 -07:00
James Ide 023ac57337 Default enableBabelRCLookup (recursive) to false
Summary:
This is a breaking change that tells Metro to look at only the project's .babelrc file. Previously it would look at .babelrc files under node_modules and would run into issues because it didn't have the version of Babel nor the plugins/presets that `node_modules/randompackage/.babelrc` wanted. So as a workaround, people would write a postinstall step that deletes `node_modules/**/.babelrc`, which worked well. This flag (`getEnableBabelRCLookup = false`) has the same effect and hopefully fixes one source of cryptic bugs people run into.

To use the old behavior, create a config file named `rn-cli.config.js` with:
```js
module.exports = {
  getEnableBabelRCLookup() {
    return true;
  },
};
```

Go under node_modules, modify a used module to have a dummy .babelrc (`{"plugins": ["dummy"]}`) and ensure the JS bundle still loads.
Closes https://github.com/facebook/react-native/pull/15860

Differential Revision: D5798264

Pulled By: jeanlauliac

fbshipit-source-id: ce368b1d5671cc6c6261cbe3c39e61c9401fe37a
2017-09-11 03:47:52 -07:00
Hiten Parmar c88b2b2c65 Log error message when there are zero connected clients
Reviewed By: frantic

Differential Revision: D5789198

fbshipit-source-id: 0c927fe7efc204b7f1173da97cc69262867e632b
2017-09-08 15:30:35 -07:00
Trevor Brindle cb8a116d05 Use xcpretty for iOS build output if installed
Summary:
iOS/xcodebuild logging output sucks. It's completely unreadable because of how xcodebuild takes arguments. Fortunately a ruby gem has existed to fix this for years: xcpretty. You simply pipe xcodebuilds output to xcpretty and it cleans it up, showing relevant info in a more readable format.

This PR implements xcpretty output. It checks to see if xcpretty is in PATH, then uses it by default if it is, and can be disabled using a --verbose cli flag.

- Create a project from master
- run `react-native run-ios`
- Confirm output looks like this:

```tabrindle-mbp:shop-rn tabrindle$ make
Scanning 662 folders for symlinks in /Users/tabrindle/Developer/react-native/node_modules (5ms)
Found Xcode project Shop.xcodeproj
We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time.
Launching iPhone 6 (iOS 10.3)...
Building using "xcodebuild -project Shop.xcodeproj -configuration Debug -scheme Shop -destination id=0CD9ABF3-A8E4-43D6-A52B-F437FF0F45A0 -derivedDataPath build"
▸ Building React/yoga [Debug]
▸ Check Dependencies
▸ Building React/double-conversion [Debug]
▸ Check Dependencies
▸ Running script 'Install Third Party'
▸ Building React/third-party [Debug]
▸ Check Dependencies
▸ Building React/jschelpers [Debug]
▸ Check Dependencies
▸ Building React/cxxreact [Debug]
▸ Check Dependencies
▸ Building React/React [Debug]
▸ Check Dependencies
▸ Running script 'Start Packager'
▸ Running script 'Include RCTJSCProfiler'
▸ Building RCTSettings/RCTSettings [Debug]
▸ Check Dependencies
▸ Building BVLinearGradient/BVLinearGradient [Debug]
▸ Check Dependencies
▸ Building RCTActionSheet/RCTActionSheet [Debug]
▸ Check Dependencies
▸ Building RCTLinking/RCTLinking [Debug]
▸ Check Dependencies
▸ Building RCTWebSocket/fishhook [Debug]
▸ Check Dependencies
▸ Building RCTWebSocket/RCTWebSocket [Debug]
▸ Check Dependencies
▸ Building RCTText/RCTText [Debug]
▸ Check Dependencies
▸ Building RCTNetwork/RCTNetwork [Debug]
▸ Check Dependencies
▸ Building RCTAnimation/RCTAnimation [Debug]
▸ Check Dependencies
▸ Building RCTGeolocation/RCTGeolocation [Debug]
▸ Check Dependencies
▸ Building ReactNativeNavigation/ReactNativeNavigation [Debug]
▸ Check Dependencies
▸ Building RNI18n/RNI18n [Debug]
▸ Check Dependencies
▸ Building RCTImage/RCTImage [Debug]
▸ Check Dependencies
▸ Building RNVectorIcons/RNVectorIcons [Debug]
▸ Check Dependencies
▸ Building RCTVibration/RCTVibration [Debug]
▸ Check Dependencies
▸ Building Shop/Shop [Debug]
▸ Check Dependencies
▸ Running script 'Bundle React Native code and images'
▸ Building Shop/ShopTests [Debug]
▸ Check Dependencies
▸ Build Succeeded
Installing build/Build/Products/Debug-iphonesimulator/Shop.app
Launching com.marketamerica.MAMobile
com.marketamerica.MAMobile: 43497```
- run `react-native run-ios --verbose`
- confirm output looks as normal

Nothing else should be affected. This is simply a developer experience change. If xcpretty is not already installed, nothing will change at all. Many of us using fastlane have been spoiled by this for years.
Closes https://github.com/facebook/react-native/pull/15607

Differential Revision: D5740684

Pulled By: shergin

fbshipit-source-id: 09ef21414b8b65be92595b19502b843fa943403d
2017-09-08 10:00:51 -07:00
Jean Lauliac 1de6ec46f8 RN local-cli: fix the reporter creation code
Reviewed By: mjesun

Differential Revision: D5766153

fbshipit-source-id: 4416e331a7170e49236bcd09555040fd7b5b61b5
2017-09-08 08:02:56 -07:00
Rafael Oleza 5e4f286f48 Use the new Delta HMR implementation from the internal React Native CLI
Reviewed By: jeanlauliac

Differential Revision: D5765025

fbshipit-source-id: fbf516c26382773c623bd3e0c2ba8b668bfd8b31
2017-09-08 06:30:03 -07:00
Marshall Roch 91b6b4efb9 @allow-large-files Flow v0.54.0
Reviewed By: leebyron

Differential Revision: D5773490

fbshipit-source-id: 2c54bb6326f23edbe9a969f3010f79da8189923e
2017-09-06 03:33:43 -07:00
Radek Czemerys 7d4a5b67d4 Add missing licence to findSymlinksPaths
Summary:
Missing licence added. Fixes #15759.
Closes https://github.com/facebook/react-native/pull/15795

Differential Revision: D5768995

Pulled By: hramos

fbshipit-source-id: 2ecad87670f25362344a8da9478a79e731fd0ac2
2017-09-05 13:17:26 -07:00
Miguel Jimenez Esun ef3fe66489 Remove nested "it"s
Reviewed By: jeanlauliac

Differential Revision: D5765323

fbshipit-source-id: 506865ef41ce272898cca9af28c0106ee3a0f57d
2017-09-05 05:18:30 -07:00
Rafael Oleza eb6ba0b041 Enable delta bundler on metro-bundler behind a cli argument
Reviewed By: mjesun

Differential Revision: D5761110

fbshipit-source-id: 83127f63679caffbc4f335f52f6f5eda398e8c05
2017-09-04 13:45:25 -07:00
Rafael Oleza c65d904264 Improve HMR performance by allowing to specify bundlingOptions to getShallowDependencies() method
Reviewed By: jeanlauliac

Differential Revision: D5745205

fbshipit-source-id: a69ac40bb676a809e3786681179e2b4bac392ce6
2017-09-01 09:02:21 -07:00
Eli White dd92dba3da Turn on Flow for EventEmitter
Reviewed By: sahrens

Differential Revision: D5732809

fbshipit-source-id: b8241120188b2b64af12249b2f00a43bea3b58a4
2017-08-30 11:52:28 -07:00
Rafael Oleza a6439279ff Fix flow types of getShallowDependencies()
Reviewed By: mjesun

Differential Revision: D5735278

fbshipit-source-id: b9a2797a89a3893a5196ef8fe15d2ab8aa00e544
2017-08-30 08:21:02 -07:00
Pieter De Baets b11656a727 Update _flowconfig
Summary:
gabelevi mroch: Can you make sure this flow config is also updated when upgrading flow, otherwise our Travis e2e tests fail.
Closes https://github.com/facebook/react-native/pull/15447

Differential Revision: D5601593

Pulled By: javache

fbshipit-source-id: 9dbaa3c1ff732b191452c2c2e56fcf0486fc44c8
2017-08-29 04:51:09 -07:00
Koen Punt 91417ae5a6 Mention correct shortcut to open "Developer Tools"
Summary:
`⌘⌥J` is for "JavaScript Console", `⌘⌥I` is for "Developer Tools"

The shortcut mentioned was for opening the "JavaScript Console", which is incorrect.

![image](https://cloud.githubusercontent.com/assets/351038/25304378/4e210808-2766-11e7-8a6b-b1d1a160bc42.png)
Closes https://github.com/facebook/react-native/pull/13628

Differential Revision: D5700784

Pulled By: hramos

fbshipit-source-id: 668e2861dbece7eabc776202cee37759f6ca3099
2017-08-24 17:37:49 -07:00
Sander Mathijs van Veen 79e498b7fb Allow packager to be opened in specific terminal on Linux and Mac OS X
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
- [ ] Provide a **test plan** demonstrating that the code is solid.
- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?

Currently, it is not possible to spawn the packager in a specific terminal on Linux and Mac OS X.

For example, after applying this patch, starting the packager in a new xfce terminal on Linux can be
done using:

    react-native run-android --terminal /usr/bin/xfce4-terminal

When the command is ran a second time, and the terminal is still running, the command will not spawn a new terminal for the packager.

The option 'open' is renamed to 'terminal' for consistency. Note that the option 'open' was never exposed to the CLI though.

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the 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.

See command above.

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/13065

Differential Revision: D5700713

Pulled By: hramos

fbshipit-source-id: d9729a484c0c0e8f95edabe4309ed7800c9a9c14
2017-08-24 14:26:24 -07:00
Rafael Oleza 0b17524134 Metro HMR: Add file parameter to getShallowDependencies()
Reviewed By: jeanlauliac

Differential Revision: D5687991

fbshipit-source-id: c2db3986c6a5ec81ed1350ded92dfcf1b529c2bc
2017-08-24 08:18:06 -07:00
Rafael Oleza 79fdb91bb7 Fix HMR when adding/renaming assets
Summary:
The HMR logic used to try to calculate the dependencies of every new added (or modified) file, including assets. This resulted in a TransformError.

This commit adds a check that stops the HMR bundling once it finds out that the updated file is an asset

Reviewed By: cpojer

Differential Revision: D5697391

fbshipit-source-id: faf7ccad76ac4922b70ed1c7ce8ce32b03c4e8ee
2017-08-24 07:38:33 -07:00
Jean Lauliac b6e0f4a12d RN local-cli: fix saveAsset scales filtering
Reviewed By: fkgozali

Differential Revision: D5688676

fbshipit-source-id: 2cf6d08b626a6e8c55db0b2293e13300f9606332
2017-08-24 06:40:45 -07:00
Vladimir Kotikov ad4aee7519 Return meaningful error when no devices available
Summary:
`react-native run-ios --device` should report 'No iOS devices connected.' in case when no devices attached. However due to logic bug when empty array is being treatened as a boolean value, cli reports odd message, saying `Could not find device with the name: "true".`

Disconnect all iOS devices from developer machine and run `react-native run-ios --device` in any project - console message should state that there are no devices available.
Closes https://github.com/facebook/react-native/pull/15603

Differential Revision: D5686891

Pulled By: shergin

fbshipit-source-id: 289461b6f920691ad39e940ecca6d85cf2a3573b
2017-08-22 23:50:55 -07:00
Jean Lauliac 0a4085b77c RN local-cli: format and @flow filterPlatformAssetScales
Summary: Preparation before using that from elsewhere that's already typed.

Reviewed By: cpojer

Differential Revision: D5678616

fbshipit-source-id: 01ef6e688241e07ae9ce6aba27c6d4980f6a688b
2017-08-22 09:29:14 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Eli White 36f2d18b10 Disallow trailing commas in react-native-github
Reviewed By: cpojer

Differential Revision: D5645043

fbshipit-source-id: 7378cc96ce39d3d18da7fba51d48db84cfdfa08f
2017-08-17 16:20:04 -07:00
Caleb Meredith 30d9c3d279 Add suppressions for Flow v0.53.0 before React changes
Reviewed By: avikchaudhuri

Differential Revision: D5648801

fbshipit-source-id: c4eb1bee198a177b69b6e9414111ce957b4d27ff
2017-08-17 05:18:33 -07:00
Rafael Oleza 8b2975ad7b Add multi-client support for HMR
Summary:
This diff builds on top of the refactor to use `async/await` and adds multi-client support to Hot Module Reloading.

Thanks to async/await it's been quite straightforward to add this logic, since the only thing that I've had to do is to create a `Set` with the currently connected clients and passed the specified client to each method that was using the global client before.

This closes https://github.com/facebook/react-native/issues/14334

Reviewed By: davidaurelio

Differential Revision: D5611176

fbshipit-source-id: ec29438887342877c372b61132efada16af58fa5
2017-08-11 12:24:20 -07:00
Rafael Oleza f32d0eed17 Refactor attachHMRServer to use async/await
Reviewed By: davidaurelio

Differential Revision: D5603552

fbshipit-source-id: 8fc5f9bcd35a6adf3e3cdf5de47384d8420601cd
2017-08-11 12:24:20 -07:00
David Aurelio 55117ea607 Remove typed option loading
Summary: The API to load custom config types is no longer needed, and can be removed

Reviewed By: cpojer

Differential Revision: D5579721

fbshipit-source-id: f8bc117491134c1177cf17a84360524432579ab9
2017-08-08 19:11:15 -07:00
Andres Suarez cc4de7abc4 Reject local-cli promises with Error objects
Reviewed By: davidaurelio

Differential Revision: D5581520

fbshipit-source-id: 4929906ac79271c17e65fbdf5ba635f06efefd76
2017-08-08 09:38:21 -07:00
Chris Trinh 898790d88a add --port options to run-android, defaults to 8081
Summary: Closes https://github.com/facebook/react-native/pull/15316

Differential Revision: D5582599

Pulled By: javache

fbshipit-source-id: 575e0540965792a25e6cc572cff103da2c65a262
2017-08-08 06:53:20 -07:00
David Aurelio 782453d35e Fix indentation
Summary: Fixes the indentation of a line.

Reviewed By: cpojer

Differential Revision: D5573550

fbshipit-source-id: 4ae095b3d14d1dd4e94ba4035c5624ddbd48f505
2017-08-07 06:45:34 -07:00
Felix Krause aa9a40f68f Update default .gitignore to work with fastlane setups in sub-folders
Summary:
Currently the default way to setup _fastlane_ for ReactNative projects is to set it up in the `ios` or `android` subfolder. This PR updates the path and also the URL to the new fastlane docs page.
Closes https://github.com/facebook/react-native/pull/13261

Differential Revision: D5567604

Pulled By: hramos

fbshipit-source-id: 89c27328bb2748ff1772812786e2821963dc1779
2017-08-04 15:48:14 -07:00
Hector Ramos 23f72a9eb9 Correctly handle the case where HEADER_SEARCH_PATHS is a single string
Reviewed By: ericvicenti

Differential Revision: D5519379

fbshipit-source-id: a07ea0629f98c23e1027202cc7a7957233780643
2017-08-04 15:16:19 -07:00
Ville Immonen 6e99e314b2 Move HelloWorld template to a single index.js entry point
Summary:
This change (initially discussed in https://github.com/react-community/create-react-native-app/issues/26) moves the HelloWorld project template from two nearly identical entry points (`index.android.js` and `index.ios.js`) to a single, minimal `index.js` entry point. The root component is created in `App.js`. This unifies the project structure between `react-native init` and Create React Native App and allows CRNA's eject to use the entry point from the HelloWorld template without any hacks to customize it. Also examples in the docs can be just copy-pasted to `App.js` the same way in both HelloWorld and CRNA apps without having to first learn about  `AppRegistry.registerComponent`.

* Created a new project from the template using `./scripts/test-manual-e2e.sh` and verified that:
  * The app builds, starts and runs both on Android and iOS.
  * Editing and reloading changes works.
  * The new files (`index.js`, `App.js`, `__tests__/App.js`) get created in the project folder.

<img width="559" alt="screen shot 2017-08-01 at 19 10 51" src="https://user-images.githubusercontent.com/497214/28835171-300a12b6-76ed-11e7-81b2-623639c3b8f6.png">
<img width="467" alt="screen shot 2017-08-01 at 19 09 12" src="https://user-images.githubusercontent.com/497214/28835180-33d285e0-76ed-11e7-8d68-2b3bc44bf585.png">

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15312

Differential Revision: D5556276

Pulled By: hramos

fbshipit-source-id: 068fdf7e51381c2bc50321522f2be0db47296c5e
2017-08-03 14:02:43 -07:00
Ville Immonen 6f4025e322 Make the CLI recognize CRNA projects
Summary:
1. Make running `react-native run-ios` or `react-native run-android`
inside a project created with Create React Native App run the
corresponding react-native-scripts command instead of failing.

    **Before**:
    <img width="762" alt="screen shot 2017-07-21 at 16 55 32" src="https://user-images.githubusercontent.com/497214/28467425-86b309c8-6e38-11e7-8946-139bda927d93.png"><img width="762" alt="screen shot 2017-07-21 at 16 55 52" src="https://user-images.githubusercontent.com/497214/28467436-8df02482-6e38-11e7-8a03-3fa664944cac.png">
    **After**:
    <img width="762" alt="screen shot 2017-07-21 at 16 52 15" src="https://user-images.githubusercontent.com/497214/28467522-e4bb6cae-6e38-11e7-97bb-9cfa9cb4dc67.png">

2. Make running `react-native link` inside a CRNA project display a
helpful error message.

    **Before**:
    <img width="762" alt="screen shot 2017-07-21 at 16 55 10" src="https://user-images.githubusercontent.com/497214/28467608-1d1781fa-6e39-11e7-9620-cc16c8b1b40f.png">
    **After**:
    <img width="762" alt="screen shot 2017-07-21 at 16 53 10" src="https://user-images.githubusercontent.com/497214/28467637-2cd6ed1a-6e39-11e7-8947-6df69b3f321e.png">

Fixes #14828.

* Run `react-native run-ios`, `react-native run-android` and `react-native link` in:
  * A CRNA project (screenshot above)
  * A traditional RN project (existing behaviour)
  * A folder that contains neither (existing behaviour)
Closes https://github.com/facebook/react-native/pull/15139

Differential Revision: D5498914

Pulled By: hramos

fbshipit-source-id: 94b6196e3451857bbaa45335a01643c89bed19a0
2017-08-03 12:10:47 -07:00
Adlai Holler 0f440130b6 Standardize project indentation settings on 2 spaces
Summary:
Hi React Native folks! Love your work!

To make contributing easier, this sets the indentation settings of all the Xcode projects to 2 spaces to match their contents.
Closes https://github.com/facebook/react-native/pull/15275

Differential Revision: D5526462

Pulled By: javache

fbshipit-source-id: cbf0a8a87a1dbe31fceed2f0fffc53839cc06e59
2017-07-31 05:20:03 -07:00
David Aurelio 6a4fb5edf2 Add missing `assetRegistryPath` to dependencies command
Reviewed By: BYK

Differential Revision: D5507660

fbshipit-source-id: 6c3070eeb417cf2c2c88767b68dbea7381ab8687
2017-07-27 18:05:49 -07:00
David Aurelio c03ce7fdf3 Saner entry point
Summary: makes flow typing for the entry point more sound and fixes two issues

Reviewed By: BYK

Differential Revision: D5507650

fbshipit-source-id: 6b03f7de792ffcece4d0d61950e136a61ea7db2e
2017-07-27 18:05:49 -07:00
James Ide 113e046444 Control whether Metro tells Babel to lookup .babelrc files
Summary:
This adds support to RN's configuration file to let people turn off Babel's behavior of looking up .babelrc files. Most of the support for this feature is in Metro (https://github.com/facebook/metro-bundler/pull/31).
Closes https://github.com/facebook/react-native/pull/15136

Differential Revision: D5483241

Pulled By: jeanlauliac

fbshipit-source-id: c78096c1574c9f844c9f34aff73e6f97cb0b5e45
2017-07-26 15:31:03 -07:00
Philipp von Weitershausen ed903099b4 Add blob implementation with WebSocket integration
Summary:
This is the first PR from a series of PRs grabbou and me will make to add blob support to React Native. The next PR will include blob support for XMLHttpRequest.

I'd like to get this merged with minimal changes to preserve the attribution. My next PR can contain bigger changes.

Blobs are used to transfer binary data between server and client. Currently React Native lacks a way to deal with binary data. The only thing that comes close is uploading files through a URI.

Current workarounds to transfer binary data includes encoding and decoding them to base64 and and transferring them as string, which is not ideal, since it increases the payload size and the whole payload needs to be sent via the bridge every time changes are made.

The PR adds a way to deal with blobs via a new native module. The blob is constructed on the native side and the data never needs to pass through the bridge. Currently the only way to create a blob is to receive a blob from the server via websocket.

The PR is largely a direct port of https://github.com/silklabs/silk/tree/master/react-native-blobs by philikon into RN (with changes to integrate with RN), and attributed as such.

> **Note:** This is a breaking change for all people running iOS without CocoaPods. You will have to manually add `RCTBlob.xcodeproj` to your `Libraries` and then, add it to Build Phases. Just follow the process of manual linking. We'll also need to document this process in the release notes.

Related discussion - https://github.com/facebook/react-native/issues/11103

- `Image` can't show image when `URL.createObjectURL` is used with large images on Android

The websocket integration can be tested via a simple server,

```js
const fs = require('fs');
const http = require('http');

const WebSocketServer = require('ws').Server;

const wss = new WebSocketServer({
  server: http.createServer().listen(7232),
});

wss.on('connection', (ws) => {
  ws.on('message', (d) => {
    console.log(d);
  });

  ws.send(fs.readFileSync('./some-file'));
});
```

Then on the client,

```js
var ws = new WebSocket('ws://localhost:7232');

ws.binaryType = 'blob';

ws.onerror = (error) => {
  console.error(error);
};

ws.onmessage = (e) => {
  console.log(e.data);
  ws.send(e.data);
};
```

cc brentvatne ide
Closes https://github.com/facebook/react-native/pull/11417

Reviewed By: sahrens

Differential Revision: D5188484

Pulled By: javache

fbshipit-source-id: 6afcbc4d19aa7a27b0dc9d52701ba400e7d7e98f
2017-07-26 08:23:20 -07:00
Jean Lauliac 65769b0c33 metro-bundler: remove hardcoded AssetRegistry path
Reviewed By: davidaurelio

Differential Revision: D5452553

fbshipit-source-id: e0a6f56d3bc03f4ba7f34fbee1ae418495dcc6cd
2017-07-24 17:16:39 -07:00
Miguel Jimenez Esun 98e61de19f Add missing "getPolyfills" tag
Reviewed By: jjmaestro

Differential Revision: D5476971

fbshipit-source-id: 264d80d5370d3d1cff174dacc7349d2d0be0ff89
2017-07-21 22:04:36 -07:00
Alex Dvornikov 70edc2fd80 Upgrade metro-bundler to v0.10.0
Reviewed By: davidaurelio

Differential Revision: D5469746

fbshipit-source-id: 1d2c0f6c5bb9761cfc54b6c9fdbb1a9f20f535ea
2017-07-21 09:40:15 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Trevor Brindle 95ee3f5cab added info CLI command
Summary:
Many issues filed on Github are missing platform/toolchain version information. Others have different ways of writing it, and require the issue writer to look in multiple places for these versions.
Other CLI tools like Ionic have this function, and it's incredibly useful. Related to https://github.com/facebook/react-native/issues/14420

Run in terminal/command prompt `react-native info`

```
trevors-imac:AwesomeProject tabrindle$ react-native info
Versions:
  React Native:  1000.0.0
  OS:  macOS Sierra
  Node:  v6.10.3
  Yarn:  0.24.5
  npm:  5.0.0
  Xcode:  Xcode 8.3.3 Build version 8E3004b
```

- CLA signed 
- Verify functionality + implementation
Closes https://github.com/facebook/react-native/pull/14428

Differential Revision: D5392446

Pulled By: hramos

fbshipit-source-id: 460079f3860c0af1e0b77bf26552c26032e974be
2017-07-18 11:45:47 -07:00
Miguel Jimenez Esun 6dd9d16833 Move Array<string> to $ReadOnlyArray<string>. Separate polyfill list into a file.
Summary: Move the returned type of `getPolyfills` from a standard `Array` to a read-only one, so that we make sure the array is not modified once created. Also, refactor the list of polyfills included by default to a generic, central file, then require it both from the CLI utils as well as the development server.

Reviewed By: jeanlauliac

Differential Revision: D5406553

fbshipit-source-id: ab980288bb1c625338de469da77dd6fc70bcedbc
2017-07-13 03:38:23 -07:00
Eli White fc86f25f9a Run eslint on all js files
Reviewed By: zertosh

Differential Revision: D5405047

fbshipit-source-id: 5ade9d8beb3688d8bb08a208709c0dbf1ec671b2
2017-07-12 14:09:53 -07:00
James Ide 9f87728f5d Change `polyfills` to `getPolyfills` function for more configurability
Summary:
Changing the `polyfills` option to `getPolyfills({platform})` will let us return a different set of polyfills for each platform. See https://github.com/facebook/metro-bundler/issues/25 for the motivation.
Closes https://github.com/facebook/react-native/pull/14943

Differential Revision: D5405878

Pulled By: mjesun

fbshipit-source-id: 908e49a286841f97655603d92d0fdfb000547510
2017-07-12 08:18:14 -07:00
gabriel 3f16aa5559 added chromium support for devTools on linux
Summary:
<details>
  Thanks for submitting a PR! Please read these instructions carefully:

  - [ ] Explain the **motivation** for making this change.
  - [ ] Provide a **test plan** demonstrating that the code is solid.
  - [ ] Match the **code formatting** of the rest of the codebase.
  - [ ] Target the `master` branch, NOT a "stable" branch.

  Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>

_What existing problem does the pull request solve?_

On Linux, the packager caught an "Google Chrome exited with error: { Error: spawn google-chrome ENOENT}" when trying to launch the devTools because google-chrome is not installed but chromium is.
Thus, this pull request maps the platform Linux with chromium for launching the debugger automatically in the packager

_A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website._

- enter on terminal
    > react-native start
- launch the app in dev mode with "Debug JS remotely" enabled
- the packager prints "Launching Dev Tools..." and launch chromium with the debugger
![screenshot](https://user-images.githubusercontent.com/13065528/27481217-ceaf5e58-581b-11e7-976f-75c107596ad3.png)
Closes https://github.com/facebook/react-native/pull/14696

Differential Revision: D5398564

Pulled By: hramos

fbshipit-source-id: 151f83b549492c8716a248eb16f7e24c5658b32e
2017-07-11 12:31:15 -07:00
Giles Van Gruisen 5f1408858a Support additional dependency declaration format
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.

Previously, `isInstalled` was somewhat naively checking for the presence
of a string in the `build.gradle` file to determine whether or not that
dependency was already linked. I.e.:

```
    compile project(':${name}')\n
```

…where `name` is replaced with the name of the dependency being checked.

This was inflexible as it only supported that particular format of
`compile` definition. Another, valid `compile` definition follows:

```
    compile(project(':example') { … }
```

However, this failed the check because it didn't _exactly_ match the
format for which the check was searching the `build.gradle` contents. As
a result, running `react-native link` would incorrectly duplicate the
dependency definition and thus cause a crash upon launching the app.

This change adds an `installPattern` to the object returned from
`makeBuildPatch`, which includes the particular dependency name and is
valid for both `compile` definition formats.

This commit adds an additional compile definition in the associated fixture,
an additional test case in `isInstalled.spec.js` to check for this additional
format, and an additional test in `makeBuildPatch.spec.js` to ensure the
object returned includes the aforementioned `installPattern` Regex pattern.

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/14475

Differential Revision: D5398552

Pulled By: hramos

fbshipit-source-id: 1eaf84ba5bcfc43202f13c6b8fcfc68c30f36c33
2017-07-11 11:18:56 -07:00
Miguel Jimenez Esun ad0fe15e2e Move polyfills to react-native
Summary:
React Native bundler (aka Metro Bundler) was splitted from the main codebase some time ago (now it lives [[https://github.com/facebook/metro-bundler|here]]). To make it more agnostic, polyfills will be moved out from it, so people who doesn't need them does not include them. However, RN will still need them, so the first step is to copy them back to RN so that we can provide them to Metro Bundler later.

We also include a way of passing the list of polyfills to include, as an `Array<string>`. The field is called `polyfills`, and defaults to the traditional list that is currently included in the package manager [see here](be1843cddc/packages/metro-bundler/src/defaults.js (L27-L37)).

In future commits, `metro-bundler` will be able to manage the `polyfills` array passed to it, and use it, instead of the pre-defined ones.

Reviewed By: davidaurelio

Differential Revision: D5381614

fbshipit-source-id: 749d536b781843ecb3067803e44398cd6df941f1
2017-07-11 03:47:16 -07:00
Sai Grandhi d7f671135c Update copyToClipBoard.js
Summary:
Since copy to clipboard functionality is now available in Linux, the comment above `copyToClipboard` function has been updated.
Closes https://github.com/facebook/react-native/pull/14773

Differential Revision: D5392372

Pulled By: hramos

fbshipit-source-id: 6e2668e1a89d37f9d5707fa36b3639895cd5bffd
2017-07-10 15:22:50 -07:00
Nurzhan Bakibayev c00abe53c3 Move inspector proxy out of the packager
Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
2017-07-10 06:31:23 -07:00
Parashuram N 352c3d97b3 Updating the usage of inquirer API
Summary:
Inquirer was changed to a later version in bada25d158. However, the API also needed to be updated to use a promise based version.
Closes https://github.com/facebook/react-native/pull/14848

Differential Revision: D5375663

Pulled By: javache

fbshipit-source-id: 635798a43905301c65db5f63b9cfba1c16964870
2017-07-06 14:34:45 -07:00
Raul Gomez Acuna d666f30665 react-native link support for native Android modules developed in Kotlin
Summary:
Currently React Native cli does not support linking native Android modules written in Kotlin. This PR aims to add support to it and closes #14561

- New unit tests added to verify the added functionality, they can be found inside:
`local-cli/core/__tests__/android/findPackageClassName.spec.js`

- Existing unit tests passed.
Closes https://github.com/facebook/react-native/pull/14660

Differential Revision: D5316981

Pulled By: shergin

fbshipit-source-id: 98354ba1e1ce1080a9a4b9958ef39893472038a1
2017-06-29 01:15:36 -07:00
Marshall Roch 16747dd807 @allow-large-files Flow v0.49
Reviewed By: nmote

Differential Revision: D5339224

fbshipit-source-id: a18f0afb2ce75df736662d84951e392db1e2dbbf
2017-06-28 21:32:48 -07:00
Christopher Chedeau c848c3820b Codemod prettier to 1.5.2
Differential Revision: D5339725

fbshipit-source-id: 631338436a7d69b0ab0721507bdab4ae4e207065
2017-06-28 12:50:30 -07:00
Chris Blappert c0505cedf1 Packager postprocessing hook
Reviewed By: davidaurelio

Differential Revision: D5244060

fbshipit-source-id: 3f5f9ab9aeeb63eca13d6dab089c2bda42f70c33
2017-06-26 10:31:57 -07:00
David Aurelio 1faf40b02a Upgrade metro-bundler to v0.9.0
Summary: Upgrade metro-bundler to v0.9.0. This version has no functional change. The only change is that the structure of the npm package reflects the structure of the source code.

Reviewed By: bestander

Differential Revision: D5315651

fbshipit-source-id: 3a69337106d4ccf708823c80d304941973360e8e
2017-06-24 17:15:55 -07:00
Tim Yung a26d87628c RN: Improve Audio for Maintaining Priority
Summary:
The React Native Remote Debugger page (`debugger.html`) contains an embedded silent sound file to maintain tab priority in Google Chrome.

This revision simply replaces the existing one with a better one that has the following characteristics:

- 1s Duration
- 10Hz Frequency
- -48dBFS Amplitude
- Fades in/out to reduce audible clicks on loop.
- 44.1kHz @ 16bit to maximimize compatibility.
- Smaller size.

Much thanks to Stephane Pigeon (http://stephanepigeon.com/) for designing the sound file specifically for this use case.

Reviewed By: mmmulani

Differential Revision: D5273591

fbshipit-source-id: 81668cc0a829e008263907fc1fa7150b72691371
2017-06-19 13:30:51 -07:00
Tim Yung ce5ae53669 RN: Replace Workaround w/ Upgraded `mock-fs`
Reviewed By: cpojer

Differential Revision: D5271612

fbshipit-source-id: 1579f34d4c4e64706f2f128e848b5f6d3d838097
2017-06-18 01:01:59 -07:00
Avik Chaudhuri 71401c1185 update xplat/js to flow 0.48.0
Reviewed By: zertosh

Differential Revision: D5243415

fbshipit-source-id: 78ea4f7f29bcd6a70650f24ceb05f06b18b39018
2017-06-14 15:47:21 -07:00
Pieter De Baets ce6fb337a1 Breaking - remove unused registration of JS modules
Summary: It's now unnecessary to declare which JS modules you want to expose on your package. To upgrade, remove all overrides of `createJSModules` and keeping calling your JS modules as before.

Reviewed By: AaaChiuuu

Differential Revision: D5229259

fbshipit-source-id: 1160826c951433722f1fe0421c1200883ba1a348
2017-06-14 03:52:17 -07:00
James Burnett 51c0e81557 remove disableAutomock from jest tests (new default) @bypass-lint
Reviewed By: cpojer

Differential Revision: D5237192

fbshipit-source-id: dccca52a91259d7fea27931f92bca94184a82d4a
2017-06-13 15:04:09 -07:00
Christoph Pojer 29d9c35e12 Add --maxWorkers flag and allow transformers to run in-band.
Summary:
This diff cleans up some cruft and adds some features:

* It removes the usage of an env variable to control workers.
* It removes the lazy and handwavy calculation on how many workers to use for jest-haste-map. Jest itself uses the maximum amount of workers available and it has never been reported as an issue – especially since it is a one-time startup cost of about 3 seconds on a cold cache only.
* It adds a `--max-workers` flag to replace the env variable. This one is able to control both the number of workers for `jest-haste-map` as well as the transformers.
* It makes the transformers run in the parent process if 1 or fewer workers are are specified. This should help with debugging.

Once you approve this diff, I will publish a new version of metro to npm and update the version used in RN and remove the use of the env variable altogether: https://our.intern.facebook.com/intern/biggrep/?corpus=xplat&filename=&case=false&view=default&extre=&s=REACT_NATIVE_MAX_WORKERS&engine=apr_strmatch&context=false&filter[uninteresting]=false&filter[intern]=false&filter[test]=false&grep_regex=

Note: the process of adding a CLI option is really broken. Commander also has a weird API. We should consider building a better public API for Metro and then consider how to build a new CLI on top of it and simplify our internal integration. I really don't like how Metro is integrated across pieces of the RN cli in ways that is hard to manage. But that is a larger task for another time :)

Reviewed By: jeanlauliac

Differential Revision: D5217726

fbshipit-source-id: 74efddbb87755a9e744c816fbc62efa21f6a79bf
2017-06-13 09:16:03 -07:00
Andrew Imm 2c32acb755 Add https options to RN CLI server
Reviewed By: davidaurelio

Differential Revision: D5223852

fbshipit-source-id: 91025751ddf1f4ec4adcc768b69b936ee1a68edf
2017-06-12 16:15:37 -07:00
Pieter De Baets 2e4284215c Handle fatal errors thrown by the Chrome debugger
Reviewed By: mmmulani

Differential Revision: D5219190

fbshipit-source-id: 16cff0e08de9c53d7a3e10897ddec3e6924c3bf5
2017-06-12 03:38:51 -07:00
Tim Yung 6407071424 RN: Node v8 Workaround for `local-cli/core/__tests__`
Reviewed By: raluca-elena

Differential Revision: D5224358

fbshipit-source-id: 66c923bd3a38af47fcacbd1ee758bd28253ecf31
2017-06-10 00:08:23 -07:00
Tim Yung 223eab930b RN: Cleanup `local-cli/core/__tests__`
Reviewed By: raluca-elena

Differential Revision: D5224347

fbshipit-source-id: 99a729c49bec28bf89d9dc91530958beec878828
2017-06-10 00:08:23 -07:00
Adam Miskiewicz f847fbe021 Fix broken default getProjectRoots
Summary:
In <= 0.44, the default implementation of getProjectRoots() came from `local-cli/core/default.config.js`. With changes happening in the CLI and the packager over the course of the last two months, various pieces of this logic (specifically `local-cli/utils/Config.js`) were rewritten, and though default.config.js was still being imported and used in `local-cli/core/index.js`, the default `getProjectRoots()` was being overriden by the defaults specified in `local-cli/utils/Config.js`.

This PR moves the logic from default.config.js into Config.js and index.js, as appropriate. Specifically:

- The `getProjectCommands()`, `getProjectConfig()`, and `getDependencyConfig()` methods, which have traditionally not been part of the rn-cli.config.js spec, are now defined in `local-cli/core/index.js`.
- The `getProjectRoots()` method, which contained logic for properly resolving the _actual_ project root as well as resolving symlinks within that root, has been moved to `local-cli/utils/Config.js`, to match the fact that other default  rn-cli.config.js definitions live there.
Closes https://github.com/facebook/react-native/pull/14412

Differential Revision: D5216887

Pulled By: hramos

fbshipit-source-id: 7a3840ecf0ad8ea3f6d7bbd3d54e4f02950c6a32
2017-06-09 01:16:45 -07:00
Christoph Pojer cbb8d6f628 Remove worker from local-cli
Reviewed By: davidaurelio

Differential Revision: D5208910

fbshipit-source-id: 245436276185fff1a516a00d4c631e885f463e53
2017-06-08 10:33:09 -07:00
James Burnett 3360999431 disable automock by default in as many places as possible @bypass-lint
Reviewed By: cpojer

Differential Revision: D5190858

fbshipit-source-id: d3125cf81427dbbe3362ef1f958413394a6dc51d
2017-06-08 07:45:54 -07:00
Christoph Pojer 236e9e4d01 Remove react-native/packager folder.
Summary: This folder is not necessary any longer. All the code now lives in https://github.com/facebook/metro-bundler

Reviewed By: davidaurelio, jeanlauliac

Differential Revision: D5199196

fbshipit-source-id: 35bf0f10a9163f53426db9a76f8f853dceb69167
2017-06-07 07:30:32 -07:00
Daniel Friesen 1ad08aa659 Fix `react-native link` issue when using multiple manifests
Summary:
`react-native link` often fails due to the wrong manifest being used when you use a debug manifest. `findManifest` returns `debug/AndroidManifest.xml` instead of `main/AndroidManifest.xml`. And the debug manifest usually does not have the package name defined so `projectConfigAndroid` throws a cryptic "Cannot read property 'replace' of undefined" error.

This fixes the issue by throwing a more user friendly error and providing a `manifestPath` userConfig.

This is mostly based on comments to #10050.
Closes https://github.com/facebook/react-native/pull/13373

Differential Revision: D4945690

Pulled By: shergin

fbshipit-source-id: b177f916fd4799c873d2515c18cbb87bef3203f0
2017-06-06 14:20:06 -07:00
Jean Lauliac 328d8ddb47 metro-bundler: make internal tool to use the new source of thruth for packager/metro-bundler
Reviewed By: davidaurelio

Differential Revision: D5182904

fbshipit-source-id: df5de3a9eb85560a09789d0a94eccb5c48ecba7b
2017-06-06 05:15:51 -07:00
Jean Lauliac 07ee04d7bd metro-bundler: upgrade react-native-github to OSS bundler
Reviewed By: cpojer

Differential Revision: D5172542

fbshipit-source-id: 4ca6c9aad8f798ac6b8f1070f98b5d1d2098e726
2017-06-02 11:31:40 -07:00
Jean Lauliac a829d01bfc react-native: attachHMRServer: make it generic
Reviewed By: cpojer

Differential Revision: D5172344

fbshipit-source-id: ab8b39e1924d66d37da9734455ed9a72cf59906e
2017-06-02 09:31:41 -07:00
Jean Lauliac ec030d14cd react-native/local-cli: allow loading of custom Config objects
Reviewed By: cpojer

Differential Revision: D5172202

fbshipit-source-id: 834819c136a090a600221efbb0527dc3ada58031
2017-06-02 09:31:41 -07:00
Kevin Gozali d41c9d94fd add --dev flag to the packager's dependencies command
Summary:
The packager dependencies CLI command always operates on --dev=true today. This means any tooling that needs to get the production dependencies (--dev=false) will always get the dev-mode list instead. For instance:

```
if (__DEV__) {
  require('Foobar');
}
```

Previously, `Foobar.js` will always be listed in the CLI output. With this change, setting `--dev false` option will correctly skip `Foobar.js` in the output.

Reviewed By: cpojer

Differential Revision: D5163184

fbshipit-source-id: 203221ee5d6ecb7df575442f12f6c4c489bfbd46
2017-06-01 14:03:34 -07:00
Jean Lauliac 365c1bfcf9 metro-bundler: Terminal: remove global state
Reviewed By: cpojer

Differential Revision: D5155075

fbshipit-source-id: 1d64bdd0ae13087aca620b65892832e3a1229c4a
2017-06-01 03:04:04 -07:00
Christoph Pojer 57bb955ba1 Move remaining Metro Bundler files around.
Reviewed By: jeanlauliac

Differential Revision: D5154653

fbshipit-source-id: 482bf9829263d5d8f3d0b951ee58e2020236cc2c
2017-05-31 11:17:41 -07:00
Christoph Pojer 3fecc28912 Fix i18n pipeline
Reviewed By: fkgozali

Differential Revision: D5154974

fbshipit-source-id: c976cf6941074bbb71b96dbf7b73e01125441bd3
2017-05-31 10:16:03 -07:00
Gabriel Laet f16df60b8d CLI: Adding shebang to setup_env.sh script
Summary:
Adding shebang to local-cli's setup_env script.

Depending how your *nix environment is setup, running `react-native bundle` will throw this error:

```
Error: spawnSync /opt/build/in/node_modules/react-native/local-cli/setup_env.sh Unknown system error -8
    at exports._errnoException (util.js:1022:11)
    at spawnSync (child_process.js:461:20)
    at Object.execFileSync (child_process.js:498:13)
    at repl:1:14
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:346:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
```

In my case I was running react-native on docker (using alpine-node:6 as base image).
Closes https://github.com/facebook/react-native/pull/12173

Differential Revision: D5154069

Pulled By: shergin

fbshipit-source-id: acf2a21499b4a57310afd06b57386e7900662b7d
2017-05-31 02:46:23 -07:00
chunghe b0ca3ed49b close `<audio>` tag. Some debugger (ex: remote-redux-devtools-on-debu…
Summary:
[remote-redux-devtools-on-debugger](https://github.com/jhen0409/remote-redux-devtools-on-debugger) is a redux debugger UI for react-native. It inject code to debugger.html to communicate to the [Remote Redux DevTools](https://github.com/zalmoxisus/remote-redux-devtools). But the injecting failed for react-native 0.44 because the injected code will be wrapped in the audio tag. Here's the screenshot:

![2017-05-05 16 12 50](https://cloud.githubusercontent.com/assets/78242/25739567/02d7824c-31b5-11e7-99d3-36b17effaaa3.png)

The pull request close the `<audio>` tag to make sure the injecting code not wrap inside `<audio>` tag

![2017-05-05 17 13 29](https://cloud.githubusercontent.com/assets/78242/25739835/317bc698-31b6-11e7-8aab-c2ecabf1eccb.png)

`$ npm install --save-dev remote-redux-devtools-on-debugger`
`$ ./node_modules/.bin/remotedev-debugger --hostname localhost --port 5678 --injectserver`
$ open debugger.html in the browser, open the chrome dev tool, make sure the injected code not wrapped in the audio tag.

If you have added code that should be tested, add tests.

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/13798

Differential Revision: D5154006

Pulled By: shergin

fbshipit-source-id: bd5f1774108649774b33ff2bf38d1aee3a5c50a9
2017-05-31 02:46:21 -07:00
Christoph Pojer 414da08a80 Stop requiring setupBabel from within packager/ folder.
Reviewed By: davidaurelio

Differential Revision: D5137246

fbshipit-source-id: 3072aaa6fd74a135980f1f0a7b078a82dd85f09d
2017-05-30 04:46:08 -07:00
Hugo Dozois c98fc33ce5 Fix new-library to copy to current project
Summary:
- new-library was copying file inside the <project_root>/node_modules/react-native/Libraries instead of <project_root>/Libraries. This was due to the path.resolve that was being passed 2 full paths instead of a base path + relative path segment.

 ---

Before:

```js
console.log(libraryDest, dest, path.resolve(libraryDest, dest);

// <base-path>/Libraries/TestLib
// <base-path>/node_modules/react-native/Libraries/TestLib/package.json
// <base-path>/node_modules/react-native/Libraries/TestLib/package.json
```

After:

```js
console.log(libraryDest, dest, path.resolve(libraryDest, dest);

// <base-path>/Libraries/TestLib
// ../TestLib/package.json
// <base-path>/Libraries/TestLib/package.json
```
Closes https://github.com/facebook/react-native/pull/13748

Differential Revision: D5043652

Pulled By: shergin

fbshipit-source-id: febee13781fc7075276daa67f9a78cc73dfd4b73
2017-05-29 12:46:08 -07:00
Max Thorson 242d29d374 add multiline flag to product name regex in runIOS build project
Summary:
Maintainers - hoping theres a chance this could be cherry-picked into 0.44-stable as it's a very minor change to the local-cli.

Our iOS app has 3 different configurations, each with a separate Product Name.  When building for debugging on the simulator with the `react-native run-ios` command, the build would complete successfully but would error in trying to install to the simulator.  I tracked the error down to the regex I've updated in this PR which was looking for the full product name in the build output, but the regex there wasn't using the multiline flag so it never matched.

I've tested this locally with our app and it now works as expected.  If I specify a different configuration with `react-native run-ios --configuration Beta` (for example), it properly detects the Product Name for the configuration and installs correctly as well.
Closes https://github.com/facebook/react-native/pull/14071

Differential Revision: D5141414

Pulled By: shergin

fbshipit-source-id: 23bceb8a9650cc0cf2a83ea92ad417049240da4e
2017-05-26 16:00:52 -07:00
glevi@fb.com ffdae135fd Deploy v0.47.0 to xplat/js
Reviewed By: zertosh

Differential Revision: D5135644

fbshipit-source-id: f979970f8d0c4e082ec1302084d4def6652557c8
2017-05-25 23:00:37 -07:00
Jean Lauliac a4badb8471 packager: TransformCaching: make choice of cache explicit in the API
Summary:
This changeset moves the creation of the transform cache at the top-level of the bundler so that:

* we can use alternative folders, such as the project path itself, that I think will be more robust especially for OSS;
* we can disable the cache completely, that is useful in some cases (for example, the script that fills the global cache).

The reasons I believe a local project path is more robust are:

* there are less likely conflicts between different users and different projects on a single machine;
* the cache is de facto cleaned up if you clone a fresh copy of a project, something I think is desirable;
* some people have been reporting that `tmpDir` just returns nothing;
* finally, it prevents another user from writing malicious transformed code in the cache into the shared temp dir—only people with write access to the project have write access to the cache, that is consistent.

Reviewed By: davidaurelio

Differential Revision: D5113121

fbshipit-source-id: 74392733a0be306a7119516d7905fc43cd8c778e
2017-05-25 04:31:08 -07:00
Christoph Pojer 17e0478cf4 Remove setupBabel call from main entry point
Summary:
* Internally, we already set up babel before calling into metro-bundler.
* Externally, I moved the setup calls to outside the packager/ folder.

If somebody has a custom integration with RN, they would need to setup babel themselves up until we make the open source split. By the time this is released in open source, an npm version of metro-bundler will be available for use.

Next step: also do this for the worker and remove setupBabel from the metro repo.

Reviewed By: davidaurelio

Differential Revision: D5121429

fbshipit-source-id: e77c6ccc23bef1d13fd74c4727be2d7e09d2d0ca
2017-05-24 11:45:46 -07:00
David Aurelio bea7659762 Move packager core logic from `local-cli` to `packager`
Summary: Moves packager core logic to `packager/...` to prepare the open source split.

Reviewed By: cpojer

Differential Revision: D5116162

fbshipit-source-id: 06ee2406026686789f67acc88df41773866c3cd3
2017-05-24 08:06:10 -07:00
David Aurelio aec7b34e50 Add support for RAM bundle groups
Summary: Adds support for “RAM bundle groups” (common section for module groups) to the new Buck integration

Reviewed By: jeanlauliac

Differential Revision: D5112065

fbshipit-source-id: 038c06b8f4133c7fcd39aba8bb04a5ef42594f3e
2017-05-24 08:06:09 -07:00
David Aurelio a710f9a81e Move packager launcher scripts outside of `packager/`
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.

Reviewed By: javache

Differential Revision: D5112193

fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
2017-05-23 16:17:09 -07:00
David Aurelio 9a91ea4b36 Use `ModuleTransportLike` only with `$ReadOnlyArray`
Summary: Replaces all usages of `Array<ModuleTransportLike>` with `$ReadOnlyArray<ModuleTransportLike>`

Reviewed By: jeanlauliac

Differential Revision: D5111714

fbshipit-source-id: 9b531576362172ecf5c0adfc9c01a16c8946b476
2017-05-23 10:31:27 -07:00
David Aurelio f9f1245560 Covariant properties for `ModuleTransportLike`
Summary:
Make all properties of `ModuleTraansportLike` covariant to enforce read-only behavior at all sites using it.
The type only exists for compatibility reasons between old and new output functionality, and covariant properties give us stronger guarantees.

Reviewed By: jeanlauliac

Differential Revision: D5111667

fbshipit-source-id: 674658b07eb3a229cbc4344cb636e4a9ea4126d1
2017-05-23 10:31:27 -07:00
David Aurelio 918bae282b Create an `OutputFn` that can build indexed RAM bundles
Summary: Adds functionality to assemble an indexed source map to the new Buck integration. This implementation supports startup section optimisations. Hooking it up, and grouping optimisations will be in follow-ups.

Reviewed By: jeanlauliac

Differential Revision: D5106985

fbshipit-source-id: cc4c6ac8cfe4e718fc8bb2a8a93cb88914c92e0b
2017-05-23 10:31:27 -07:00
Jean Lauliac bfc0e8c26f packager: add preprocess for buck worker
Summary: For the Buck integration (work-in-progress), we want to add the ability to do some custom preprocessing similar to the packager server. The signature is different so I prefer to have a separate function for that. Also we don't need the transform options right now, I suggest we don't add them for now and add them later if necessary.

Reviewed By: davidaurelio

Differential Revision: D5094632

fbshipit-source-id: 1775ddef90b331deabc5be3e57a67436bce06c82
2017-05-22 09:03:36 -07:00
Gabe Levi afc114364b Turn on strict call arity checking for xplat/js
Reviewed By: zertosh

Differential Revision: D5082688

fbshipit-source-id: 188593a513583028c22d09f4e4dc02659dbd18dd
2017-05-18 16:55:55 -07:00
Gabe Levi 3ddc7d47d5 Fix react-native function call arity errors
Reviewed By: zertosh

Differential Revision: D5081816

fbshipit-source-id: 5978770c30a69fb287d03aa7511999ce30f856a1
2017-05-18 16:55:55 -07:00
David Aurelio 47f52bae67 `meta.js`: add flow
Summary: Adds flow to `local-cli/bundle/output/meta.js`, and makes some changes to avoid errors.

Reviewed By: cpojer

Differential Revision: D5077563

fbshipit-source-id: bafb9e6705319f6f2e8ae1c820667ad343191b3c
2017-05-17 07:32:40 -07:00
eacaps e53046b9ec pass polyfillModuleNames into packager
Summary:
After examining how React Native sets up `process.env.NODE_ENV` using `global.__DEV__` from `prelude_dev.js` or `prelude.js` by treating them like polyfills I decided to use the same approach for environment variables. I setup my own rn-project.config.js file like so:

```
const blacklist = require('react-native/packager/blacklist');
const pathJoin = require('path').join;

module.exports = {
  getBlacklistRE: function() {
    return blacklist([/build\/.*/, /app\/assets\/webpack.*/]);
  },
  polyfillModuleNames: [pathJoin(__dirname, 'globals.js')]
};
```

I ran the packaging server using:
`react-native start --config=config/react-native/rn-project.config.js --reset-cache`

I expected my polyfillModuleNames to be passed into the Packager properly and be handled the same way the built-in polyfills worked. Unfortunately I noticed the Packager wasn't actually getting `opt.polyfillModuleNames`. Digging into the code a bit, it seems the local-cli wasn't passing the polyfillModuleNames from the config.

There are no specs for runServer.js but this change can be tested by using a config that contains polyfillModuleNames. Sample config and run command provided above simple `global.js` provided below:

```
global.process = global.process ? global.process : {};
global.process.env = global.process.env ? global.process.env : {};
global.process.env['PROJECT_ENV'] = 'staging';
```
Closes https://github.com/facebook/react-native/pull/13725

Differential Revision: D5077615

Pulled By: jeanlauliac

fbshipit-source-id: f66a8a8bda2702cd9a4e5b92f5335f43ab2f9089
2017-05-17 05:03:41 -07:00
Jean Lauliac c0e8d67e01 packager: server.js: @flow
Summary: I'd like to start typing the front-end so that it's easier to track adding new options, etc.

Reviewed By: davidaurelio

Differential Revision: D5069868

fbshipit-source-id: 9a18dca52efd486ca18f17d0ec434a5ec1c1649c
2017-05-17 05:03:41 -07:00
Jean Lauliac b98c33f1b4 packager: runServer: @flow
Summary: This makes it easier to verify correctness when adding new config/args.

Reviewed By: davidaurelio

Differential Revision: D5069537

fbshipit-source-id: 4d8058851900b23163d0f2744e91dd14dfcdd461
2017-05-17 05:03:41 -07:00
David Aurelio dc783d97e8 Make `postMinifyProcess` non-optional
Reviewed By: cpojer

Differential Revision: D5052315

fbshipit-source-id: 4c3573fc6e97b4f561f371179ea2dd6f89fac05a
2017-05-12 11:45:37 -07:00
Jean Lauliac d0c2b068d7 packager: DependencyGraph: remove re-exported functions
Reviewed By: davidaurelio, cpojer

Differential Revision: D5052149

fbshipit-source-id: 43f3877ceea038762ded6c42ab0481d215db2118
2017-05-12 10:37:03 -07:00
David Aurelio c44e37bf74 Require transformer options to be present throughout
Summary: `transformModulePath` used to be an optional string, because `ConfigT` allowed for an optional `getTransformModulePath` method. Effectively, we required it to be present. This builds on top of the cleanups around `ConfigT` and gets rid of the flow error suppressions

Reviewed By: jeanlauliac

Differential Revision: D5037466

fbshipit-source-id: bc5c9cbc566e7aa74e7f6397e69fa87cdac7bc00
2017-05-11 16:47:43 -07:00
Gabe Levi 9e6c44095b Deploy v0.46.0
Reviewed By: zertosh

Differential Revision: D5039894

fbshipit-source-id: 2e4a0c26550ae3a0dc01b33d1d939ec0218127be
2017-05-11 09:17:53 -07:00
Jean Lauliac c948ae8168 packager: rename node-haste/index to DependencyGraph
Summary: I've been confused for a long time by this, and I think it's better late than never. I propose we rename that file to make it more explicit where that class lives, and so that it's consistent with the test file, name `DependencyGraph-test.js`

Reviewed By: davidaurelio

Differential Revision: D5020556

fbshipit-source-id: d54a501c3995f3fea16a5bfc6ca72993f73c4873
2017-05-10 03:48:32 -07:00
Max Sherman 7dd2cd30af Fix Promise resolve callback error
Reviewed By: theoy

Differential Revision: D5032525

fbshipit-source-id: 19680cef70f11cccf2abf03d1c1b7e72ac32e43e
2017-05-09 16:47:34 -07:00
Max Sherman de4d35536d Bump packager's inspector message timeout to 30s
Reviewed By: pakoito

Differential Revision: D5024083

fbshipit-source-id: b80054aa995bbd1008479bdb4da001ffa4ac897d
2017-05-09 14:36:12 -07:00
Dan Abramov 863e66e449 Explain how to use React Developer Tools
Summary:
Existing instructions are a bit misleading, as Chrome extension is not supposed to work, but there is still a supported way to run them.
Closes https://github.com/facebook/react-native/pull/13707

Differential Revision: D5010169

Pulled By: gaearon

fbshipit-source-id: f9558c9ccb04196854b2eef6ff40a998350b65db
2017-05-05 11:49:26 -07:00
David Aurelio 11eef69936 Force `'default'` transform variant to be present
Summary: Enforces a `'default'` property to be present on the transform variant mapping. This will allow us to simplify transforms of assets and json to only provide one variant for the new Buck build system.

Reviewed By: jeanlauliac

Differential Revision: D5002052

fbshipit-source-id: 2a7240c1b2450f62de686c46ab2c2e5a75dea399
2017-05-04 08:31:10 -07:00
Jean Lauliac 4a86f93982 packager: add support for relative files with custom extensions
Reviewed By: cpojer

Differential Revision: D4994139

fbshipit-source-id: 5e47c5bc6f8b2cd750f1ca0df940c23234c66600
2017-05-04 05:21:44 -07:00
David Aurelio edf1774945 Resolve path at callsite rather than in `Config.loadFile`
Summary:
Resolve path at callsite rather than in `Config.loadFile`

`Config.loadFile` should not expose unexpected behavior as joining paths together. This moves that responsibility to the call site. `path.resolve` returns the second argument if it is an absolute path.

Reviewed By: bestander

Differential Revision: D4986130

fbshipit-source-id: c80a588ffa86011bcd5a2c393ad5d6eedc6c61ae
2017-05-03 06:51:47 -07:00
David Aurelio b9fb229c80 Get rid of FBism in `Config`
Summary: `cwd` was needed for FB-internal reasons, was untyped, and goes away.

Reviewed By: martinbigio

Differential Revision: D4986076

fbshipit-source-id: b093476cabc4f73fb63d37052f4041073c174f06
2017-05-03 06:51:47 -07:00
David Aurelio 6a4e113736 Stronger config types
Summary:
Splits `ConfigT` into `ConfigT` (core + packager configuration) and `RNConfig` (RN CLI configuration).
Also guarantees that all values on `ConfigT` have a default when loading user configuration.

Reviewed By: jeanlauliac

Differential Revision: D4985965

fbshipit-source-id: bf036e22d6809e49746a9c3aa240ec403a085342
2017-05-03 06:51:47 -07:00
David Aurelio d2505e7615 disable `no-alert` eslint rule for node code
Summary: `no-alert` doesn’t play nice with flow type spreads. We don’t need it for node, anyway.

Reviewed By: jeanlauliac

Differential Revision: D4993096

fbshipit-source-id: 95785843d3263520c063a43864c8053cbaa5083d
2017-05-03 06:51:47 -07:00
Lukas Piatkowski 976a181a1c Add additional post process of SourceMap after the minification of JS
Reviewed By: davidaurelio

Differential Revision: D4955229

fbshipit-source-id: ac4e5f917839d43d73b80d98b4813d8ccf1d41ef
2017-05-03 03:45:41 -07:00
Jean Lauliac e135bacb48 packager: Server: remove last declareOpts usage and replace by Flow types
Summary:
`declareOpts` prevents strong Flow typing, and promotes default values, that may be different from a function to another (my goal is to remove defaults from the whole codebase except perhaps the public API). This changeset replaces it by Flow types and fixes callsites to be explicit on values.

This is the last callsite of `declareOpts` so I'll remove it, in a separate diff.

Reviewed By: cpojer

Differential Revision: D4970650

fbshipit-source-id: e5ea2e06febde892d28c9dc59dc2920d4033bb01
2017-05-03 03:31:30 -07:00
David Aurelio 89b3cc1f2f Replace `Config.get` with three individual methods
Summary:
Gets rid of `Config.get` in favor of three methods with names that express intend. The logic for applying defaults was used from one callsite only, and was moved there.

This is the starting point to make the config loading system a better place, including a strong return type and defaults always applied.

Reviewed By: martinbigio

Differential Revision: D4985774

fbshipit-source-id: 98300547c3eafd5948814d57ce93e71d43572eb8
2017-05-03 03:00:56 -07:00
David Aurelio 58ba7fc075 Unify source map types
Summary: deduplicates / unifies types for source maps across the code base

Reviewed By: jeanlauliac

Differential Revision: D4955924

fbshipit-source-id: 25cb71031dce835dd7d2bc1c27d6b20050906e81
2017-04-28 12:35:23 -07:00
David Aurelio 414d5a3023 Change postprocessing hook to work on `ModuleTransport` instances
Reviewed By: amnn

Differential Revision: D4962283

fbshipit-source-id: 25b609bcd4b8d7a881e35426010f15530548e301
2017-04-28 10:03:07 -07:00
Sokovikov 99341315c4 open in editor fix, show tip instead of error
Summary:
if REACT_EDITOR not set we need to show a pro tip. For now error is shown

now:

<img width="967" alt="screen shot 2017-04-11 at 14 48 06" src="https://cloud.githubusercontent.com/assets/1488195/24905942/da7ae876-1ec6-11e7-8f4d-a2505ee1958f.png">

after fix:

<img width="641" alt="screen shot 2017-04-11 at 14 49 38" src="https://cloud.githubusercontent.com/assets/1488195/24905957/e60637d6-1ec6-11e7-92ad-ba03dbf3ebff.png">

1) REACT_EDITOR is not set
2) use unknown or terminal editor (I use neovim)
3) make a red box in UIExplorer
4) click on stacktrace line
Closes https://github.com/facebook/react-native/pull/13443

Differential Revision: D4963762

Pulled By: hramos

fbshipit-source-id: 8425d6e7c6f786e8ac51ebc9b7d721bb69dd7313
2017-04-28 06:18:30 -07:00
Ashok Menon 978592faab Order modules in bundle by path.
Reviewed By: davidaurelio

Differential Revision: D4835227

fbshipit-source-id: 4974036fed7452447501fc07445afaa349e521c9
2017-04-27 17:46:40 -07:00
Gabe Levi a7009077ed Deploy v0.45.0
Reviewed By: samwgoldman

Differential Revision: D4965967

fbshipit-source-id: 090f35efe225b1803141d3062d68e1e626907029
2017-04-27 17:20:46 -07:00
Jean Lauliac 1f8d1002ef packager: buck library: expose asset content
Reviewed By: davidaurelio

Differential Revision: D4945778

fbshipit-source-id: ea132a3d284ed09c59c69afbdd7b707af9e521b9
2017-04-25 12:04:01 -07:00
David Aurelio 3e08a28987 Remove irrelevant options from cache key
Reviewed By: jeanlauliac

Differential Revision: D4938131

fbshipit-source-id: 88b686bc5ee6946297e1fd1b91d46fa618f0d9d7
2017-04-25 04:02:06 -07:00
Paulus Esterhazy c58e19ef33 Fix run-ios when specifying a scheme as cli arg
Summary:
The cli arg `--scheme` allows you to override the inferred scheme.
The runOnDevice command takes this override into account, but run-ios
doesn't. This commit fixes this discrepancy.

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.

Currently if a custom scheme is specified, `run-ios` will fail with the following message

```
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
```

This PR fixes this.

Tested manually from CLI.
Closes https://github.com/facebook/react-native/pull/13548

Differential Revision: D4914531

Pulled By: javache

fbshipit-source-id: 071710947e90e6194e0229751e33068565e010b2
2017-04-19 11:30:36 -07:00
Jean Lauliac aef286791a packager: assetPathUtils: @flow
Reviewed By: cpojer

Differential Revision: D4913888

fbshipit-source-id: 31ddb4b9ede65e1b6caf740a245c3a11326d15d6
2017-04-19 10:41:08 -07:00
Gabe Levi 92f900c79d Upgrade to v0.44.0
Reviewed By: zertosh

Differential Revision: D4893660

fbshipit-source-id: ed85f5d4c585164d464a7e009888a28e5af339cd
2017-04-17 09:33:20 -07:00
Brian Vaughn 6564edce5e Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github
Reviewed By: acdlite

Differential Revision: D4876709

fbshipit-source-id: 3a5e92bfc74287b7a9054546c438580bed0147af
2017-04-12 16:15:15 -07:00
Christoph Pojer deebf15a56 Move formatBanner into packager folder
Reviewed By: davidaurelio

Differential Revision: D4868954

fbshipit-source-id: 7a28019c781262bcf4aab0ad2e67868d35ebf9fb
2017-04-12 02:44:51 -07:00
Karan Thakkar 840dc0cc82 Allow configuring the app source folder for android
Summary:
I have been working on integrating React Native into an existing app and realised that the source folder for android code is currently hardcoded as `app`. Being a legacy codebase we can't really change that. So I wanted to be able to customise this folder name so that I can integrate RN seamlessly and start it from the CLI without having to run it from Android Studio.

- Create a barebones RN app
- `react-native run-android` works successfully
- Refactor the name of the app folder inside the android directory to `TestFolderName` using Android Studio
- `react-native run-android` now fails
- Changing this command to `react-native run-android --appFolder=TestFolderName` works successfully
Closes https://github.com/facebook/react-native/pull/13273

Differential Revision: D4833396

Pulled By: ericvicenti

fbshipit-source-id: 4c62cee6aaa2cc78eede5c7756459430022fffde
2017-04-11 12:25:39 -07:00
Andres Suarez e67b8fe761 Use flow 0.43.1
Reviewed By: nmote

Differential Revision: D4851923

fbshipit-source-id: 018f61c3a45e32c899287848d36129e3601145a4
2017-04-08 14:05:11 -07:00
Adam Perry 403f356082 Stop yarn error message appearing for Windows users of local-cli
Summary:
On windows, recent versions of local-cli will display a yarn error to stderr when starting the packager (see https://github.com/expo/xde/issues/91, https://github.com/react-community/create-react-native-app/issues/101, https://github.com/react-community/create-react-native-app/issues/113#issuecomment-289185491 for examples of users hitting this in the wild), even though no package management action is being taken.

From what I can tell this is what happens:

* [`local-cli/util/yarn.js` does not ignore stderr on Windows](6fa87134fc/local-cli/util/yarn.js (L25))
* [`local-cli/util/PackageManager.js` calls the above function when it's require'd](6fa87134fc/local-cli/util/PackageManager.js (L20))

For Windows users who don't have yarn installed, this means that the 'yarn is not recognized as an internal or external command..." error displays wh
Closes https://github.com/facebook/react-native/pull/13355

Differential Revision: D4848084

Pulled By: hramos

fbshipit-source-id: f32176354e0bd7ff6d7009ea30dca64ff23ae3d5
2017-04-07 11:17:00 -07:00
Max Sherman 6fa87134fc Use the absolute path to the sourcemap in the CS bundle
Reviewed By: davidaurelio

Differential Revision: D4831377

fbshipit-source-id: b7da81264a65bea1827237cdd34567b29579acd4
2017-04-06 09:30:31 -07:00
Gabe Levi 4f243f1ecd Deploy v0.43.0
Reviewed By: zertosh

Differential Revision: D4835081

fbshipit-source-id: a9ab33648320fb19b8cc7ab212e68fada7810b90
2017-04-05 18:31:06 -07:00
Vojtech Novak cd4545f812 configurable devEnabled in React.gradle
Summary:
This PR adds support for configurable devEnabled option when building an android app. This is currently hardcoded.

The reason for making this configurable is this: I have an app that uses code-push and 3 buildConfigs. I want to have a debugging version which has `devEnabled = true`, then a staging version which has `devEnabled = false` (this version of the app is used internally for testing and should behave just like a release version of the app, and when the tests succeed the changes are promoted into the release version to the users out there, using code-push). The last version is a standard release version with `devEnabled = false`.

Currently, `devEnabled` is hardwired like this: `!targetName.toLowerCase().contains("release")` so by default my `staging` buildConfig will have `devEnabled = true` but I'd like it to be false.

With this PR it'd be possible to configure this as follows, while not breaking the current behavior.
`'devDisabledIn${productFlavor}${buildType}'`
`'devDisabledIn${buildType
Closes https://github.com/facebook/react-native/pull/11438

Differential Revision: D4630513

Pulled By: hramos

fbshipit-source-id: b6817cf4c144fc948f76785e9cb5f93a13a6a6a2
2017-04-05 12:50:31 -07:00
Fred Blau d8f23f79c7 Allow specifying an appIdSuffix to run-android
Summary:
Motivation

Currently react-native run-android instals and starts your app, but if you have more than one variant, it doesn't know which one to start.  This allows developers to pass in the suffix specified in build.gradle, so that the correct app is started.

Test Plan

verify that `react-native run-android` runs properly
verify that `react-native run-android --appIdSuffix validSuffix` runs properly
Closes https://github.com/facebook/react-native/pull/13169

Differential Revision: D4823391

Pulled By: ericvicenti

fbshipit-source-id: 31ed35fd79403804b4781e81eb49f1c4627d7f8e
2017-04-04 16:45:27 -07:00
Sai Grandhi 0fe0fc038b Make copy button work on android emulator in Linux using xsel
Summary:
Resolves issue [#13165](https://github.com/facebook/react-native/issues/13165). The copy button in the redbox for RN android is not currently supported for Linux. This pull request provides the copy button functionality to Linux RN users.

I have tested the updated code locally.
Firstly, I edited `index.android.js` that caused the following error.
![pasted image at 2017_03_27 10_21 am](https://cloud.githubusercontent.com/assets/22376429/24426834/f567c5dc-13d6-11e7-8e3b-a650e2f6237c.png)
After I clicked the copy button and pasted from the clipboard into the chrome address bar, the message appeared.
![pasted_image_at_2017_03_27_10_21_am](https://cloud.githubusercontent.com/assets/22376429/24426896/2c0d4d64-13d7-11e7-8650-da19c44b177d.png)
Closes https://github.com/facebook/react-native/pull/13188

Differential Revision: D4819796

Pulled By: ericvicenti

fbshipit-source-id: 9adc6e93330f89240a505a403e4913dc10e5a31f
2017-04-04 10:20:19 -07:00
Jean Lauliac 8755338728 packager: get rid of type `any` in ResolutionRequest
Summary:
One of my changeset broke the "ModuleGraph" code without warning earlier because we are using `any`, that equivalent to having no typing at all. This changeset fixes the types so that `ResolutionRequest` is exactly what it actually is: a class usable for any `Module`-looking class, including the normal one, and the "ModuleGraph" one used for Buck builds. That way, the ModuleGraph's `Module` is typechecked against `Moduleish`.

Concretely this change mostly migrates the `Module` to its generic parameter counterpart `TModule` inside `ResolutionRequest`.

Reviewed By: kentaromiura

Differential Revision: D4826256

fbshipit-source-id: fcd7ca08ac6c35e4e9ca983e2aab260e352bcb4e
2017-04-04 07:15:23 -07:00
Jhen d38644eee5 Add Atom Beta to launchEditor
Summary:
Support [the pre-release of Atom](https://github.com/atom/atom/releases/tag/v1.16.0-beta0) for launchEditor in RN packager.

Open the pre-release of Atom and use the following code: (use the built-in [openFileInEditor](292cc82d0e/Libraries/Core/Devtools/openFileInEditor.js) module)

```js
import openFileInEditor from 'openFileInEditor'

openFileInEditor(file, lineNumber)
```
Closes https://github.com/facebook/react-native/pull/13255

Differential Revision: D4819130

Pulled By: ericvicenti

fbshipit-source-id: eb542295ee9489dad0fe9084e51c4141d33f1fbf
2017-04-03 09:15:29 -07:00
Shruti Malugu edbb48c67a Replacing all instances of [UIApplication sharedApplication] wi…
Summary:
…th RCTSharedApplication()

Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
          Using React Native latest version with Cocoapods 1.2.0 causes the following error inside iOS app extensions

> /react-native/React/Modules/RCTAccessibilityManager.m:67:70: ‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.

Moving the use of [UIApplication sharedApplication] to RCTSharedApplication() which is safe on app extension

- [ ] Provide a **test plan** demonstrating that the code is solid.
        I am not sure how to test such that all the features which touch the modified code are tested.

- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?
    Using React Native latest v
Closes https://github.com/facebook/react-native/pull/13227

Differential Revision: D4816338

Pulled By: javache

fbshipit-source-id: e3e3c77882990ad1817b0b633521cff52571ecd0
2017-04-01 03:34:41 -07:00
Koen Punt 8daf985fc3 match plist indentation with xcode format
Summary:
xcode has its own way of indentation of the plist.

fixes #11668
Closes https://github.com/facebook/react-native/pull/11670

Differential Revision: D4410865

fbshipit-source-id: 8c65e7719d228b07f58b1ccb86b369e319067f02
2017-03-31 03:03:10 -07:00
Brent Vatne b80e2c8799 Move packager initialization events to reporter
Summary:
This PR depends on #13172

Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter.

- We [log a banner with some information about the port and what's going on](8c7b32d5f1/local-cli/server/server.js (L22-L32))
- Also [a message about looking for JS files](8c7b32d5f1/local-cli/server/server.js (L34-L38)) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing).
- If the packager fails to start, then [we log an error message](8c7b32d5f1/local-cli/server/server.js (L41-L61)).

This pull request changes those log messages to be handled by TerminalReporter. I tri
Closes https://github.com/facebook/react-native/pull/13209

Differential Revision: D4809759

Pulled By: davidaurelio

fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
2017-03-31 02:17:22 -07:00
Brent Vatne 5f5da4e122 Add support for custom log reporter cli option for local server
Summary:
In Expo tools such as XDE, exp we listen listen to stdout from the packager process and print it in our own buffer. In the case of XDE, an electron app, our log pane is DOM-based, and before printing each log chunk we need to remove special tty characters and sometimes parse it to get information that we need (eg: progress bar). By using a custom reporter, we can take the raw events and pass them along in a format that is easy to consume by XDE and exp. This same motivation applies to create-react-native-app, where we currently don't show a progress bar in the terminal, but we can with this change.

Create `LogReporter.js` in the root of a project with the CLI changes included in this PR.

```
class LogReporter {
  update(event) {
    console.log(JSON.stringify(event));
  }
}

module.exports = LogReporter;
```

Now, run `react-native start --customLogReporterPath=LogReporter.js` -- all of the raw events will be output as JSON (while the logs
Closes https://github.com/facebook/react-native/pull/13172

Differential Revision: D4795760

Pulled By: hramos

fbshipit-source-id: 80164b2f30e33a3f9965f4865a8404f8640a52c1
2017-03-30 18:15:49 -07:00
Sam Corcos c31a65669e Add comma to prevent build error when react.gradle is uncommented
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
- [ ] Provide a **test plan** demonstrating that the code is solid.
- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

At the moment, if you uncomment the react specific code in `build.gradle` you'll get a compilation error. Adding a comma prevents this error.

No tests are necessary. This is a simple fix.

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/martink
Closes https://github.com/facebook/react-native/pull/13212

Differential Revision: D4802065

Pulled By: javache

fbshipit-source-id: 0ddfe16241381d7e4ac0e48be1bada21d9df2068
2017-03-30 10:20:56 -07:00
Build Service 12de9729bd @allow-large-files [i18n] remove unused generated strings.xml files on master
fbshipit-source-id: c3151e7f8c346b1ece67ea37b88110b16e1a9107
2017-03-29 21:02:38 -07:00
Build Service 7f35abb26a @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/instagram.config.json on master
fbshipit-source-id: 680e36c342abcc80279979ca461eb08449d535bb
2017-03-29 21:02:38 -07:00
Build Service c21760af4f @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: e973b0d453b88fc9f6cf54e1fd97ef7780cafe87
2017-03-29 21:02:38 -07:00
Build Service b6f1a3b6d7 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: f52efb222ea7385f8d291395b2edef5f28dea713
2017-03-29 21:02:38 -07:00
Build Service 944adb76d1 @allow-large-files [i18n] remove unused generated strings.xml files on master
fbshipit-source-id: 8efabef352fa71b3c18c1a8e318d66850fdd5e56
2017-03-29 17:13:58 -07:00
Build Service 9a596018f8 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/instagram.config.json on master
fbshipit-source-id: 951f549645f4010bd01ab6486a2b3b617a901b04
2017-03-29 17:13:58 -07:00
Build Service 5012f8938e @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: 2d84aa83e9efaaa89838da7c8d9595692b6bccdd
2017-03-29 17:13:58 -07:00
Build Service 7f346973d1 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: 156680756e04fc7ef69017c49324ff0b7acd030f
2017-03-29 17:13:57 -07:00
Benjamin Eckel 140c5f657c Make run-ios --device example copy-pastable
Summary:
This changes the single quotes to double quotes so this command can be copy-pasted.

If a user copy pastes the run-on-device example in bash they will be presented with a confusing prompt because bash expects another terminating single quote.

```
~ben (master *) ~/code/transit: react-native run-ios --device 'Max's iPhone'
>
>
```

It seems minor but this could be just confusing enough to frustrate a beginner or someone not familiar with bash.

This can be tested by running:

```
react-native run-ios --help
```

and verifying that the "run on device" example is changed:

```diff
- react-native run-ios --device 'Max's iPhone'
+ react-native run-ios --device "Max's iPhone"
```
Closes https://github.com/facebook/react-native/pull/13145

Differential Revision: D4776305

Pulled By: hramos

fbshipit-source-id: 9500551bfc106cd1687468f7ecc4c91089e1f703
2017-03-29 11:45:56 -07:00
Tim Yung 5643bbc11d RN: Add "Maintain Priority" Checkbox
Summary:
Adds a new checkbox to the Chrome Debugger page that prevents the tab from being deprioritized by Google Chrome.

This is accomplished by embedding an inaudible sound byte (in 10Hz range) that loops on a low volume.

Reviewed By: kassens

Differential Revision: D4786288

fbshipit-source-id: 949d96ed3c0eac92ad56cdd119418df9ec6d0846
2017-03-28 18:50:56 -07:00
Tim Yung 696b49e3b8 RN: Refactor Chrome Debugger JS
Summary:
Refactors JavaScript in the `debugger.html` used to operate the Chrome Debugger.

- Pull out all view-related logic into a global `Page` object.
- Persist the dark theme across debug sessions using `localStorage`.

Reviewed By: kassens

Differential Revision: D4786235

fbshipit-source-id: ab959d1c95465a10b4538b14d9c87a51ae3b7078
2017-03-28 18:50:56 -07:00
jrodiger f891985bd8 Update runAndroid.js to fix startServerInNewWindow() (Windows)
Summary:
**Motivation**
Resolves issue: #12367. The issue is that the packager does not launch automatically on Windows when running `react-native run-android` like it does on OSX. The proposed change fixes this issue, and causes the packager to be launched automatically on Windows 10. Also note the updated code uses the syntax described in the [Node.js documentation](https://nodejs.org/api/all.html#child_process_spawning_bat_and_cmd_files_on_windows) on spawning .bat files on Windows.

**Test plan**
Manually tested on Windows 10.

Running just `react-native run-android` now results in the packager launching, without needing to run `react-native start` in a new command prompt window.

**Screenshot:**
![packager](https://cloud.githubusercontent.com/assets/17132071/23641540/8d82bb7c-02c2-11e7-9c47-d1c9b582bd65.png)
Closes https://github.com/facebook/react-native/pull/12755

Differential Revision: D4767321

fbshipit-source-id: a14f369ba99939aa44d0ee3403e1d262e2657e6e
2017-03-23 18:20:10 -07:00
Gabe Levi d868e86df0 Deploy v0.42.0
Reviewed By: zertosh

Differential Revision: D4732064

fbshipit-source-id: 12fb8f9aff983ff5d1cb01f413bab761259829f9
2017-03-23 16:46:23 -07:00
Yann Pringault 8a8f34ae10 Improve dark mode for debugger
Summary:
* Added a label so we can click on the text to toggle the dark mode
* Added `height: 100%` in the CSS to make the dark background fill the entire view
* Improving JS code with `classList.toggle()` instead of redundant `if else` and fragile `document.styleSheets` access
* Adjusted the link color in dark mode to be less flashy

![image](https://cloud.githubusercontent.com/assets/5436545/24155304/bb80bb9a-0e53-11e7-9298-ce2c1ec6672c.png)

![image](https://cloud.githubusercontent.com/assets/5436545/24155311/c27e85f8-0e53-11e7-87ae-0245f54870c5.png)
Closes https://github.com/facebook/react-native/pull/13052

Differential Revision: D4748893

fbshipit-source-id: a81266c52b24f8e5dcedf0b9f37134688342d8d2
2017-03-23 04:38:57 -07:00
Dan Abramov c451dd6cce Update message with instructions
Summary:
The middleware for automatically converting Systrace traces to HTML and popping the browser hasn't worked properly for a while, since the version on Homebrew generates some code that uses `Object.observe`, which was deleted from Chrome ages ago. People have complained about it, but fixing it properly has proven to be harder than expected, so I suggest we simply update the message with instructions for people to load it on Chrome, which is what all of us have been doing anyway (AFAIK).
Closes https://github.com/facebook/react-native/pull/12445

Reviewed By: javache

Differential Revision: D4700153

Pulled By: gaearon

fbshipit-source-id: 0c33099babed93b3c70d36ae9dfc7d82460c8269
2017-03-20 10:49:43 -07:00
Nick cbd46aaa7c more accurate product-name regex
Summary:
Some projects define multiple targets, including app extensions, which are built with a “.appex” extension.   This fix prevents the buildProject method from selecting any app extension (e.g. a Today.appex today-widget extension) as the product name.

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.

When building our workspace, ReactNative was failing to install the app to the simulator because it calculated an incorrect path to the app itself.   It was attempting to install "Today.app" when it should have been installing "Remitly.app".   I discovered that ReactNative parses the build output to identify the generated app name, and that this was broken when the build also generated an app extension.  The f
Closes https://github.com/facebook/react-native/pull/13001

Differential Revision: D4735360

fbshipit-source-id: afeeb2073ccd65c95916b153fcde574b5343af8c
2017-03-18 13:16:08 -07:00
Lukas Piatkowski 60142adc72 Extract PackagerConnectionSettings to ensure easier reusability of PackagerConnection module
Reviewed By: cwdick

Differential Revision: D4689535

fbshipit-source-id: f698837f407a03bf91521cc5e921c66f5755e6e0
2017-03-17 10:02:34 -07:00
Andrew Jack 35046984db Add TextLayoutBuilder proguard rule
Summary:
To enable users to use run proguard in their Android applications.

Fixes: #11891

[TextLayoutBuilder](https://github.com/facebookincubator/TextLayoutBuilder) is built as a Jar rather than an AAR so the proguard rules cannot be provided with the binary.

This PR adds the rules that are included in TextLayoutBuilder https://github.com/facebookincubator/TextLayoutBuilder/blob/master/proguard-android.txt

- Created an `react-native init ProguardTest` project with proguard turned on for v0.41.0
- Make sure tests pass on both Travis and Circle CI.
Closes https://github.com/facebook/react-native/pull/12511

Differential Revision: D4718029

Pulled By: mkonicek

fbshipit-source-id: 9e3f11c8b9b54eb8e52aa6f44cacd00857a882a5
2017-03-15 17:46:15 -07:00
Charles Dick af590b0c74 remove the old heap profiler visualization code
Differential Revision: D4650983

fbshipit-source-id: 1f791acdd3e2d96e7881ea037045fafa2c6d781a
2017-03-15 06:47:34 -07:00
Jean Lauliac 7098c450d8 packager: attachHMRServer.js: Flow
Summary:
The breakage fixed by changeset [1] could have been identified earlier if we had typing on `attachHMRServer`, so I spent some time on that. This has revealed in turn a few functions across the codebase that were incorrectly typed, and that are now fixed.

[1] packager: attachHMRServer.js: fix callsite of Server#getModuleForPath()

Reviewed By: davidaurelio

Differential Revision: D4706241

fbshipit-source-id: fc4285245921ae45d5781a47d626fc0559dba998
2017-03-15 06:20:48 -07:00
Jean Lauliac 4ac585b34b packager: attachHMRServer.js: fix callsite of Server#getModuleForPath()
Summary: In a previous changeset, Server#getModuleForPath() started returning `Promise<Module>` instead of `Module`, but the callsites in HMR haven't been updated, causing it to break. This would have been caught if `attachHMRServer.js` was using flow, that I'm considering doing in a following up diff. This would also have been caught if we had better integration testing of HMR. Good news however,it was caught by the OSS e2e test, that covers Hot Reloading.

Reviewed By: davidaurelio

Differential Revision: D4705937

fbshipit-source-id: fe787bc6ae50024759c7f7aeed747394fdce9aa1
2017-03-14 11:32:54 -07:00
Jean Lauliac 4203c9c837 packager: fix buildBundle() options
Summary: The problem with `bundleOpts` is that it discards Flow typing, so it prevents reinforcing the integration of `Bundler` into `Server`. This changeset removes the `bundleOpts` to solve that issues. Instead, it makes the options explicit so that there is less uncertaintly. I love making options explicit, because they force callsites to take a consicious decision about what is really needed, making them more robust. They also expose oddities that probably needs refatoring, for example having a `resolutionRequest` in the bundle options does not seem correct, it should be an implementation details. Likewise, `onProgress` should probably be exposed differently, as it does not affect the content of the bundle itself.

Reviewed By: davidaurelio

Differential Revision: D4697729

fbshipit-source-id: d543870ba024e7588c10b101fa51429c77cc5ddc
2017-03-14 11:04:51 -07:00
Yann Pringault 68695bdb26 Fix indent for .babelrc in HelloWorld template
Summary:
Minor code formatting.
Each time I run `react-native init` I must reindent this file.
Closes https://github.com/facebook/react-native/pull/12850

Differential Revision: D4691374

fbshipit-source-id: dc02b021e2f320f1046e4e6d024ba675a4213de8
2017-03-10 13:45:58 -08:00
Richard Evans 4471c32b08 CLI: Assign project root concat back to project roots.
Summary:
With the latest version of React Native I noted my setup with React Native Storybook stopped working because it stopped searching all the right project roots. I found that it had to do with the change here bce6ece5f6

**Test plan (required)**

Run the CLI with a project root other then the root directory and ensure that it displays both the specified project root and the actual root directory.
Closes https://github.com/facebook/react-native/pull/12659

Differential Revision: D4658137

Pulled By: ericvicenti

fbshipit-source-id: 97d3784348f92394df111f189c6b00dd0165b75e
2017-03-06 00:19:20 -08:00
Alexey Kureev c97c1e5516 Fix symlink resolving for examples in the repo
Summary:
Motivation:
Few days ago gaearon [filed an issue](https://github.com/facebook/react-native/issues/12406) that examples in the react-native repo doesn't work after the [recent changes in local-cli](bce6ece5f6). This PR fixes reported bug.

**Test plan (required)**
- No UI changes
- [x] Run UIExplorer from XCode (no package.json in the folder) and check if packager/application runs correctly

cc davidaurelio satya164 grabbou
Closes https://github.com/facebook/react-native/pull/12435

Differential Revision: D4657370

Pulled By: ericvicenti

fbshipit-source-id: 72ee4b96cae37c7ed2794ed4490ce7b4fbbd66c3
2017-03-05 17:34:41 -08:00
Jeff Morrison 59257d6976 fbobjc
Reviewed By: gabelevi

Differential Revision: D4652687

fbshipit-source-id: 6069c8bc24f0b88da3537ada877cdb7d1d4eccfd
2017-03-04 19:30:34 -08:00
Ke Mao 8bfab2c733 Improve command-line experience for capturing mobile JS heap
Reviewed By: cwdick

Differential Revision: D4612319

fbshipit-source-id: 607a09286abdd83368996ffc553b3ce984b62f34
2017-03-01 19:26:28 -08:00
Eli Perkins 1b0d8ac43b Use appropriate capitalization of Xcode
Summary:
[Xcode](https://developer.apple.com/xcode/) is spelled with a lowercase `c`. 😄

**Test plan (required)**

ctrl-f project for `XCode`, case sensitive, find-and-replace with `Xcode`.

Make sure tests pass on both Travis and Circle CI.
Closes https://github.com/facebook/react-native/pull/12572

Differential Revision: D4622075

Pulled By: hramos

fbshipit-source-id: d64f0b10254cd624a71844ebaefa6fc29bc1ea57
2017-02-27 22:47:14 -08:00
Bhuwan Khattar 234f4f538d Introduce HasteImpl
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.

This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations

Reviewed By: davidaurelio

Differential Revision: D4589372

fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
2017-02-27 14:04:58 -08:00
Martin Konicek 17c175a149 CLI: Add support for templates fetched from npm
Summary:
This PR allows anyone to publish templates for React Native.

It's possible for people to publish modules for React Native, we should also support custom templates. A suggestion from a Cordova mantainer where they did the same thing suggests this is useful:
https://github.com/mkonicek/AppTemplateFeedback/issues/1

I published a sample template [react-native-template-demo](https://www.npmjs.com/package/react-native-template-demo).

(GitHub: https://github.com/mkonicek/react-native-template-demo)

With this PR anyone can then use that template:

`react-native init MyApp --template demo`

The convention is: if someone publishes an npm package called `react-native-template-foo`, people can use it by running `react-native init MyApp --template foo`.

Use a template called `react-native-template-demo` from npm:

`react-native init MyApp --template demo`

Use a local template:

`react-native init MyApp --template file:///path_to/react-native-template-dem
Closes https://github.com/facebook/react-native/pull/12548

Differential Revision: D4620567

Pulled By: mkonicek

fbshipit-source-id: bb40d457a7fec28edb577f08137e73241072de3a
2017-02-27 14:04:57 -08:00
Michael Bolin 48cb932c6e Apply auto-formatter for BUCK files in fbandroid.
fbshipit-source-id: 278ce6f67f5df830b2218e3aca69be103d3c56a6
2017-02-27 14:04:56 -08:00
Gabe Levi 4a60be62bc Deploy v0.40.0
Reviewed By: yungsters

Differential Revision: D4612331

fbshipit-source-id: 3eaa2f99d3181227166064cbee29b9245401a775
2017-02-24 12:45:56 -08:00
Adam Miskiewicz b0bdbeb5c3 Fix flowconfig in starter project
Summary:
In the .flowconfig in the starter project, we're missing the correct suppression comments.

This should fix the flow issues in the e2e tests.
Closes https://github.com/facebook/react-native/pull/12533

Differential Revision: D4603657

Pulled By: ericvicenti

fbshipit-source-id: a07ec947d3ba746279c58e2d95c2293f54e06933
2017-02-22 19:52:08 -08:00
Martin Konicek df008a31e4 CLI template: Bump version of react-navigation dependency
Summary: Beta 1 is old, bump to the latest version.

Reviewed By: mkonicek

Differential Revision:
D4601561
Ninja: OSS only

fbshipit-source-id: f0aa7aa861dc2a2cb40ac171259c69b7d47d0dc4
2017-02-22 15:31:07 -08:00
Lukas Piatkowski a2addbd932 BREAKING: Change the js1 - packager - RN App protocol to version 2
Reviewed By: cwdick

Differential Revision: D4551991

fbshipit-source-id: 395c38ee5c71ddc24d8743e7ec90cc89de087503
2017-02-16 04:30:00 -08:00
Michael Bolin f9df89ac95 Fix copy/paste bug in open source BUCK file for React Native.
Reviewed By: bestander, lacker

Differential Revision: D4562337

fbshipit-source-id: 2ca24344435b650a9c740eba9b196e70015b5cdb
2017-02-15 09:46:24 -08:00
Moses Gunesch c6c1c02b75 Don't add duplicate font entries to plist during link (iOS)
Summary:
**Test plan**

1. Add fonts using `react-native link` and a `"rnpm"` config in package.json
2. Manually delete one or more fonts from Xcode's Resources folder using Remove References option
3. Run `react-native link` again

With the patch in this PR, the plist will not accidentally get populated with duplicate entries.
Closes https://github.com/facebook/react-native/pull/12048

Differential Revision: D4560432

fbshipit-source-id: aba3733acfd5373f8d654406b06b8338b137bc07
2017-02-14 17:16:54 -08:00
Dan Abramov 934cd82941 Move DevTools integration into its own repo
Summary:
The way React DevTools integration was set up in RN was not entirely supported by the React team, and we had to disable it in c3b25c9059 so that we can move forward with enabling Fiber support in React Native.

Here, I am moving the DevTools client setup from RN repo to [React DevTools repo](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/README.md#requirereact-devtools-coreconnecttodevtoolsoptions) so that we can keep it in sync with the rest of React DevTools. This is also a part of a larger effort to consolidate DevTools code (https://github.com/facebook/react-devtools/issues/489). It allows us to remove the double injection of the hook, an lets us replace the `eval` hack with a regular dependency. The implementation [lives here now](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/src/backend.js).

This change re-enables Nuclide Inspector with React Native Stack reconciler and prepares it for compatibi
Closes https://github.com/facebook/react-native/pull/12316

Reviewed By: zertosh

Differential Revision: D4545322

Pulled By: gaearon

fbshipit-source-id: ab949916c1a92c6b41cd41e7e1edf9697a71de2e
2017-02-14 14:03:46 -08:00
Lukas Piatkowski d8f48d1b51 Refactor the packager server for further protocol changes
Reviewed By: cwdick

Differential Revision: D4543321

fbshipit-source-id: f7d5823b0d340f8ca17b3dd6caf4e158fa918bcf
2017-02-14 09:45:57 -08:00