Summary:
In public CI (only?), asset downloads sometimes fail with a spurious 404.
We already have retrying in place, but it will obviously not do that on a 500.
Reviewed By: nikoant
Differential Revision: D28744817
fbshipit-source-id: b6a185d8e9db45e02c6427233a0171b00c552751
Summary: This change allows passing a directory containing plugin packages to include them into Flipper distributive. This is used by release command on Sandcastle (see D28626715).
Reviewed By: passy
Differential Revision: D28628425
fbshipit-source-id: 9c5d7527721f99b43991bace0b5e2f3a4ede0d13
Summary: This diff fixes "build-plugin" script which is failing for fb-internal plugins, because "fb/package.json" not exist. Because of that release of "fb/mobilebuilds" plugin failed recently: https://www.internalfb.com/intern/sandcastle/job/13510799309874638.
Reviewed By: passy
Differential Revision: D28624924
fbshipit-source-id: e00da98cfef992f5d49045afc9d404764a0d13ac
Summary: Allow splitting package.json to public one and fb-internal one located in "fb/package.json". When plugin is packaged, fields in package.json are overwritten by fields from "fb/package.json" if they exist. This give us a way to specify additional metadata which only make sense internally (e.g. oncall and internal links to docs and support).
Reviewed By: mweststrate
Differential Revision: D28542101
fbshipit-source-id: c0167461897a994e5731aaf0fe625de052eda864
Summary:
Sorry for long diff! I can try to split it if necessary, but many changes here are 1-1 replacements / renames.
**Preambule**
Currently we bundle default plugins into the Flipper main bundle. This helps us to reduce bundle size, because of plugin dependencies re-use. E.g. if multiple plugins use "lodash" when they are bundled together, only one copy of "lodash" added. When they are bundled separately, the same dependency might be added to each of them. However as we're not going to include most of plugins into Flipper distributive anymore and going to rely on Marketplace instead, this bundling doesn't provide significant size benefits anymore. In addition to that, bundling makes it impossible to differentiate whether thrown errors are originated from Flipper core or one of its plugins.
Why don't we remove plugin bundling at all? Because for "dev mode" it actually quite useful. It makes dev build start much faster and also enables using of Fast Refresh for plugin development (fast refresh won't work for plugins loaded from disk).
**Changes**
This diff introduces new option "no-bundled-plugins" for "yarn start" and "yarn build" commands. For now, by default, we will continue bundling default plugins into the Flipper main bundle, but if this option provided then we will build each default plugin separately and include their packages into the Flipper distributive as "pre-installed" to be able to load them from disk even without access to Marketplace.
For "yarn start", we're adding symlinks to plugin folders in "static/defaultPlugins" and then they are loaded by Flipper. For "yarn build" we are dereferencing these symlinks to include physical files of plugins into folder "defaultPlugins" of the produced distributive. Folder "defaultPlugins" is excluded from asar, because loading of plugins from asar archive might introduce some unexpected issues depending on their implementation.
Reviewed By: mweststrate
Differential Revision: D28431838
fbshipit-source-id: f7757e9f5ba9183ed918d70252de3ce0e823177d
Summary: "plugin-build" command will produce dir with unpacked plugin sources in addition to tar package. This is required because for publishing to Marketplace we need to retrieve few files from the output package, like "readme.md" and "package.json" and it's better to have it already unpacked rather than pack and then unpack to get these files.
Reviewed By: passy
Differential Revision: D28409930
fbshipit-source-id: 51c8eeb848a72850a2f126eb91a563d52851ed41
Summary: Added an arg for "build-plugin" command to easily set min required flipper version when plugin is packaged. Before that we only saved engine version in Marketplace metadata, but it's better to save it into the package as well, so we can check compatibility for installed packages even when we have no Marketplace metadata for them.
Reviewed By: passy
Differential Revision: D28350276
fbshipit-source-id: 916d891540263a1f99c1f6d2033eb13e1c36d78f
Summary:
Changed retrieving of Flipper version. Now it will be always retrieved from package.json. Before this change we used "remote.app.getVersion()" API which instead returned electron version for dev builds, e.g. "11.2.3". This is not convenient, because we now use Flipper version to check plugin compatibility and unrelated Electron version here makes things more complicated. After this change, if version is not properly bumped then "0.0.0" will be used: 1) when running using "yarn start", 2) when local building with "yarn build --mac" without setting new version, 3) when running tests "yarn test".
In addition to that I added a new command-line argument and env var which allow overriding version number for Flipper. This is useful for testing plugin updates, because compatibility between plugins and Flipper is checked by comparing Flipper version with the min version set in the plugin metadata.
Reviewed By: passy
Differential Revision: D28287354
fbshipit-source-id: 2f9482080e3612b95a24300050d98150c6db6cb7
Summary: Fixed loading of source maps when dev server is running with --fast-refresh flag set. Looks like it was broken after last metro upgrade because it changed the way how module paths are passed to dev server. We also had a hack to workaround bug when requested module paths were malformed, but it looks this hack is not needed now, so I deleted it as well.
Reviewed By: passy
Differential Revision: D28120080
fbshipit-source-id: 03a39c9840da8f4c8c72be6189c0b71c62fac7f0
Summary:
This is not doing much in terms of size. We're talking 780 bytes after
PACK compression but we're losing a lot of information in our errors
(before have symbolication).
We may reenable this at some point but I think it might be safe to leave it to this.
Reviewed By: nikoant
Differential Revision: D27887636
fbshipit-source-id: 15affeac588db667914320cbd098f7041b8b9c09
Summary:
When trying to run some React component performance profiles, the updates registered made absolutely no sense (components rerendering without any parent or other cause causing them to render etc). That turned out to be caused by having an outdated version of the React devTools in Flipper.
Sadly the newer version of the React DevTools didn't work with our current Electron version anymore. Some horrible hacking is needed to work around that.
To help with updating the tools in the future (they are by default cached forever on the local machine), I've introduced the `FLIPPER_UPDATE_DEV_TOOLS` variable.
The plugin loading work around is inspired by https://github.com/electron/electron/issues/23662#issuecomment-787420799
Reviewed By: passy
Differential Revision: D27685981
fbshipit-source-id: c35e49aff9b2457b63122eeee0d5c042ddd3b08b
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2172
New script which runs "tsc" for all plugins, receives list of errors and then checks which plugins are affected. It works for shared libs too, e.g. if there is an error in a shared library, then all plugins dependant on it will be counted as affected. For convenience, script saves list of errors affecting each plugin to "tsc-errors.log" in plugin folder.
This script will be used for automatic type-checking plugins against current "stable" and "insiders" versions of Flipper.
An alternative to this implementation would be to simply run "tsc" for each plugin individually, but such implementation takes a lot of time (5+ sec per plugin) and so cannot be effectively used on diffs.
Reviewed By: mweststrate
Differential Revision: D27499765
fbshipit-source-id: fcbbfc94a13e6c7c5beff0c889a929f84c41b2dd
Summary: Currently when babel transformation is failed, only stack is shown. It's better to log the whole error object because it also contains path and line number of the code failing to transpile.
Reviewed By: passy
Differential Revision: D27034942
fbshipit-source-id: 76e03871c924489e2698a26622e6bc6fdd305560
Summary:
Here I'm changing plugin repository structure to allow re-using of shared packages between both public and fb-internal plugins, and to ensure that public plugins has their own yarn.lock as this will be required to implement reproducible jobs checking plugin compatibility with released flipper versions.
Please note that there are a lot of moved files in this diff, make sure to click "Expand all" to see all that actually changed (there are not much of them actually).
New proposed structure for plugin packages:
```
- root
- node_modules - modules included into Flipper: flipper, flipper-plugin, react, antd, emotion
-- plugins
--- node_modules - modules used by both public and fb-internal plugins (shared libs will be linked here, see D27034936)
--- public
---- node_modules - modules used by public plugins
---- pluginA
----- node_modules - modules used by plugin A exclusively
---- pluginB
----- node_modules - modules used by plugin B exclusively
--- fb
---- node_modules - modules used by fb-internal plugins
---- pluginC
----- node_modules - modules used by plugin C exclusively
---- pluginD
----- node_modules - modules used by plugin D exclusively
```
I've moved all public plugins under dir "plugins/public" and excluded them from root yarn workspaces. Instead, they will have their own yarn workspaces config and yarn.lock and they will use flipper modules as peer dependencies.
Reviewed By: mweststrate
Differential Revision: D27034108
fbshipit-source-id: c2310e3c5bfe7526033f51b46c0ae40199fd7586
Summary: This diffs refactors tsc projects structure and structure of our custom typings to allow producing typescript typings for "flipper" package. In next diffs I'm going to use the produced typings to check compatibility of plugins with certain versions of Flipper, e.g. to check whether plugin is compatible with current "stable" and "insiders" version.
Reviewed By: passy
Differential Revision: D26997158
fbshipit-source-id: a0416c7139bf08ec9d175730da4c4c2a8768eeb7
Summary: Patch was always set to "0" for open source releases even if it is set to "1" in package.json
Reviewed By: passy
Differential Revision: D26975947
fbshipit-source-id: b3f127c9746797fbb5a79dfcd9bd52210c3a7df8
Summary: New script which bundles all plugins. It is faster to bundle them all in one script rather than call "build-plugin" for each of them. The new script will be used in CI to catch regressions when some plugins cannot be bundled into standalone packages.
Reviewed By: passy
Differential Revision: D26918103
fbshipit-source-id: dbc5c4cd706e8d585718a198dbd7ae9ffd988e28
Summary:
This diff makes babel transformation cache key stable. With the previous approach it was changed on each CI build so it was not possible to persist cache between builds. Now it is computed from the transformation package content after each build. Because of that it is equal for every CI build while Babel transformations unchanged and so we could use same cache on different Sandcastle agents.
In addition to that, it makes it possible to specify directory for Metro cache so we can save/restore it in CI builds.
Reviewed By: mweststrate
Differential Revision: D26877989
fbshipit-source-id: 7cb04a177f86e61986585e5a74d9c7396ddddc18
Summary:
Few improvements for "build-plugin" task which together with Sandcastle command changes (D26872427) helps to build all plugins in CI ~30% faster if most of them has not changed (which is usually the case):
1) compute package checksum in the same script to not call additional yarn scripts for each plugin
2) avoid packaging plugin if it's checksum has not changed since last release
Reviewed By: mweststrate
Differential Revision: D26872253
fbshipit-source-id: 968102d32a1550ea7503f1169f0ef2863296383f
Summary:
Renamed actions "star" and "unstar" everywhere to "enable", "disable" and "switch". The logic behind original "star" action changed significantly, so this rename just makes everything much clearer.
Please note that as a part of rename persisted state fields "userStarredPlugins" and "userStarredDevicePlugins" were renamed. I've added a "redux-persist" migration for seamless transition.
Reviewed By: passy
Differential Revision: D26606459
fbshipit-source-id: 83ad475f9b0231194701c40a2cdbda36f02c3d10
Summary: Fixed passing parameter for running dev build as "insiders" via env var. It was broken before and it was only possible to pass it via command line.
Reviewed By: passy
Differential Revision: D26578901
fbshipit-source-id: a579ac5bb6e5527abbe978318bf0c0398f76f1fe
Summary: Now as we can install device plugins from Marketplace, I was able to unbundle device plugins which were used quite rarely, but still added ~3 MB to the final Flipper bundle.
Reviewed By: mweststrate
Differential Revision: D26337297
fbshipit-source-id: 23a36cc15ca976a1215440192718d985e1f322fd
Summary:
This is quite hacky but avoids having to patch electron-builder directly.
We're intercepting the signing/editing process on Windows and triggering it ourselves while overriding version information that otherwise changes for every release causing cache invalidations to occur. This does *not* change the version display in the app as we're not depending on the PE metadata but on the version in the `package.json`.
Reviewed By: nikoant, mweststrate
Differential Revision: D25973921
fbshipit-source-id: 0fad07f3597fba9927643d24fba12f8750ca54bc
Summary:
We're skipping the signing and editing of EXEs on Windows. This is only temporary but I want to have an atomic commit we can go back to. This is to avoid cache eviction due to version numbers being encoded in the binary.
This means you're not getting the logo on the binary and copyright information, etc. We're not actually shipping these right now, so the real-world impact of this is zero.
Reviewed By: mweststrate
Differential Revision: D25973944
fbshipit-source-id: d076919acfaac1f618178294baff3e9122d820bf
Summary: This diff adds the `--public-build` option which allows run a devServer emulating the OSS version of flipper. Technical details are explained in the comments.
Reviewed By: passy, nikoant
Differential Revision: D25944966
fbshipit-source-id: 540855808179582752b8aa646f0b8afd4b78396f
Summary: In D25584424 (V1), Sandcastle complained about trailing whitespace. This diff removes the adde description if none can be retrieved
Reviewed By: nikoant
Differential Revision: D25608443
fbshipit-source-id: a798bb0c40afaaafd55c90c70177f7c2af79af34
Summary: Unbundle most of plugins from Insiders version of Flipper. Users will need to install them from Marketplace.
Reviewed By: passy
Differential Revision: D25558043
fbshipit-source-id: 648b0d4c83d9096972b5463cdcaa3de23426bdda
Summary:
New UX/UI for plugin auto-updates based on Sandy:
- disabled plugins auto-updated silently without any notifications as there is no active state for them so there is nothing to loose.
- enabled plugins can have some state and user can actually work with them, so we cannot reload them automatically. Instead, we show notification in the top of the plugin container asking user to reload the plugin when she is ready.
- if the auto-updated plugin failed to reload - show error notification.
- for non-sandy we continue using notifications as before.
Reviewed By: mweststrate
Differential Revision: D25530384
fbshipit-source-id: de3d0565ef0b930c9343b9e0ed07a4acb51885be
Summary:
I've re-designed interfaces describing plugins as I found that mental overhead working with them became too expensive because of slightly flawed design. However this cascaded changes in many files so you can see how extensively these interfaces used in our codebase.
Before this change we had one interface PluginDetails which described three different entities: 1) plugins installed on the disk 2) plugins bundled into Flipper 3) plugins available on Marketplace. It's hard to use this "general" PluginDetails interface because of this as you always need to think about all three use cases everywhere.
After this change we have 3 separate interfaces: InstalledPluginDetails, BundledPluginDetails and DownloadablePluginDetails and things became much type-safer now.
Reviewed By: mweststrate
Differential Revision: D25530383
fbshipit-source-id: b93593916a980c04e36dc6ffa168797645a0ff9c
Summary:
Separate dispatcher for periodic refreshing available plugins data from the Marketplace backend and caching it locally.
The plugin auto update downloader subscribes to these state refreshes and automatically schedules plugin update downloads when required.
Reviewed By: passy
Differential Revision: D25360897
fbshipit-source-id: 5b6d95b63ff47b8ae9ad8b12e2480d1fed524ca5
Summary: Each build will have an embedded file specifying the target release channel for the build. This allows us to do some customisations, e.g. show "Insiders" label in the title and enable Sandy by default for insiders builds.
Reviewed By: jknoxville
Differential Revision: D25399045
fbshipit-source-id: 8e26d0754d0713ced823f86b30b54491d55b4d97
Summary: We have some custom parsing here and there and I'm going to add some more args, so decided it's better to cleanup this a bit.
Reviewed By: jknoxville
Differential Revision: D25398421
fbshipit-source-id: 9d43029eef07648d0b01590e9cf7e7fe400b31d0
Summary: Was tired off figuring out GK's to be able to debug a plugin, so added a flag that allows me to start Flipper with all plugins enabled :)
Reviewed By: passy
Differential Revision: D25301773
fbshipit-source-id: 668b92c4ddbbeb3f4b056035de394800bbfa5377
Summary:
This diff sets all package version to "0.0.0" except of the root package and changes the bump script to only bump version in the root package. This should reduce possibility of conflicts on release diffs. Anyway we always use the same version for all of our packages, so we can only set it to the root.
Before npm publishing we will set all package versions to the same number as in the root package (we actually already do that) so there will be no differences except we won't need to bump version in more than 100 packages each release.
Reviewed By: mweststrate
Differential Revision: D25162373
fbshipit-source-id: 02fe401bee72845339c67925c130027bdaee559d
Summary: Just rolling back a part of D24782300 (dce7422ba6) where I've accidently removed using of unique number because did not understood how it is passed and wrongly decided it is not needed.
Reviewed By: passy
Differential Revision: D25027458
fbshipit-source-id: f623732c161bca01859f91444c2a0ed211a5fad6
Summary: Scripts now accept full version instead of only patch part of it.
Reviewed By: jknoxville
Differential Revision: D24782300
fbshipit-source-id: 1c454beb9640a5b38669fe39eab642245b0f0f91
Summary:
This quite often fails in CI. Adobe's fetch has some very sensible defaults
and will do exponential backoff and retry for up to a minute.
That should hopefully fix issues where we have to restart the whole build
just to fix one measly icon download.
Reviewed By: jknoxville
Differential Revision: D24649807
fbshipit-source-id: efbc9eb29e4b5a0f74b0b6ad6dea4aaf86391363
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1612
* Use the QPL-managed QPLCore and PigeonClient.
**Facebook:**
js-shared/qpl and js-shared/pigeon-client are maintained by QPL in xplat/js-shared. I've updated the Metro config and tsconfig to allow the packages to be imported without breaking the open-source version.
Reviewed By: passy
Differential Revision: D24358369
fbshipit-source-id: 7f13d6c99d8ca6ebcd0e66bf0e5f25069370cce7
Summary: Allow using of .env file to pass env vars to be used in dev mode. Currently this allow to configure defaults for enabling fast refresh, automatic opening of dev tools and plugins to load.
Reviewed By: passy
Differential Revision: D24398938
fbshipit-source-id: 30a5d86b7906a7723a404cf84a1b8d50ae497dbc
Summary: Currently we load all the plugins even if they are not required in dev mode, e.g. when you are developing a specific plugin. This diff adds an env var and command-line option to specify exact list of plugins to load. This makes dev mode startup faster and consume less memory.
Reviewed By: passy
Differential Revision: D24394146
fbshipit-source-id: 42a78c1ffb2632e657c2411e34e9c80fff18df3a
Summary:
I noticed that after the typescript upgrade, I got several weird positives from ESLint (like unused parameters in a type definition, which are obviously always unused, e.g. `type onClick = (e: Event) => void`). After some investigation, it turned out these warnings are generated by eslint, but that those rules should be performaned by typescript/eslint instead. For future reference to which rules this applies:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules
Updated the config, and while at it, fixed all warnings in our codebase, except for `react-hooks/exhaustive-deps` warnings, since those require semantic changes.
This reduces the amount of eslint warnings from 86 to 39.
Reviewed By: passy
Differential Revision: D23905630
fbshipit-source-id: 0557708fd9ec6b17840a3c191e7d3baf225bdf23
Summary:
allow-large-files
Updated to typescript 4. Note that this is no new major, the way TS numbers is that 4.0 is simply the number after 3.9 (so they refuse to use 3.10).
Primarily reason is that it allows us to use `/** deprecated */`. although there are definitely more interesting improvements
Reviewed By: passy, nikoant
Differential Revision: D23869445
fbshipit-source-id: 54e251b398b8698d9b18898ce66c3203b32aa356