Allow launching inspector from dev menu

Reviewed By: davidaurelio

Differential Revision: D4095356

fbshipit-source-id: 46e43578cdcd663316efb82dffde27b77294c5c0
This commit is contained in:
Alexander Blom
2016-11-15 08:55:39 -08:00
committed by Facebook Github Bot
parent 18184a83f1
commit f571d28e68
7 changed files with 102 additions and 26 deletions

View File

@@ -8,31 +8,16 @@
*/
'use strict';
var child_process = require('child_process');
var execFile = require('child_process').execFile;
var fs = require('fs');
var opn = require('opn');
var path = require('path');
function getChromeAppName() {
switch (process.platform) {
case 'darwin':
return 'google chrome';
case 'win32':
return 'chrome';
default:
return 'google-chrome';
}
}
const child_process = require('child_process');
const execFile = require('child_process').execFile;
const fs = require('fs');
const path = require('path');
const launchChrome = require('../util/launchChrome');
function launchChromeDevTools(port) {
var debuggerURL = 'http://localhost:' + port + '/debugger-ui';
console.log('Launching Dev Tools...');
opn(debuggerURL, {app: [getChromeAppName()]}, function(err) {
if (err) {
console.error('Google Chrome exited with error:', err);
}
});
launchChrome(debuggerURL);
}
function escapePath(path) {
@@ -77,7 +62,7 @@ module.exports = function(options, isChromeConnected) {
// TODO: Remove this case in the future
console.log(
'The method /launch-chrome-devtools is deprecated. You are ' +
' probably using an application created with an older CLI with the ' +
' probably using an application created with an older CLI with the ' +
' packager of a newer CLI. Please upgrade your application: ' +
'https://facebook.github.io/react-native/docs/upgrading.html');
launchDevTools(options, isChromeConnected);