Set up Flipper decapitated packages

Summary:
This diff introduces the packages necessary for Flipper decapitated.

* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* desktop: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.

This diff just creates the packages, but doesn't move any code, so it can be summarized as:

restoftheowl

Reviewed By: nikoant

Differential Revision: D30218646

fbshipit-source-id: 735598a1261a98e584f52504b5eba01ec0afa162
This commit is contained in:
Michel Weststrate
2021-10-08 01:31:45 -07:00
committed by Facebook GitHub Bot
parent 99acd766b9
commit c3ff0ff355
32 changed files with 401 additions and 5 deletions

41
desktop/README.md Normal file
View File

@@ -0,0 +1,41 @@
# Flipper Desktop
This folder contains everything to run the Flipper 'Desktop', that is, the UI which you use to interact with the device / app under debug.
### Packages provided here:
* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* flipper-ui-electron: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron * specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.
* flipper-plugin: The flipper SDK used by plugins. Exposes all API's that can be used by plugins
* pkg: CLI tool to manage building flipper plugins
* pkg-lib
* plugin-lib
* babel-transformer
* doctor
* eslint-plugin-flipper
### Packages overview
```
flipper-ui-electron:
- flipper-server-core (directly embedded)
- flipper-ui-core
- plugins (prebundled)
- plugins (installable)
- flipper-plugin
flipper-server
- flipper-server-core
- flipper-ui-browser (served by webserver)
- flipper-ui-core (communicates using WebSocket with server-core)
- plugins (prebundled)
- plugins (installable)?
flipper-dump
- flipper-server-core
```

View File

@@ -38,6 +38,8 @@
"flipper-doctor": "0.0.0", "flipper-doctor": "0.0.0",
"flipper-plugin": "0.0.0", "flipper-plugin": "0.0.0",
"flipper-plugin-lib": "0.0.0", "flipper-plugin-lib": "0.0.0",
"flipper-server-core": "0.0.0",
"flipper-ui-core": "0.0.0",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"immer": "^9.0.6", "immer": "^9.0.6",
"invariant": "^2.2.2", "invariant": "^2.2.2",

View File

@@ -51,6 +51,9 @@ import {getVersionString} from './utils/versionString';
import {PersistGate} from 'redux-persist/integration/react'; import {PersistGate} from 'redux-persist/integration/react';
// eslint-disable-next-line flipper/no-electron-remote-imports // eslint-disable-next-line flipper/no-electron-remote-imports
import {ipcRenderer, remote} from 'electron'; import {ipcRenderer, remote} from 'electron';
import {helloWorld} from 'flipper-server-core';
helloWorld();
if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') { if (process.env.NODE_ENV === 'development' && os.platform() === 'darwin') {
// By default Node.JS has its internal certificate storage and doesn't use // By default Node.JS has its internal certificate storage and doesn't use

View File

@@ -10,9 +10,18 @@
{ {
"path": "../doctor" "path": "../doctor"
}, },
{
"path": "../flipper-common"
},
{ {
"path": "../flipper-plugin" "path": "../flipper-plugin"
}, },
{
"path": "../flipper-server-core"
},
{
"path": "../flipper-ui-core"
},
{ {
"path": "../plugin-lib" "path": "../plugin-lib"
}, },
@@ -23,9 +32,5 @@
"path": "../plugins/public/navigation" "path": "../plugins/public/navigation"
} }
], ],
"exclude": [ "exclude": ["**/node_modules/", "**/__tests__/", "**/lib/"]
"**/node_modules/",
"**/__tests__/",
"**/lib/"
]
} }

View File

@@ -0,0 +1,3 @@
# flipper-common
Utilities that are shared between flipper-ui, flipper-server and flipper-plugin.

View File

@@ -0,0 +1,27 @@
{
"name": "flipper-common",
"version": "0.0.0",
"description": "Server & UI shared Flipper utilities",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": []
}

View File

@@ -0,0 +1,3 @@
# flipper-dump (TBD)
Stand alone Flipper command, that uses flipper-server-core to connect to apps and dump all incoming messages.

View File

@@ -0,0 +1,28 @@
{
"name": "flipper-dump",
"private": true,
"version": "0.0.0",
"description": "Flipper tool to dump data from clients",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../flipper-server-core"
}
]
}

View File

