diff --git a/desktop/package.json b/desktop/package.json index 316ee0b8e..689cd8db9 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -170,6 +170,7 @@ "metro-minify-terser": "^0.66.2", "metro-resolver": "^0.66.2", "node-fetch": "^2.6.6", + "open": "^8.3.0", "p-filter": "^2.1.0", "p-map": "^4.0.0", "patch-package": "^6.4.7", diff --git a/desktop/scripts/start-flipper-server.ts b/desktop/scripts/start-flipper-server.ts index e245b452b..3a73ceac5 100644 --- a/desktop/scripts/start-flipper-server.ts +++ b/desktop/scripts/start-flipper-server.ts @@ -15,6 +15,7 @@ import Watchman from './watchman'; import {serverDir} from './paths'; import isFB from './isFB'; import yargs from 'yargs'; +import open from 'open'; const argv = yargs .usage('yarn start [args]') @@ -59,6 +60,11 @@ const argv = yargs 'Build the server without watching for changing or starting the service', type: 'boolean', }, + open: { + describe: 'Open Flipper in the default browser after starting', + type: 'boolean', + default: true, + }, }) .version('DEV') .help() @@ -186,6 +192,14 @@ async function startWatchChanges() { await compileServerMain(); } else { await startWatchChanges(); - restartServer(); // builds and starts + // builds and starts + await restartServer(); + + if (argv.open) { + setTimeout(() => { + // TODO: make port configurable together with flipper-server + open('http://localhost:52342/index.web.dev.html'); + }, 2000); + } } })();