Add isHeadlessBuild to EnvironmentInfo

Summary: Allows to attribute errors to flipper server or flipper electron

Reviewed By: passy

Differential Revision: D36698504

fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
This commit is contained in:
Andrey Goncharov
2022-05-27 02:37:53 -07:00
committed by Facebook GitHub Bot
parent 49eb026769
commit 4eca8d1088
6 changed files with 11 additions and 3 deletions

View File

@@ -51,7 +51,11 @@ async function getEmbeddedFlipperServer(
const staticPath = getStaticDir(); const staticPath = getStaticDir();
const isProduction = !/node_modules[\\/]electron[\\/]/.test(execPath); const isProduction = !/node_modules[\\/]electron[\\/]/.test(execPath);
const env = process.env; const env = process.env;
const environmentInfo = await getEnvironmentInfo(staticPath, isProduction); const environmentInfo = await getEnvironmentInfo(
staticPath,
isProduction,
false,
);
let keytar: any = undefined; let keytar: any = undefined;
try { try {

View File

@@ -104,6 +104,7 @@ export type Platform =
export type EnvironmentInfo = { export type EnvironmentInfo = {
processId: number; processId: number;
isProduction: boolean; isProduction: boolean;
isHeadlessBuild: boolean;
releaseChannel: ReleaseChannel; releaseChannel: ReleaseChannel;
flipperReleaseRevision?: string; flipperReleaseRevision?: string;
appVersion: string; appVersion: string;

View File

@@ -85,7 +85,7 @@ async function start(deviceQuery: string, appName: string, pluginId: string) {
console.debug = () => {}; console.debug = () => {};
console.info = console.error; console.info = console.error;
const environmentInfo = await getEnvironmentInfo(staticPath, false); const environmentInfo = await getEnvironmentInfo(staticPath, false, true);
// TODO: initialise FB user manager to be able to do certificate exchange // TODO: initialise FB user manager to be able to do certificate exchange
const server = new FlipperServerImpl( const server = new FlipperServerImpl(

View File

@@ -16,6 +16,7 @@ import {EnvironmentInfo, ReleaseChannel} from 'flipper-common';
export async function getEnvironmentInfo( export async function getEnvironmentInfo(
packageJsonDir: string, packageJsonDir: string,
isProduction: boolean, isProduction: boolean,
isHeadlessBuild: boolean,
): Promise<EnvironmentInfo> { ): Promise<EnvironmentInfo> {
const packageJson = await fs.readJSON( const packageJson = await fs.readJSON(
path.resolve(packageJsonDir, 'package.json'), path.resolve(packageJsonDir, 'package.json'),
@@ -41,6 +42,7 @@ export async function getEnvironmentInfo(
return { return {
processId: process.pid, processId: process.pid,
isProduction, isProduction,
isHeadlessBuild,
releaseChannel, releaseChannel,
flipperReleaseRevision, flipperReleaseRevision,
appVersion, appVersion,

View File

@@ -75,7 +75,7 @@ export async function startFlipperServer(
console.error('Failed to load keytar:', e); console.error('Failed to load keytar:', e);
} }
const environmentInfo = await getEnvironmentInfo(appPath, isProduction); const environmentInfo = await getEnvironmentInfo(appPath, isProduction, true);
return new FlipperServerImpl( return new FlipperServerImpl(
{ {

View File

@@ -101,6 +101,7 @@ function createStubRenderHost(): RenderHost {
processId: process.pid, processId: process.pid,
appVersion: '0.0.0', appVersion: '0.0.0',
isProduction: false, isProduction: false,
isHeadlessBuild: false,
releaseChannel: ReleaseChannel.DEFAULT, releaseChannel: ReleaseChannel.DEFAULT,
flipperReleaseRevision: '000', flipperReleaseRevision: '000',
os: { os: {