EnvironmentInfo as argument to start server

Summary:
Clean initialisation by passing down the environment info to start server.

(Also rename dir to path as that's the name used in other places)

Reviewed By: passy

Differential Revision: D45731751

fbshipit-source-id: a60fdd49c567fc312d1f8da72db3a46a0828c140
This commit is contained in:
Lorenzo Blasa
2023-05-11 04:10:16 -07:00
committed by Facebook GitHub Bot
parent 0f9eeda2dd
commit a96caacb2b
4 changed files with 35 additions and 32 deletions

View File

@@ -102,7 +102,7 @@ async function getFlipperServer(
const execPath =
process.execPath || (await electronIpcClient.send('getProcess')).execPath;
const appPath = await electronIpcClient.send('getPath', 'app');
const staticPath = getStaticDir(appPath);
const staticPath = getStaticPath(appPath);
const isProduction = !/node_modules[\\/]electron[\\/]/.test(execPath);
const env = process.env;
const environmentInfo = await getEnvironmentInfo(
@@ -169,7 +169,7 @@ async function getFlipperServer(
}
const {readyForIncomingConnections} = await startServer({
staticDir: staticPath,
staticPath,
entry: 'index.web.dev.html',
tcp: false,
port,
@@ -182,7 +182,7 @@ async function getFlipperServer(
false,
keytar,
'embedded',
environmentInfo.isHeadlessBuild,
environmentInfo,
);
const companionEnv = await initCompanionEnv(server);
@@ -235,7 +235,7 @@ start().catch((e) => {
'Failed to start Flipper desktop: ' + e;
});
function getStaticDir(appPath: string) {
function getStaticPath(appPath: string) {
let _staticPath = path.resolve(__dirname, '..', '..', 'static');
// fs.existSync used here, as fs-extra doesn't resovle properly in the app.asar
/* eslint-disable node/no-sync*/