react-native/local-cli
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
..
__mocks__ Fix lint in local-cli 2016-11-14 11:13:42 -08:00
bundle packager: fix buildBundle() options 2017-03-14 11:04:51 -07:00
core Fix symlink resolving for examples in the repo 2017-03-05 17:34:41 -08:00
dependencies Introduce HasteImpl 2017-02-27 14:04:58 -08:00
eject Eject CLI command to re-create native folders 2017-02-03 12:58:46 -08:00
generator CLI: Add support for templates fetched from npm 2017-02-27 14:04:57 -08:00
init CLI: Add support for project templates 2017-02-06 12:31:25 -08:00
install Use Yarn for Install/Uninstall CLI if available 2017-02-02 05:13:33 -08:00
library Fix lint in local-cli 2016-11-21 10:28:34 -08:00
link Use appropriate capitalization of Xcode 2017-02-27 22:47:14 -08:00
logAndroid Use native Promise in local-cli 2016-11-21 10:28:34 -08:00
logIOS Use native Promise in local-cli 2016-11-21 10:28:34 -08:00
runAndroid Update runAndroid.js to fix startServerInNewWindow() (Windows) 2017-03-23 18:20:10 -07:00
runIOS Make run-ios --device example copy-pastable 2017-03-29 11:45:56 -07:00
server Add support for custom log reporter cli option for local server 2017-03-30 18:15:49 -07:00
templates Add comma to prevent build error when react.gradle is uncommented 2017-03-30 10:20:56 -07:00
upgrade New upgrading process, relying on Git 2016-11-28 08:28:35 -08:00
util Use Yarn for Install/Uninstall CLI if available 2017-02-02 05:13:33 -08:00
.eslintrc Support copy to clipboard on Windows 2017-01-19 16:28:39 -08:00
cli.js packager: centralize babelRegisterOnly callsites 2017-01-06 06:13:54 -08:00
cliEntry.js Merge `rnpm config` with the `cli config`, step 1 2017-01-09 07:58:33 -08:00
commands.js Eject CLI command to re-create native folders 2017-02-03 12:58:46 -08:00
setup_env.bat Fix comments on .bat file 2015-10-28 21:36:07 -04:00
setup_env.sh Change ulimit to 2048 for non root Mac users 2016-02-06 11:45:37 -08:00
wrong-react-native.js Fix usage of react-native cli inside package.json scripts 2016-04-26 15:42:35 -07:00