Add flipper-server-companion to flipper-server

Summary: Start flipper-server-companion whenever a client connects to flipper-server and sets `server_companion` query parameter in a connection URL to true

Reviewed By: mweststrate

Differential Revision: D36098169

fbshipit-source-id: eb953e7d680b30aef1340f059264112387264c05
This commit is contained in:
Andrey Goncharov
2022-05-10 05:13:24 -07:00
committed by Facebook GitHub Bot
parent a6d7f98cfd
commit b4498f070f
4 changed files with 68 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import {startWebServerDev} from './startWebServerDev';
import yargs from 'yargs';
import open from 'open';
import {sleep} from 'flipper-common';
import {initCompanionEnv} from 'flipper-server-companion';
const argv = yargs
.usage('yarn flipper-server [args]')
@@ -88,6 +89,7 @@ async function start() {
argv.settingsString,
argv.launcherSettings,
);
const companionEnv = await initCompanionEnv(flipperServer);
if (argv.failFast) {
flipperServer.on('server-state', ({state}) => {
if (state === 'error') {
@@ -100,7 +102,7 @@ async function start() {
if (argv.bundler) {
await startWebServerDev(app, server, socket, rootDir);
}
startSocketServer(flipperServer, socket);
startSocketServer(flipperServer, socket, companionEnv);
}
start()