From 8addd43f097537f7bc5cbe8f51f28d2ae5182ef2 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Fri, 17 Apr 2020 06:17:15 -0700 Subject: [PATCH] Flag "--open-dev-tools" to automatically open dev tools on startup Summary: Just a convenient feature: `yarn start --open-dev-tools` opens Dev Tools window alongside with Flipper window. Changelog: new command-line flag "--open-dev-tools" to automatically open Chrome Dev Tools for Flipper debugging. Reviewed By: mweststrate Differential Revision: D21074769 fbshipit-source-id: 12ae33ab74a3d35c54051321396d8701d72c7e32 --- desktop/static/main.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/desktop/static/main.ts b/desktop/static/main.ts index cb187e876..904ef79ba 100644 --- a/desktop/static/main.ts +++ b/desktop/static/main.ts @@ -78,6 +78,11 @@ const argv = yargs '[Internal] Used to provide a user message from the launcher to the user.', type: 'string', }, + 'open-dev-tools': { + describe: 'Open Dev Tools window on startup.', + default: false, + type: 'boolean', + }, }) .version(VERSION) .help() @@ -285,7 +290,12 @@ function tryCreateWindow() { nativeWindowOpen: true, }, }); - win.once('ready-to-show', () => win.show()); + win.once('ready-to-show', () => { + win.show(); + if (argv['open-dev-tools']) { + win.webContents.openDevTools(); + } + }); win.once('close', () => { win.webContents.send('trackUsage', 'exit'); if (process.env.NODE_ENV === 'development') {