Extract environment config initialisation to server-core

Summary: This diff makes most stuff that is read from the `os` package, and version info etc available from the `serverConfig` object, so that flipper-ui-core no longer needs the `os` package.

Reviewed By: passy

Differential Revision: D32694848

fbshipit-source-id: 93af1e95d898da9aaf351a6970b5a7652ee835c8
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent de59bbedd2
commit 2a4fe77404
22 changed files with 199 additions and 135 deletions

View File

@@ -77,7 +77,7 @@ test('checkDisabled', () => {
try {
hostConfig.processConfig = {
...orig,
disabledPlugins: new Set([disabledPlugin]),
disabledPlugins: [disabledPlugin],
};
const disabled = checkDisabled([]);

View File

@@ -210,7 +210,7 @@ export const checkDisabled = (
config.env.FLIPPER_ENABLED_PLUGINS.split(','),
);
}
disabledList = config.processConfig.disabledPlugins;
disabledList = new Set(config.processConfig.disabledPlugins);
} catch (e) {
console.error('Failed to compute enabled/disabled plugins', e);
}

View File

@@ -95,7 +95,8 @@ export default (store: Store, logger: Logger) => {
const oldExitData = loadExitData();
if (oldExitData) {
const isReload = renderHost.processId === oldExitData.pid;
const isReload =
renderHost.serverConfig.environmentInfo.processId === oldExitData.pid;
const timeSinceLastStartup =
Date.now() - parseInt(oldExitData.lastSeen, 10);
// console.log(isReload ? 'reload' : 'restart', oldExitData);
@@ -370,7 +371,7 @@ export function persistExitData(
? deconstructClientId(state.selectedAppId).app
: '',
cleanExit,
pid: getRenderHostInstance().processId,
pid: getRenderHostInstance().serverConfig.environmentInfo.processId,
};
window.localStorage.setItem(
flipperExitDataKey,