electron update
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
This commit is contained in:
committed by
Facebook Github Bot
parent
0a59dc2918
commit
13f7444013
@@ -100,22 +100,23 @@ compilePlugins(
|
||||
});
|
||||
|
||||
// check if we already have an instance of this app open
|
||||
const isSecondInstance = app.makeSingleInstance(
|
||||
(commandLine, workingDirectory) => {
|
||||
// someone tried to run a second instance, we should focus our window
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (win) {
|
||||
if (win.isMinimized()) {
|
||||
win.restore();
|
||||
}
|
||||
|
||||
win.focus();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// if this is a second instance then quit the app to prevent collisions
|
||||
if (isSecondInstance) {
|
||||
app.quit();
|
||||
// Create myWindow, load the rest of the app, etc...
|
||||
app.on('ready', () => {});
|
||||
}
|
||||
|
||||
// quit app once all windows are closed
|
||||
|
||||
Reference in New Issue
Block a user