Back out "Back out Electron 7.1.1/7.1.2 upgrades"

Summary:
Original commit changeset: 05d13aca7145

Attempt to upgrade `electron` as it instacrashed; `electron-builder` version 22.1.0 didn't sign package correctly and caused the instacrash,

Reduced the version to 21.2.0 (latest).

Reviewed By: passy, nikoant

Differential Revision: D18954671

fbshipit-source-id: bc2dbd4fec9afb51d9a535974651b13d195407b4
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-01-06 09:42:46 -08:00
committed by Facebook Github Bot
parent 2fac06e018
commit bacb1958fc
11 changed files with 351 additions and 564 deletions

View File

@@ -26,7 +26,8 @@
} }
}, },
"win": { "win": {
"publisherName": "Facebook, Inc." "publisherName": "Facebook, Inc.",
"sign": null
}, },
"asar": false, "asar": false,
"fileAssociations": [ "fileAssociations": [
@@ -41,7 +42,7 @@
] ]
}, },
"resolutions": { "resolutions": {
"@jest-runner/electron/electron": "5.0.11", "@jest-runner/electron/electron": "7.1.2",
"adbkit/adbkit-logcat": "2", "adbkit/adbkit-logcat": "2",
"@types/react": "16.9.15", "@types/react": "16.9.15",
"@types/react-dom": "^16.9.4" "@types/react-dom": "^16.9.4"
@@ -60,7 +61,7 @@
"clearMocks": true "clearMocks": true
}, },
"devDependencies": { "devDependencies": {
"@jest-runner/electron": "^2.0.1", "@jest-runner/electron": "^2.0.2",
"@testing-library/react": "^9.3.0", "@testing-library/react": "^9.3.0",
"@types/algoliasearch": "^3.30.19", "@types/algoliasearch": "^3.30.19",
"@types/deep-equal": "^1.0.1", "@types/deep-equal": "^1.0.1",
@@ -87,8 +88,8 @@
"@typescript-eslint/parser": "^2.1.1-alpha.4", "@typescript-eslint/parser": "^2.1.1-alpha.4",
"babel-code-frame": "^6.26.0", "babel-code-frame": "^6.26.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"electron": "^5.0.11", "electron": "7.1.2",
"electron-builder": "^20.38.5", "electron-builder": "^21.2.0",
"eslint": "^6.7.0", "eslint": "^6.7.0",
"eslint-config-fbjs": "^3.1.1", "eslint-config-fbjs": "^3.1.1",
"eslint-plugin-babel": "^5.3.0", "eslint-plugin-babel": "^5.3.0",
@@ -192,8 +193,6 @@
}, },
"greenkeeper": { "greenkeeper": {
"ignore": [ "ignore": [
"electron",
"electron-builder",
"tmp" "tmp"
] ]
}, },

View File

