Summary: Build flipper-server as normal build job. Note that `--no-rebuild-plugins` is used to save a lot of time, and
Reviewed By: passy
Differential Revision: D33361569
fbshipit-source-id: 55e97f81dbcfa98901ddc21e2f35f4d1134c74ef
Summary: This diff fixes an issue where the `scripts` folder wasn't automatically type checked by TypeScript, and as a result `yarn flipper-server` was broken atm.
Reviewed By: nikoant
Differential Revision: D33348825
fbshipit-source-id: 059a834cacb881d45ae4b0933af3f1feabb90182
Summary: When packaging plugins into flipper-server package, we assume an idiomatic plugin structure, warn and skip if a plugin doesn't conform to it.
Reviewed By: antonk52
Differential Revision: D33308367
fbshipit-source-id: fd6d1dbc66739b0867034930579429e97d9e2bfa
Summary:
Improved `flipper:build-release` command with several options as suggested in earlier reviews. Flags added:
* `--npx` install using npx and start
* `--start` run directly from the build folder
* `--open` icmw previous two, spawn a browser
This should generally benefit developing from for example an on-demand server (although current socket access is currently only open to local host, so a port forward or remote entry point needs to be set up)
Reviewed By: antonk52
Differential Revision: D33308198
fbshipit-source-id: fb905647c8d9fbda9d3efc2bfdcbd4d03be84938
Summary:
This refactors the flipper-server release script in such a way that it works the same as the normal release script, which solves two problems:
1) the official release script modifies versioned files, as it touches the package.json
2) it was slightly confusing that `flipper-server/static` was filled for release builds only, but not used in dev builds
3) running test:npx without running a release build before it, would fail with hard to comprehend errors. this has been solved now by removing that script and make it an arg of `build:flipper-server`
Also some further minor changes to prepare running a corresponding build / release job from SandCastle (later in this stack)
Reviewed By: nikoant
Differential Revision: D33297214
fbshipit-source-id: f6299aa982c3e59d1cc6479a93c56cbe4b57f85c
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3212
Fix a build error caused by missing types for metro-resolver. For some reason it triggers only on windows, but we don't have typings for those indeed.
Reviewed By: nikoant
Differential Revision: D33308474
fbshipit-source-id: 1bd4354ee3c4df54a0a8e65d890721dd9dbac013
Summary: Make sure icons are prefetched for flipper-server prod builds, like we do for electron, so that the user doesn't need an internet connection to see icons
Reviewed By: nikoant
Differential Revision: D33296389
fbshipit-source-id: bfa92d78d8d77030238e5cca10d7aa6dcfb88e8b
Summary:
This diff fixes several issues around loading plugin, such as:
* make suresource maps work in the flipper-server production build
* make sure default plugins are no symlinked, which wouldn't work anywhere else but on the the system where it was build
* support release channel param for flipper-server
Bundled flipper-server is now 42MB (with icons (see later diffs) and plugins
```
ll flipper-server-v0.0.0.tgz
-rw-r--r-- 1 mweststrate staff 42M 23 Dec 15:29 flipper-server-v0.0.0.tgz
```
Reviewed By: nikoant
Differential Revision: D33294677
fbshipit-source-id: 63538dc8127f883fee6a3608673ad11ce239b350
Summary: Make sure flipper-server is bundled in such a way that it is self-contained NPX-able. Also added some checks to make sure that dev dependencies don't accidentallly end up in in Flipper buidls
Reviewed By: nikoant
Differential Revision: D33190254
fbshipit-source-id: 443162e537d8ca9f956acac2d7bd52cbf0c92172
Summary:
This diff makes flipper-server stand-alone servable as a single package.
It basically works as follows:
- (default) plugins are build as usually into static folder
- static folder is copied into flipper-server/static (as far as relevant)
- `flipper-server/src/index.tsx` is bundled into `flipper-server/dist/index.js`
- `flipper-ui-browser/src/index.tsx` is bundled into `flipper-server/static/bundle.js`
If flipper-server is started without the `--bundler` config, the `bundle.js` will be served statically, rather than starting up the Metro bundler with all the typical transforms (in a distributed version of the package those all wouldn't resolve)
Things to be done in next diffs:
* make sure plugins actually load in the non bundled setup
* make sure flipper-server gets published properly
* make sure build is created as part of CI
At the end of this stack, running `npx flipper-server` on any machine should basically be a viable approach to get flipper up and running locally :)
Reviewed By: nikoant
Differential Revision: D33171107
fbshipit-source-id: 4af8ac2699467a0b55283fe084640482700744c2
Summary: When bundling a production bundle of flipper-ui / flipper-server, noticed that a lot of irrelevant stuff ends up. Like: `jest`, `metro`, `testing-library`. The whole jungle basically. Will add safety checks in the next diffs that this no longer happens
Reviewed By: passy
Differential Revision: D33186531
fbshipit-source-id: 1e2034153c8c4a3fac02cd9ce27d99224223df7a
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3188
Fixes failing typescript issue (probably case sensitivity thing, on windows it was complaining about `Metro` not being resolvable while we use `metro` everywhere). Put a `ts-ignore` on it, since the metro typings we use are empty anyway
Disabled a test that failed consistently on GH CI. Maybe timing or Node version issue?
Reviewed By: fabiomassimo
Differential Revision: D33191515
fbshipit-source-id: 18a143024824eeeafaffe4941df474591fb7b70a
Summary: This diff is some boyscouting on cleaning up our globals, and stop using them inconsistently icmw global or window
Reviewed By: aigoncharov
Differential Revision: D33171108
fbshipit-source-id: 400893e5f31523631a7ab6fda428524c751901f1
Summary:
This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package.
This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup.
As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same.
Reviewed By: lawrencelomax
Differential Revision: D33124441
fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
Summary:
This diff removes most deps from the root package.json, which now only contains electron and shared build / test infra structure: lint, prettier, jest, typescript.
This makes it possible to control much better which packages are used where, as all sub packages now have their deps explicitly in their package.json instead of incidentally shared. This allows for example to disable DOM types for all packages by default (flipper-plugin, ui(-core) and app still request it), and in the next diff I hope to add to this that nodeJS types are no longer shared either, so that UI oriented packages will generate compile errors when using Node built-ins
This diff removes most deps that were currently unused, and dedupes a bunch of other ones, so the build should probably be a bit smaller now as well:
{F686704253}
{F686704295}
Reviewed By: antonk52
Differential Revision: D33062859
fbshipit-source-id: 5afaa4f2103d055188382a3370c1fffa295a298a
Summary:
Bundled plugins so far didn't load because the defaultPlugins was not generated yet. Fixed follow up errors that resulted from node modules not being available in the browser, and made the process more robust so that one plugin that fails to initialise doesn't kill all bundled plugins from being loaded.
Cleaned up the server scripts, and reused the BUILTINS list that is already maintained in the babel transformer.
Report errors during the build process if modules are referred that are stubbed out (later on we could maybe error on that)
Reviewed By: aigoncharov
Differential Revision: D33020243
fbshipit-source-id: 3ce13b0049664b5fb19c1f45f0b33c1d7fdbea4c
Summary: During startup the socket connection would close a few times, among others because Scribe dumps 1.3 MB of data after startup, and the maximum payload of `socket.io` defaults to 1MB. This diff changes it to 100MB (the max size used by `ws` library). We know that we need at least > 10 MB, as that is what plugins like Network cap at.
Reviewed By: aigoncharov
Differential Revision: D33017653
fbshipit-source-id: 1233af6fbdc4b9eed42786ee418cfd6d43b2b433
Summary: Even with the `--no-bundled-plugins` flag, still a hundred plugins were loaded when running flipper-server
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32987158
fbshipit-source-id: 19e51e7e5f8ec9e664eb48cf2f2b8936f2f5ed73
Summary: As a convenience, open the browser by default when starting up
Reviewed By: timur-valiev
Differential Revision: D32984536
fbshipit-source-id: 540abf594f2f2553880f587bcd7d4811ea36fe74
Summary: This diffs adds debugging support to flipper server, by adding VSCode config for it
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D32982874
fbshipit-source-id: 8e187ad05a05566a598db04b97e8b08e3de7e835
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
Summary:
Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core
In the stack of D32926830 I occasionally imported from flipper-plugin/src/... which is not allowed. This should fix any auto-import related issues once and for all.
Reviewed By: timur-valiev
Differential Revision: D32987054
fbshipit-source-id: f19f6278219961ad283cacfec094a6c703ca93f8
Summary:
This diff splits Facebook management into a ui-core and electron part:
* Cleaned up code and introduces a uniform Icon type to describe a requested icon
* Computing icon urls is done in the ui-core
* Introduced a RenderHost hook that can transform the request icon into a different url, in this case, a url to load icons from disk in production builds
For the browser UI, the urls are currently no rewritten since we have only dev builds (which always used only FB urls already). We could do the same rewrite in the future and download the static assets during build time. But for now this means that in the browser implementation we depend on normal browser caching, with the biggest downside that icons might not appear if the user has no internet connections.
With this change we lost our last usage of staticPath computations in ui-core
Reviewed By: aigoncharov
Differential Revision: D32767426
fbshipit-source-id: d573b6a373e649c7dacd380cf63a50c2dbbd9e70
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
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
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
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.
Loading plugins is handled separately in the next diff.
Reviewed By: nikoant
Differential Revision: D32666537
fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
Summary:
This diff moves RenderHost initialisation to jest, which is thereby treated as just another 'Host' like flipper-ui, the electron app etc. A benefit is that it provides a mocked flipperServer by default that can be used to mock or intercept requests. See LaunchEmulator.spec as example.
Also made the jest setup scripts strongly typed by converting them to TS.
This change allows the test stub configuration, which was OS dependent, out of flipper-ui-core.
Reviewed By: nikoant
Differential Revision: D32668632
fbshipit-source-id: fac0c09812b000fd7d1acb75010c35573087c99f
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.
Reviewed By: nikoant, aigoncharov
Differential Revision: D32665064
fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
Summary:
perf_hooks is no longer needed as these APIs are widely available in both browser and electron.
Still needed in unit tests, as they run from Node
Reviewed By: lblasa, aigoncharov
Differential Revision: D32648253
fbshipit-source-id: 5718ea99b57f96f6858311fd0815ad18c476c99e
Summary:
Watch folders weren't updated for cross plugin/flipper boundaries that have recently been removed
Fix changes in several source folders not being picked up when fast refresh wasn't enabled
Reviewed By: passy, aigoncharov
Differential Revision: D32626139
fbshipit-source-id: 2c830ec8154ff859ce1e3ee101e5963162d2e0a2
Summary:
1. Replace old FileSelector with the new FileSelector
2. Remove showOpenDialog from FlipperLib
Reviewed By: mweststrate
Differential Revision: D32667103
fbshipit-source-id: be8da034c2695f83b397b6c7d35bc6aee78d66e5
Summary:
Don't print console.debug logs during unit tests
These diffs together reduce the amounts of logs printed during unit tests from 6000 to 3000.
Reviewed By: passy
Differential Revision: D32557595
fbshipit-source-id: eef2b742157f16638d9ce270cf8b3d8d0f4e2952
Summary: In the next diff, tests started to fail suddenly, probably as side effect of a changed module loading order or smthg, and started showing DOMs of different tests in test results. Figured that testing-library/react + jest doesn't automatically doesn't clean up the DOM as I hoped it would
Reviewed By: timur-valiev
Differential Revision: D32463402
fbshipit-source-id: 48d26badf774482e7320632e486dfc6358946484
Summary:
This diff moves all UI code from app/src to app/flipper-ui-core. That is now slightly too much (e.g. node deps are not removed yet), but from here it should be easier to move things out again, as I don't want this diff to be open for too long to avoid too much merge conflicts.
* But at least flipper-ui-core is Electron free :)
* Killed all cross module imports as well, as they where now even more in the way
* Some unit test needed some changes, most not too big (but emotion hashes got renumbered in the snapshots, feel free to ignore that)
* Found some files that were actually meaningless (tsconfig in plugins, WatchTools files, that start generating compile errors, removed those
Follow up work:
* make flipper-ui-core configurable, and wire up flipper-server-core in Electron instead of here
* remove node deps (aigoncharov)
* figure out correct place to load GKs, plugins, make intern requests etc., and move to the correct module
* clean up deps
Reviewed By: aigoncharov
Differential Revision: D32427722
fbshipit-source-id: 14fe92e1ceb15b9dcf7bece367c8ab92df927a70
Summary:
This diff removes most remaining Electron imports, by storing env and path constants on the RenderHost. As nice side effect those paths are all cached now as well.
To make sure RenderHost is initialised before Flipper itself, forced loading Flipper through a require. Otherwise the setup is super sensitive to circular import statements, since a lot of module initialisation code depends on those paths / env vars.
Reviewed By: nikoant
Differential Revision: D31992230
fbshipit-source-id: 91beb430902272aaf4b051b35cdf12d2fc993347
Summary:
This introduces a few more lints in fact because I renamed the icon functions
to make clear that they use sync methods under the hood.
Reviewed By: timur-valiev
Differential Revision: D31964701
fbshipit-source-id: d0beb58b5b301f5428fdbfe8c65784df0d86eaad
Summary:
I relied too much on the types which in this case don't help at all.
Filtering on a promise will just automatically get all values to pass.
Pull Request resolved: https://github.com/facebook/flipper/pull/3008
Test Plan: `yarn build --mac` works again on the GH checkout.
Reviewed By: mweststrate
Differential Revision: D31991576
Pulled By: passy
fbshipit-source-id: f632d29ddfc09b7130b68b4b17264fd30e1969ce
Summary:
Removed the Flipper QPL integration, see:
https://fb.workplace.com/groups/flippersupport/permalink/1200183003795689/
It complicates our build setup significantly, without actually being used anywhere for the past year. Apparently it doesn't solve a gap compared to the scuba logging we have already in place.
Reviewed By: passy
Differential Revision: D30911573
fbshipit-source-id: 836e2aba0c92c0eed9fed0dfb12bd8bdcb8c7d71
Summary: Mostly disabling warnings for scripts which are fine to use `console.error` directly.
Reviewed By: timur-valiev
Differential Revision: D30812956
fbshipit-source-id: 7fdc5bdf08f72d0d849ece6a4194d6a115d693f0
Summary: `yarn start` basically starves if watchman is still scanning the system, until that is completed (which took 40 minutes for me last time). Added a timeout of 1 minute, to signal that you can better to some dishes, instead of trying to hunt a bug that looks like an exception has been eaten somewhere (guess what I did..)
Reviewed By: timur-valiev
Differential Revision: D30806512
fbshipit-source-id: a2ebc3672d82f3388fc7b00f41c7e9c4f37794b3
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2609
Make it possible to mark some tests to run on non-CI, or unix only
Reviewed By: nikoant
Differential Revision: D29813506
fbshipit-source-id: 140f8a4eaed5af3282ab9d139b46a52818be0934
Summary: Remove the duplicate function and centralise it as nikoant suggested.
Reviewed By: fabiomassimo
Differential Revision: D29548480
fbshipit-source-id: 3e931cc88198415017c557c6b7c81cb35c3f22c9
Summary: This makes it possible to save source maps to a separate folder so we can upload them from CI.
Reviewed By: nikoant
Differential Revision: D29521599
fbshipit-source-id: a137659092b7648858b97ecf5b5c60c88889517a
Summary:
Allows for optional generation of source maps while building plugins.
Caveat: This will leave a broken `//# sourceMappingURL` comment at the bottom. If you set it to `null`, as the documentation suggests, you will instead get an inlined source map in addition to the written one.
Reviewed By: nikoant
Differential Revision: D29265385
fbshipit-source-id: 1e21e49d2516ecc5909b086e7797736b298b86ab
Summary:
Not being able to have timestamps in Jest snapshots, as they would differ across machines required jumping through a lot of hoops.
Run this into once again more by a test suite that didn't trigger on CI, but failed for me locally.
With this fix everyone can happily commit time based snapshots and they will always be assumed to be running in UTC :)
Reviewed By: nikoant
Differential Revision: D29025759
fbshipit-source-id: 426d1b065afdd4a2ed75b47203b13fff0ece1272