@@ -7,6 +7,9 @@
"references": [ "references": [
{ {
"path": "../plugin-lib" "path": "../plugin-lib"
},
{
"path": "../flipper-common"
} }
] ]
} }

View File

@@ -0,0 +1,5 @@
# flipper-server-core
Package that manages connections with flipper clients, queries for adb/idb clients, accepts incoming websocket / rsocket connections and takes care of certificate exchange.
Used by Flipper desktop, flipper-server and flipper-dump

View File

@@ -0,0 +1,28 @@
{
"name": "flipper-server-core",
"private": true,
"version": "0.0.0",
"description": "Flipper server connection SDK",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../flipper-common"
}
]
}

View File

@@ -0,0 +1,5 @@
# flipper-server (TBD)
Stand alone Flipper server as NodeJS process, that uses flipper-server-core for device communication and also provides a webserver to serve flipper-ui.
Flipper-server can be used as background process, for example on CI servers or to power IDE plugins.

View File

@@ -0,0 +1,28 @@
{
"name": "flipper-server",
"private": true,
"version": "0.0.0",
"description": "Standalone nodeJS based Flipper server",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../flipper-server-core"
}
]
}

View File

@@ -0,0 +1,3 @@
# flipper-ui-browser (TBD)
Flippers UI, ready to be served to a webbrowser. Typically served by flipper-server. Leverages flipper-ui-core and binds the necessary features to the browser, such as file dialogs or menu's.

View File

@@ -0,0 +1,28 @@
{
"name": "flipper-ui-browser",
"private": true,
"version": "0.0.0",
"description": "Flipper's UI, packaged for the browser",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../flipper-ui-core"
}
]
}

View File

@@ -0,0 +1,3 @@
# flipper-ui-core (TBD)
Flipper's UI, agnostic of Electron vs Browser.

View File

@@ -0,0 +1,28 @@
{
"name": "flipper-ui-core",
"private": true,
"version": "0.0.0",
"description": "Flipper's UI",
"repository": "facebook/flipper",
"main": "lib/index.js",
"flipperBundlerEntry": "src",
"types": "lib/index.d.ts",
"license": "MIT",
"bugs": "https://github.com/facebook/flipper/issues",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"prepack": "yarn reset && yarn build"
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/facebook/flipper",
"keywords": [
"Flipper"
],
"author": "Facebook, Inc"
}

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function helloWorld() {
return true;
}

View File

@@ -0,0 +1,15 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"references": [
{
"path": "../flipper-common"
},
{
"path": "../flipper-plugin"
}
]
}

View File

@@ -17,6 +17,7 @@ module.exports = {
moduleNameMapper: { moduleNameMapper: {
'^flipper$': '<rootDir>/app/src', '^flipper$': '<rootDir>/app/src',
'^flipper-plugin$': '<rootDir>/flipper-plugin/src', '^flipper-plugin$': '<rootDir>/flipper-plugin/src',
'^flipper-(server-core|ui-core|common)$': '<rootDir>/flipper-$1/src',
'^flipper-(pkg|pkg-lib|doctor|test-utils)$': '<rootDir>/$1/src', '^flipper-(pkg|pkg-lib|doctor|test-utils)$': '<rootDir>/$1/src',
}, },
clearMocks: true, clearMocks: true,

View File

@@ -269,7 +269,13 @@
"doctor", "doctor",
"pkg", "pkg",
"pkg-lib", "pkg-lib",
"flipper-common",
"flipper-plugin", "flipper-plugin",
"flipper-server-core",
"flipper-ui-core",
"flipper-ui-browser",
"flipper-server",
"flipper-dump",
"static", "static",
"e2e", "e2e",
"plugin-lib", "plugin-lib",

View File

@@ -23,6 +23,9 @@
"flipper": ["./app/src"], "flipper": ["./app/src"],
"flipper-plugin": ["./flipper-plugin/src"], "flipper-plugin": ["./flipper-plugin/src"],
"eslint-plugin-flipper": ["./eslint-plugin-flipper/src"], "eslint-plugin-flipper": ["./eslint-plugin-flipper/src"],
"flipper-server-core": ["./flipper-server-core/src"],
"flipper-server-ui": ["./flipper-server-ui/src"],
"flipper-common": ["./flipper-common/src"],
"flipper-*": ["./*/src"] "flipper-*": ["./*/src"]
} }
}, },