Support custom metro ports (#2050)
Summary: Based on issue https://github.com/facebook/flipper/issues/1509 I needed a custom port for the metro server to pass to flipper. ## Changelog introduce `METRO_SERVER_PORT` env variable to be able to customize default 8081 port on startup. Pull Request resolved: https://github.com/facebook/flipper/pull/2050 Test Plan: Tested with a locally built linux desktop app, this seems to work OK pour hermes debugging & RN logging. React DevTools don't seem to find the running app, maybe there's a mapping to handle there too ? Reviewed By: jknoxville Differential Revision: D27339006 Pulled By: passy fbshipit-source-id: b1700c4fe73f14bf4617e23583b2954012e0a5aa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c183ba33c5
commit
f25d189aa5
@@ -23,7 +23,10 @@ import ErrorScreen from './ErrorScreen';
|
||||
import ChromeDevTools from './ChromeDevTools';
|
||||
|
||||
const POLL_SECS = 5 * 1000;
|
||||
const METRO_HOST = 'http://localhost:8081';
|
||||
const METRO_PORT_ENV_VAR = process.env.METRO_SERVER_PORT || '8081';
|
||||
const METRO_PORT = isNaN(+METRO_PORT_ENV_VAR) ? '8081' : METRO_PORT_ENV_VAR;
|
||||
const METRO_URL = new URL('http://localhost');
|
||||
METRO_URL.port = METRO_PORT;
|
||||
|
||||
export type Target = Readonly<{
|
||||
id: string;
|
||||
@@ -87,7 +90,7 @@ export default class extends FlipperDevicePlugin<State, any, any> {
|
||||
}
|
||||
|
||||
checkDebugTargets = () => {
|
||||
fetch(`${METRO_HOST}/json`)
|
||||
fetch(`${METRO_URL.toString()}json`)
|
||||
.then((res) => res.json())
|
||||
.then(
|
||||
(result) => {
|
||||
|
||||
Reference in New Issue
Block a user