Commit Graph

7 Commits

Author SHA1 Message Date
Michel Weststrate
ae56f2b62f change server build process to respect babel transforms
Summary:
The build process for the server was a simple ts-node that compiled all deps. However, that didn't do any source transformations we need, like replacing `fb-stubs` with `fb` in facebook builds.

This diff works out the dev build process to align more with how other parts of the code base is build, by starting metro to build and bundle the server (only the sources of flipper-server, flipper-server-core and other flipper packages are bundled, node-deps are left as is).

To achieve this, since metro doesn't have support for 'external' packages like any arbitrarily other bundler, we recycle the electronRequire work around that is used in the desktop app as well

Reviewed By: aigoncharov

Differential Revision: D32949677

fbshipit-source-id: 00d326bb17b68aece6fb43af98d0def13b335e74
2021-12-13 05:48:16 -08:00
Michel Weststrate
bb23b36051 Fixed flipper settings not being loaded / saved on fresh install
Summary:
I was running flipper-server on a fresh machine without Flipper installed and discovered that reading / writing settings failed since `~/.flipper` wasn't existing, due to using `access` instead of `pathExists`.

Added a warning about needing to restart the server after making changes, since that is tricky to do from the UI.

Fixed an issue in the settings screen, which would fs.stat as part of rendering, causing the Settings UI not to load.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32984538

fbshipit-source-id: 2b2011ad9d84c72ac824d92a8c96f636237b8771
2021-12-10 17:59:33 -08:00
Michel Weststrate
ad4a55f263 move node types, stub node modules
Summary: This diff stubs all node modules when running in the browser, so that, albeit with a lot of errors and without plugins, the UI loads in a browser. To be continued in the rest of this diff

Reviewed By: antonk52

Differential Revision: D32665705

fbshipit-source-id: 4632e241f59c5b9712a41d01a26878afb01f69b5
2021-12-08 04:30:57 -08:00
Michel Weststrate
86995e0d11 Introduce static resource URLs
Summary: Introduced an API that converts a filepath, relatively to the `desktop/static/` folder in a url that can be resolved by the render environment. This will generate `file://` urls in Electron, and root relative `/` urls in browser envs

Reviewed By: aigoncharov

Differential Revision: D32767427

fbshipit-source-id: 378da7709bcb19449873358a8703b9c5a5809c57
2021-12-08 04:30:57 -08:00
Michel Weststrate
2a4fe77404 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
2021-12-08 04:30:56 -08:00
Michel Weststrate
de59bbedd2 Make plugin loading async
Summary: This diff makes plugin loading async, which we'd need in a browser env (either because we'd use `import()` or we need to fetch the source and than eval it), and deals with all the fallout of that

Reviewed By: timur-valiev

Differential Revision: D32669995

fbshipit-source-id: 73babf38a6757c451b8200c3b320409f127b8b5b
2021-12-08 04:30:56 -08:00
Michel Weststrate
5d45bd741b Initialise flipper-ui-browser with socket connection
Summary:
This diff sets up the socket connection between flipper-browser and flipper-server, and verifies that the initial UI initialisation work (e.g. `get-config` command works). The initial RenderHost is initialised as well based on the config and browser APIs.

Note that flipper-ui-core itself isn't started yet, as that has still a plethora of node imports, so Metro will correctly refuse to bundle

Not in this diff
* remove Node usage from flipper-ui-core
* implement all RenderHost APIs

Reviewed By: aigoncharov

Differential Revision: D32644074

fbshipit-source-id: 2c8065caf0191771a3867b69a431ca50eeb7a5a3
2021-12-08 04:30:55 -08:00