@@ -108,7 +108,7 @@ export function setupMenuBar(
const menu = applicationMenu.items.find( const menu = applicationMenu.items.find(
menuItem => menuItem.label === topLevelMenu, menuItem => menuItem.label === topLevelMenu,
); );
if (menu) { if (menu && menu.submenu) {
const menuItem = menu.submenu.items.find( const menuItem = menu.submenu.items.find(
menuItem => menuItem.label === label, menuItem => menuItem.label === label,
); );
@@ -270,7 +270,7 @@ function getTemplate(
{ {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
role: 'selectall', role: 'selectAll',
}, },
], ],
}, },
@@ -384,7 +384,7 @@ function getTemplate(
]; ];
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
const name = app.getName(); const name = app.name;
template.unshift({ template.unshift({
label: name, label: name,
submenu: [ submenu: [
@@ -411,7 +411,7 @@ function getTemplate(
{ {
label: 'Hide Others', label: 'Hide Others',
accelerator: 'Command+Shift+H', accelerator: 'Command+Shift+H',
role: 'hideothers', role: 'hideOthers',
}, },
{ {
label: 'Show All', label: 'Show All',

View File

@@ -7,6 +7,7 @@
* @format * @format
*/ */
import electron from 'electron';
import {FlexColumn, styled, Text, FlexRow, Input, colors, Glyph} from 'flipper'; import {FlexColumn, styled, Text, FlexRow, Input, colors, Glyph} from 'flipper';
import React, {useState} from 'react'; import React, {useState} from 'react';
import {promises as fs} from 'fs'; import {promises as fs} from 'fs';
@@ -87,16 +88,18 @@ export function FilePathConfigField(props: {
/> />
<FlexColumn <FlexColumn
onClick={() => onClick={() =>
remote.dialog.showOpenDialog( remote.dialog
{ .showOpenDialog({
properties: ['openDirectory', 'showHiddenFiles'], properties: ['openDirectory', 'showHiddenFiles'],
defaultPath: path.resolve('/'), defaultPath: path.resolve('/'),
}, })
(paths: Array<string> | undefined) => { .then((result: electron.SaveDialogReturnValue) => {
paths && setValue(paths[0]); if (result.filePath) {
paths && props.onChange(paths[0]); const path: string = result.filePath.toString();
}, setValue(path);
) props.onChange(path);
}
})
}> }>
<CenteredGlyph name="dots-3-circle" variant="outline" /> <CenteredGlyph name="dots-3-circle" variant="outline" />
</FlexColumn> </FlexColumn>

View File

@@ -7,7 +7,7 @@
* @format * @format
*/ */
import {remote, ipcRenderer} from 'electron'; import {remote, ipcRenderer, IpcRendererEvent} from 'electron';
import {toggleAction} from '../reducers/application'; import {toggleAction} from '../reducers/application';
import {setStaticView} from '../reducers/connections'; import {setStaticView} from '../reducers/connections';
import {Store} from '../reducers/index.js'; import {Store} from '../reducers/index.js';
@@ -68,7 +68,7 @@ export default (store: Store, logger: Logger) => {
ipcRenderer.on( ipcRenderer.on(
'flipper-protocol-handler', 'flipper-protocol-handler',
(_event: string, query: string) => { (_event: IpcRendererEvent, query: string) => {
const uri = new URL(query); const uri = new URL(query);
if (query.startsWith('flipper://import')) { if (query.startsWith('flipper://import')) {
const {search} = new URL(query); const {search} = new URL(query);
@@ -117,11 +117,14 @@ export default (store: Store, logger: Logger) => {
}, },
); );
ipcRenderer.on('open-flipper-file', (_event: string, url: string) => { ipcRenderer.on(
'open-flipper-file',
(_event: IpcRendererEvent, url: string) => {
tryCatchReportPlatformFailures(() => { tryCatchReportPlatformFailures(() => {
return importFileToStore(url, store); return importFileToStore(url, store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:Deeplink`); }, `${IMPORT_FLIPPER_TRACE_EVENT}:Deeplink`);
}); },
);
if (process.env.FLIPPER_PORTS) { if (process.env.FLIPPER_PORTS) {
const portOverrides = parseFlipperPorts(process.env.FLIPPER_PORTS); const portOverrides = parseFlipperPorts(process.env.FLIPPER_PORTS);

View File

@@ -12,8 +12,8 @@ import {Logger} from '../fb-interfaces/Logger';
import {PluginNotification} from '../reducers/notifications'; import {PluginNotification} from '../reducers/notifications';
import {FlipperPlugin, FlipperDevicePlugin} from '../plugin'; import {FlipperPlugin, FlipperDevicePlugin} from '../plugin';
import isHeadless from '../utils/isHeadless'; import isHeadless from '../utils/isHeadless';
import {ipcRenderer} from 'electron';
import {setStaticView} from '../reducers/connections'; import {setStaticView} from '../reducers/connections';
import {ipcRenderer, IpcRendererEvent} from 'electron';
import { import {
setActiveNotifications, setActiveNotifications,
updatePluginBlacklist, updatePluginBlacklist,
@@ -39,6 +39,7 @@ export default (store: Store, logger: Logger) => {
ipcRenderer.on( ipcRenderer.on(
'notificationEvent', 'notificationEvent',
( (
_event: IpcRendererEvent,
_e: Error, _e: Error,
eventName: NotificationEvents, eventName: NotificationEvents,
pluginNotification: PluginNotification, pluginNotification: PluginNotification,

View File

@@ -724,8 +724,9 @@ export function showOpenDialog(store: Store) {
properties: ['openFile'], properties: ['openFile'],
filters: [{extensions: ['flipper', 'json', 'txt'], name: 'Flipper files'}], filters: [{extensions: ['flipper', 'json', 'txt'], name: 'Flipper files'}],
}; };
remote.dialog.showOpenDialog(options, (filePaths?: Array<string>) => { remote.dialog.showOpenDialog(options).then(result => {
if (filePaths !== undefined && filePaths.length > 0) { const filePaths = result.filePaths;
if (filePaths.length > 0) {
tryCatchReportPlatformFailures(() => { tryCatchReportPlatformFailures(() => {
importFileToStore(filePaths[0], store); importFileToStore(filePaths[0], store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:UI`); }, `${IMPORT_FLIPPER_TRACE_EVENT}:UI`);
@@ -734,14 +735,17 @@ export function showOpenDialog(store: Store) {
} }
export function startFileExport(dispatch: Store['dispatch']) { export function startFileExport(dispatch: Store['dispatch']) {
electron.remote.dialog.showSaveDialog( electron.remote.dialog
.showSaveDialog(
// @ts-ignore This appears to work but isn't allowed by the types // @ts-ignore This appears to work but isn't allowed by the types
null, null,
{ {
title: 'FlipperExport', title: 'FlipperExport',
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'), defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
}, },
async (file: string) => { )
.then(async (result: electron.SaveDialogReturnValue) => {
const file = result.filePath;
if (!file) { if (!file) {
return; return;
} }
@@ -752,8 +756,7 @@ export function startFileExport(dispatch: Store['dispatch']) {
closeOnFinish: false, closeOnFinish: false,
}), }),
); );
}, });
);
} }
export function startLinkExport(dispatch: Store['dispatch']) { export function startLinkExport(dispatch: Store['dispatch']) {

View File

@@ -9,7 +9,7 @@
import Client, {ClientQuery} from '../../Client'; import Client, {ClientQuery} from '../../Client';
import {FlipperClientConnection} from '../../Client'; import {FlipperClientConnection} from '../../Client';
import {ipcRenderer, remote} from 'electron'; import {ipcRenderer, remote, IpcRendererEvent} from 'electron';
import JSDevice from '../../devices/JSDevice'; import JSDevice from '../../devices/JSDevice';
import {Store} from 'src/reducers'; import {Store} from 'src/reducers';
import {Logger} from 'src/fb-interfaces/Logger'; import {Logger} from 'src/fb-interfaces/Logger';
@@ -41,7 +41,7 @@ export function initJsEmulatorIPC(
) { ) {
ipcRenderer.on( ipcRenderer.on(
'from-js-emulator-init-client', 'from-js-emulator-init-client',
(_event: string, message: any) => { (_event: IpcRendererEvent, message: any) => {
const {windowId} = message; const {windowId} = message;
const {plugins, appName} = message.payload; const {plugins, appName} = message.payload;
store.dispatch({ store.dispatch({
@@ -102,7 +102,9 @@ export function initJsEmulatorIPC(
flipperServer.emit('clients-change'); flipperServer.emit('clients-change');
client.emit('plugins-change'); client.emit('plugins-change');
ipcRenderer.on('from-js-emulator', (_event: string, message: any) => { ipcRenderer.on(
'from-js-emulator',
(_event: IpcRendererEvent, message: any) => {
const {command, payload} = message; const {command, payload} = message;
if (command === 'sendFlipperObject') { if (command === 'sendFlipperObject') {
client.onMessage( client.onMessage(
@@ -116,7 +118,8 @@ export function initJsEmulatorIPC(
}), }),
); );
} }
}); },
);
}); });
}, },
); );

791
yarn.lock

File diff suppressed because it is too large Load Diff