No not delegate launch to Flipper Launcher

Summary: ^

Reviewed By: aigoncharov

Differential Revision: D50557385

fbshipit-source-id: d9571dda36520eae19f2d5fda4f52807f439a4e1
This commit is contained in:
Lorenzo Blasa
2023-10-24 07:18:43 -07:00
committed by Facebook GitHub Bot
parent bf49924f0c
commit da7917cefe

View File

@@ -28,7 +28,6 @@ import fixPath from 'fix-path';
import {exec} from 'child_process'; import {exec} from 'child_process';
import setup, {Config, configPath} from './setup'; import setup, {Config, configPath} from './setup';
import isFB from './fb-stubs/isFB'; import isFB from './fb-stubs/isFB';
import delegateToLauncher from './launcher';
import yargs from 'yargs'; import yargs from 'yargs';
import {promisify} from 'util'; import {promisify} from 'util';
import process from 'process'; import process from 'process';
@@ -174,58 +173,50 @@ app.on('ready', async () => {
const config = await setup(argv); const config = await setup(argv);
processConfig(config); processConfig(config);
// If we delegate to the launcher, shut down this instance of the app. appReady = true;
delegateToLauncher(argv)
.then(async (hasLauncherInvoked: boolean) => {
if (hasLauncherInvoked) {
app.quit();
return;
}
appReady = true;
app.commandLine.appendSwitch('scroll-bounce');
configureSession();
createWindow(config);
// if in development install the react devtools extension app.commandLine.appendSwitch('scroll-bounce');
if (process.env.NODE_ENV === 'development') { configureSession();
const { createWindow(config);
default: installExtension,
REACT_DEVELOPER_TOOLS, // if in development install the react devtools extension
} = require('electron-devtools-installer'); if (process.env.NODE_ENV === 'development') {
// if set, try to download a newever version of the dev tools const {
const forceDownload = process.env.FLIPPER_UPDATE_DEV_TOOLS === 'true'; default: installExtension,
if (forceDownload) { REACT_DEVELOPER_TOOLS,
console.log('Force updating DevTools'); } = require('electron-devtools-installer');
} // if set, try to download a newever version of the dev tools
// React const forceDownload = process.env.FLIPPER_UPDATE_DEV_TOOLS === 'true';
// Fix for extension loading (see D27685981) if (forceDownload) {
// Work around per https://github.com/electron/electron/issues/23662#issuecomment-787420799 console.log('Force updating DevTools');
const reactDevToolsPath = `${os.homedir()}/Library/Application Support/Electron/extensions/${ }
REACT_DEVELOPER_TOOLS.id // React
}`; // Fix for extension loading (see D27685981)
if (await promisify(fs.exists)(reactDevToolsPath)) { // Work around per https://github.com/electron/electron/issues/23662#issuecomment-787420799
console.log('Loading React devtools from disk ' + reactDevToolsPath); const reactDevToolsPath = `${os.homedir()}/Library/Application Support/Electron/extensions/${
try { REACT_DEVELOPER_TOOLS.id
await session.defaultSession.loadExtension( }`;
reactDevToolsPath, if (await promisify(fs.exists)(reactDevToolsPath)) {
// @ts-ignore only supported (and needed) in Electron 12 console.log('Loading React devtools from disk ' + reactDevToolsPath);
{allowFileAccess: true}, try {
); await session.defaultSession.loadExtension(
} catch (e) { reactDevToolsPath,
console.error('Failed to load React devtools from disk: ', e); // @ts-ignore only supported (and needed) in Electron 12
} {allowFileAccess: true},
} else { );
try { } catch (e) {
await installExtension(REACT_DEVELOPER_TOOLS.id, { console.error('Failed to load React devtools from disk: ', e);
loadExtensionOptions: {allowFileAccess: true, forceDownload},
});
} catch (e) {
console.error('Failed to install React devtools extension', e);
}
}
} }
}) } else {
.catch((e: any) => console.error('Error while delegating app launch', e)); try {
await installExtension(REACT_DEVELOPER_TOOLS.id, {
loadExtensionOptions: {allowFileAccess: true, forceDownload},
});
} catch (e) {
console.error('Failed to install React devtools extension', e);
}
}
}
}); });
app.on('web-contents-created', (_event, contents) => { app.on('web-contents-created', (_event, contents) => {