Summary:
This can quite easily happen if you manually edit it and
aren't careful. The least we can do is tell the user about it,
because it be a bit surprising otherwise.
Reviewed By: jknoxville
Differential Revision: D17626760
fbshipit-source-id: 8c7d64b041fa4b97ce2753116800d0e855442dd9
Summary:
In the previous implementation plugins were downloaded from npm, but dependencies weren't. This diff uses the `live-plugin-manager` which does mostly what we want. It install a package from NPM with all its dependencies.
live-plugin-manager puts the plugin and its dependencies in the same folder. We expect the plugins to be in `node_modules`. For this reason, we are installing the plugin into `$pluginName/node_modules` and move the plugin after the installation out of the `node_modules` folder.
* Fixed plugin loading path for thirdparty plugins.
* Disabled hot reloading for plugins in the flipper folder to prevent reloads when moving around files and installing dependencies here.
* an empty `.watchmanconfig` is created, because metro requires it
* tsx files are added to the list of supported extensions for metro
Reviewed By: passy
Differential Revision: D17570413
fbshipit-source-id: ecbedc60841b36188fec9c83da41ef1f27e5e155
Summary: This diff adds an initial support to prefill the app information and the revision information. This diff also copies the workplace url in the clipboard.
Reviewed By: passy
Differential Revision: D16990925
fbshipit-source-id: 4f354e52de5fea07c2ea36336761d6963c27ef66
Summary:
My MBP just crashed again during startup. I would like to
understand why every plugin compilation appears to start
up a new electron process, but until that's understood
and hopefully fixed, it's probably best to limit the number
of processes we spawn by setting an upper bound here.
N.B. My Linux box doesn't mind this at all.
Reviewed By: jknoxville, danielbuechele
Differential Revision: D17419289
fbshipit-source-id: a11562a21a984059dc35e826eb20d869df218546
Summary:
This is a bit embarrassing. It seems like I never wired this up which is
why the update indicator keeps coming up even if the app was started
by the Launcher.
This actually makes sure that we proxy the yargs flag through to
`processConfig`.
Reviewed By: jknoxville
Differential Revision: D17341896
fbshipit-source-id: 73602e2035c26fb0d03e853a4e94065af3986757
Summary: Tests were failing as they were not being transformed correctly. Class properties (proposed syntax) was only partially added for Typescript files. This fixes the issue.
Reviewed By: passy
Differential Revision: D16686613
fbshipit-source-id: 2108cf77eb688bb6825d016960480ea55fcc2620
Summary: Same as previous diff, but for `static/`.
Reviewed By: danielbuechele
Differential Revision: D16579860
fbshipit-source-id: aa4449ded8734270fb5e1ab400a95768c6a1c09f
Summary:
Currently icons were always fetched remotely. We used a service worker to prefetch and cache some icons, that were critical to the UI.
In this diff, we are bundling icons at build time, with the app. In utils/icons.js we still specfify the list of icons which should be bundled. These are downloaded as part of the build step and bundled with the app. We are downloading the icons in 1x and 2x (the two most common pixel densities).
Reviewed By: jknoxville
Differential Revision: D16620764
fbshipit-source-id: 965a7793ad1f08aebb292606add00218429cdaf4
Summary: Move from adding adb path in tracery plugin to adding flipper as a whole. Se discussion here: D16494684
Reviewed By: jknoxville
Differential Revision: D16542414
fbshipit-source-id: abb2f4989693025a8bfe7d12f4c328870a962204
Summary:
In my last plugin for React VR I used spawn heavily to call adb and python2. It worked out well, but after Flipper released, I noticed that all my spawn commands were broken.
I found that Electron start in different way when bundled as production bundle, and because of it, it does not inherit process.env.PATH in a same way as it do this for development mode. (only linux/mac issue)
In this diff I used npm package which detects linux/mac and executes bash command which returns all the env variables from the system. After it, it takes PATH and merge it with process.env.PATH.
Reviewed By: passy
Differential Revision: D16457847
fbshipit-source-id: 60226f2d7977f1dfec49de6e889f3115d8688991
Summary:
Compilation is a mixture of I/O and CPU work, so there's some good optimisation potential even on a single thread by running the promises concurrently. The downside is that the output is a bit garbled, but it's quite a bit faster for me.
To test this, I applied this diff so I could just `time yarn start` for an entire run.
```
diff --git a/xplat/sonar/src/init.js b/xplat/sonar/src/init.js
--- a/xplat/sonar/src/init.js
+++ b/xplat/sonar/src/init.js
@@ -80,4 +80,5 @@
dispatcher(store, logger);
// make init function callable from outside
window.Flipper.init = init;
+ window.close();
});
```
## Before
**Cold Start**
```
696.89user 93.21system 4:21.44elapsed 302%CPU (0avgtext+0avgdata 1111448maxresident)k
1416inputs+372824outputs (3major+28155897minor)pagefaults 0swaps
```
**Hot Start**
```
6.87user 1.62system 0:17.32elapsed 49%CPU (0avgtext+0avgdata 249264maxresident)k
216inputs+182912outputs (0major+251426minor)pagefaults 0swaps
```
## After
**Cold Start**
```
736.86user 95.47system 1:53.13elapsed 735%CPU (0avgtext+0avgdata 970616maxresident)k
42864inputs+356776outputs (42major+25299531minor)pagefaults 0swaps
```
**Hot Start**
```
6.85user 1.60system 0:15.93elapsed 53%CPU (0avgtext+0avgdata 269420maxresident)k
2592inputs+197904outputs (0major+260099minor)pagefaults 0swaps
```
## Summary
It's beneficial in both cases, but the wall clock time for cold start goes from *4:21.44* to *1:53.13* for me (mind that this is a single sample). This is a 2.3x speed-up!
Reviewed By: jknoxville
Differential Revision: D16359215
fbshipit-source-id: 62257ec3bdefbf98356f5ac9418c4906f7cb4b1b
Summary:
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.5 to 4.17.14.
<details>
<summary>Commits</summary>
- [`be87d30`](be87d30394) Bump to v4.17.14.
- [`a6fe6b1`](a6fe6b1e17) Rebuild lodash and docs.
- [`e371828`](e37182845f) Bump to v4.17.13.
- [`357e899`](357e899e68) Rebuild lodash and docs.
- [`fd9a062`](fd9a062d57) Bump to v4.17.12.
- [`e77d681`](e77d68121f) Rebuild lodash and docs.
- [`629d186`](629d186579) Update OpenJS references.
- [`2406eac`](2406eac542) Fix minified build.
- [`17a34bc`](17a34bc585) Fix test bootstrap for core build.
- [`53838a3`](53838a38f8) Fix tests in older browsers.
- Additional commits viewable in [compare view](https://github.com/lodash/lodash/compare/4.17.5...4.17.14)
</details>
<br />
[](https://help.github.com/articles/configuring-automated-security-fixes)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/facebook/flipper/network/alerts).
</details>
Pull Request resolved: https://github.com/facebook/flipper/pull/493
Reviewed By: jknoxville
Differential Revision: D16323535
Pulled By: passy
fbshipit-source-id: 9511b4050306a872295a7053f465ae46b9c5fa8a
Summary: When Trace has been uploaded, load it inside a webview in Flipper.
Reviewed By: habond
Differential Revision: D16185763
fbshipit-source-id: 3217211f1d5035fc16d733ef48db44d8f8d9d360
Summary: This one snuck in while rebasing my new rules onto master.
Reviewed By: bnelo12
Differential Revision: D16180472
fbshipit-source-id: b715c218ff1886c1901c7730a6b8dac67beb3968
Summary: Taking another stab at adding some lint rules to make it harder to shoot yourself in the foot. Hopefully nothing too controversial. Preferring spread and rest should lead is more readable and there's no downside when using ES6. The "useless" rules are just things like renaming imports to the original name which should only happen during refactors.
Reviewed By: jknoxville
Differential Revision: D16180453
fbshipit-source-id: 1cf6851b7726c0aee953ec7cf7dd6fa0aca32253
Summary:
Non-final identifiers make code harder to understand.
This is particularly true for JavaScript where even the *type*
can change as a value gets reassigned later.
This enforces to use `const` whereever possible, but doesn't
"outlaw" `let`. Mixed destructuring is also still allowed.
Used `eslint --fix` to change all existing cases.
Reviewed By: jknoxville
Differential Revision: D16131329
fbshipit-source-id: 2eceaca7c603b71b36e005be5d135e1849f2518d
Summary: updating to the latest metro version
Reviewed By: passy
Differential Revision: D15986739
fbshipit-source-id: 83fba99bf7cc0903590831aeb852d14dde576901
Summary:
On Windows fs.watch fires multiple times after a single edit causing multiple instances of plugin compilation threads to start bogging down system resources.
This diff delays compilation by 1 second, soaking additional watch events fired for that plugin in that time window.
Reviewed By: danielbuechele
Differential Revision: D16109076
fbshipit-source-id: bc4f89d83f04487a3d32ee5cc2105fe0a8b7366c
Summary: Keytar binaries weren't updated when upgrading the electron version. This diff updates the binaries to match electron's node version.
Reviewed By: passy
Differential Revision: D15821734
fbshipit-source-id: 04688f1e465d2f7bdefecfdda8e2f3868de18780
Summary:
We in React VR were need newer Chrome DevTools version to make our plugin work properly. Chromium version with required fixes were shipped in electron 5.0.0.
This diff bumps electron version and explicitly allows node integration (accessing require, process and other node related functions from window object in index.html), because it was disabled by default in 5.0.0.
Reviewed By: jknoxville
Differential Revision: D15693539
fbshipit-source-id: 4f71a07b2afaa489aec46940c924f4ad30ad0413
Summary: Eslint doesn't like them and me neither.
Reviewed By: danielbuechele
Differential Revision: D14798690
fbshipit-source-id: 5ee7108b9ecfbb05cf2d54cfce68931d16d69a73
Summary:
`process.platform` is used to require the native-module for keytar. On Windows this returns `win32` (No matter if 64bit or 32bit system). The native module was named `keytar-win.node`. This diff renames it to `keytar-win32.node`.
This is the code that requires the module from `user.js`:
```
keytar = global.electronRequire(
path.join(
isProduction() ? remote.app.getAppPath() : process.cwd(),
'native-modules',
`keytar-${process.platform}.node`,
),
);
```
Reviewed By: priteshrnandgaonkar
Differential Revision: D14771646
fbshipit-source-id: cd48d25cb5921e07e472eb46636fa2599c8ff721
Summary:
Just minor version bumps so this doesn't have any noticeable effects.
Doing some cleanups after danielbuechele pointed out that it's important
for us to stay close to the upstream releases in the last team meeting.
Reviewed By: jknoxville
Differential Revision: D14665264
fbshipit-source-id: 91efb0663693823f394284457550716f22c40938
Summary:
Flipper Electron delegates to the Launcher if it is found right on startup to fetch the most recent/compatible version of Flipper. The Launcher then opens the downloaded app with a `--no-launcher` option to avoid bouncing back and forth between the Electron app and the Launcher.
This depends on the argument processing working unchanged. In the past this has been somewhat difficult to guarantee as this doesn't happen in one place and dev/prod builds have handled arguments different due to Electron weirdness (requiring a `--` passed in, for instance).
If anything here goes wrong, we end up in a very nasty scenario where the launcher and the Electron app rapidly open and close, making it nearly impossible for users to escape that vicious cycle. `pkill -f Flipper` being the best option, if you can focus a terminal for long enough.
In order to avoid this from ever happening in the future, this introduces a quick check for the last startup is written with a timestamp and if this is less than 5s in the past, we will skip delegating to the Launcher altogether, keeping the current instance running.
Reviewed By: jknoxville
Differential Revision: D14598136
fbshipit-source-id: b3335ce7ec7dc3e5e014d459db31df4c8a774fc6
Summary:
When passing --file or --url explicitly on startup, they should
be used in the same way that event handlers are used.
Reviewed By: jknoxville
Differential Revision: D14598688
fbshipit-source-id: 07179227da3b6c754a4d3a9e15342474e39d72b7
Summary:
Changes where we delegate to the launcher to a later point so we can successfully intercept file open events and custom URI events.
There's more information in Phase 1 in this paragraph of the doc: https://fb.quip.com/tpqnAbxnJw1w#UNZACAnVVGs
Reviewed By: danielbuechele
Differential Revision: D14563585
fbshipit-source-id: a8757a6072386e56102f15b0668456369a44aad7
Summary:
This fixes headless not terminating due to the `package.json` not being readable.
I instead write this to the `global` object in the same way that the version is
set.
Reviewed By: jknoxville
Differential Revision: D14579316
fbshipit-source-id: 238afe912366c423552305e120088f4abac4c20b
Summary:
Positional arguments with yargs are a mess, so I'm adding a `--file` instead.
This can then be used to pass parameters on through the launcher.
Reviewed By: danielbuechele
Differential Revision: D14525320
fbshipit-source-id: f04ebed85b6eb9e3c82e76736695d41e7bafb301
Summary:
Adding support for downloading archived Flipper data using a URL handler.
A URL looks like `flipper://import/?url=` and will download the file specified in the url param. While downloading the file, a spinner is shown in the app's titlebar.
Reviewed By: jknoxville
Differential Revision: D14262763
fbshipit-source-id: 6538fc78c07a48cef7b71b3f7bdbcb712d054593
Summary:
`keytar` is developped by the Nuclide team and allows cross-platform access to the system's keychain. As `keytar` has a native dependency, we need to make sure Metro doesn't try to bundle it as part of our JS bundle. We are adding another rule to our electron-transform, to not bundle `.node` files (which are native node modules).
Secondly, we need to make sure, the native module is compiled for the correct version of node.js. Usually native modules are compiled for the node version that is running on the system it is installed on. However, we need to make sure it is compiled with the node version that is bundled with electron. That's exactly what `electron-rebuild` does: It recompiles all native modules with the electron's node version.
More on native modules: https://electronjs.org/docs/tutorial/using-native-node-modules
Reviewed By: jknoxville
Differential Revision: D14224402
fbshipit-source-id: 6414a53391a861a23a5d95bf6f18cd0058d9178f
Summary:
Started with upgrading electron from 3.0.0 to 4.0.5. This required a bunch of subsequent updates:
* upgrading `electron-builder` to latest version, because the old version couldn't build electron 4 apps.
* `appDir` is deprecated in builder config, `projectDir` is used instead, which we already had set, so its fine to just remove this ([see GitHub commit](a5e457163e)).
* upgrading `jest-runner/electron` because the old version couldn't run electron 4 tests.
* upgrading our custom dependency resolution to use electron 4.0.5, because the test runner still resolves to 2.0.8 ([see GitHub issue](https://github.com/facebook-atom/jest-electron-runner/issues/31)).
* updating `sandcastle.sh` to use the new cache files from D14131344.
* removing `package-lock.json` as is was causing warnings. We use `yarn` and `yarn.lock` anyways. This file must have been committed by accident.
* updating our check to only run one version of Flipper at a time to use the new electron API `app.requestSingleInstanceLock` as the old one was removed in electron 4.
* updating the snapshot test that checks App rendering, which changed a little due to the electron upgrade.
* upgrading flow-type definitions to `electron-v4.0.5.js` generated by [electron-flowtype-definitions](https://github.com/danielbuechele/electron-flowtype-definitions).
**PS: Best new feature in Electron 4: Copy&paste working in dev tools**
Reviewed By: jknoxville
Differential Revision: D14131360
fbshipit-source-id: d7ed9643875629a1fa1860bb61b11dd0c64112ab
Summary:
Builds in flipper-public are failing, because duplicate imports: https://our.intern.facebook.com/intern/sandcastle/job/22517998213713260
That's most likely because the `flipper-public` is not blacklisted in metro, so let's add it!
Reviewed By: passy
Differential Revision: D14134423
fbshipit-source-id: 52f87196957c8578b8ac7f578efa74e3c13fe1bb
Summary: The electron stub is used by the headless version of Flipper. For that reason, the version number was always `1`. The headless version has a the actual version written to a global variable. So let's use it here.
Reviewed By: passy
Differential Revision: D14149692
fbshipit-source-id: c4781987fd3201e67897eaf31627b0bb2970ffcb
Summary:
To make it more obvious how to disable this if unwanted (e.g. when
testing local builds).
Pull Request resolved: https://github.com/facebook/flipper/pull/373
Reviewed By: jknoxville
Differential Revision: D14130771
Pulled By: passy
fbshipit-source-id: 82c83c1ad14737c8c7791de71a1ee23fcea5ec18
Summary: as per title. see explanation in code comment
Reviewed By: jknoxville
Differential Revision: D14125820
fbshipit-source-id: 9b8e31214a65a184397852544cebd7b69ea0aadb
Summary: Plugin files in subfolders were not watched. Adding recursive flag to reload plugins, even when there are changes in any of the plugin's subdirectories.
Reviewed By: jknoxville
Differential Revision: D14100394
fbshipit-source-id: 2a0b5e35df4bbbfe6cf8a0fafd5271222d99a46c
Summary:
Allows the launcher to provide messages to the user. Currently, in the form
of the red notification bar at the bottom. This is just meant as a temporary measure
during the alpha to have some clearly noticeable way of getting the user's attention.
I consider removing this a blocker for the release as this mechanism is not well
suited for this in many ways.
The current use case for this is providing a warning if a cached version is used
instead of the requested one, e.g. "Could not fetch requested Flipper version 'deadbeef', using cached version instead."
Reviewed By: jknoxville, priteshrnandgaonkar
Differential Revision: D14073687
fbshipit-source-id: 85630347027063103315eeb1286731fe2478e261
Summary:
For the production version, if the Launcher is installed and no `--no-launcher` (note the double-negation) is supplied, then
let the launcher start the app instead.
The launcher will pass the `--no-launcher` option back to prevent this from looping.
Reviewed By: jknoxville
Differential Revision: D14066620
fbshipit-source-id: 27d305efac36005e5e1082076829f10ef14aba0d