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
This commit is contained in:
Anton Nikolaev
2020-04-17 06:17:15 -07:00
committed by Facebook GitHub Bot
parent f0ee6f9749
commit 8addd43f09

View File

@@ -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') {