Move settings, launcherSettings, GKs to app / flipper-server-core
Summary: This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests). This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings. Reviewed By: passy, aigoncharov Differential Revision: D32498649 fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eed19b3a3d
commit
bca169df73
@@ -2,6 +2,8 @@
|
||||
|
||||
Stand alone Flipper command, that uses flipper-server-core to connect to apps and dump all incoming messages.
|
||||
|
||||
To get started, run `yarn install` in the `desktop/` folder once.
|
||||
|
||||
This package is currently a proof of concept and can be used like:
|
||||
|
||||
`yarn start --device='iPhone 12' --client='Instagram' --plugin='AnalyticsLogging'`
|
||||
|
||||
@@ -10,7 +10,12 @@
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import yargs from 'yargs';
|
||||
import {FlipperServerImpl} from 'flipper-server-core';
|
||||
import {
|
||||
FlipperServerImpl,
|
||||
loadLauncherSettings,
|
||||
loadProcessConfig,
|
||||
loadSettings,
|
||||
} from 'flipper-server-core';
|
||||
import {
|
||||
ClientDescription,
|
||||
Logger,
|
||||
@@ -48,7 +53,7 @@ const argv = yargs
|
||||
.parse(process.argv.slice(1));
|
||||
|
||||
async function start(deviceTitle: string, appName: string, pluginId: string) {
|
||||
return new Promise((_resolve, reject) => {
|
||||
return new Promise(async (_resolve, reject) => {
|
||||
let device: DeviceDescription | undefined;
|
||||
let deviceResolver: () => void;
|
||||
const devicePromise: Promise<void> = new Promise((resolve) => {
|
||||
@@ -67,14 +72,20 @@ async function start(deviceTitle: string, appName: string, pluginId: string) {
|
||||
|
||||
const server = new FlipperServerImpl(
|
||||
{
|
||||
// TODO: make these better overridable
|
||||
enableAndroid: true,
|
||||
androidHome: process.env.ANDROID_HOME || '/opt/android_sdk',
|
||||
idbPath: '/usr/local/bin/idb',
|
||||
enableIOS: true,
|
||||
enablePhysicalIOS: true,
|
||||
staticPath: path.resolve(__dirname, '..', '..', 'static'),
|
||||
tempPath: os.tmpdir(),
|
||||
env: process.env,
|
||||
gatekeepers: {},
|
||||
isProduction: false,
|
||||
paths: {
|
||||
staticPath: path.resolve(__dirname, '..', '..', 'static'),
|
||||
tempPath: os.tmpdir(),
|
||||
appPath: `/dev/null`,
|
||||
homePath: `/dev/null`,
|
||||
execPath: process.execPath,
|
||||
desktopPath: `/dev/null`,
|
||||
},
|
||||
launcherSettings: await loadLauncherSettings(),
|
||||
processConfig: loadProcessConfig(process.env),
|
||||
settings: await loadSettings(),
|
||||
validWebSocketOrigins: [],
|
||||
},
|
||||
logger,
|
||||
@@ -196,7 +207,7 @@ async function start(deviceTitle: string, appName: string, pluginId: string) {
|
||||
});
|
||||
|
||||
server
|
||||
.start()
|
||||
.connect()
|
||||
.then(() => {
|
||||
logger.info(
|
||||
'Flipper server started and accepting device / client connections',
|
||||
|
||||
Reference in New Issue
Block a user