Open flag when starting server in debug mode

Summary:
It was hard-coded to always open the first time.

This allows to run the server on debug mode without opening UI.

Reviewed By: antonk52

Differential Revision: D51115746

fbshipit-source-id: 9467f0fbff45987247a2bb3bf5eb1aa578de1913
This commit is contained in:
Lorenzo Blasa
2023-11-08 09:20:13 -08:00
committed by Facebook GitHub Bot
parent 9b9eb00b63
commit 92d1454140

View File

@@ -49,6 +49,11 @@ const argv = yargs
choices: ['stable', 'insiders'],
default: 'stable',
},
open: {
describe: 'Open Flipper in the default browser after starting',
type: 'boolean',
default: true,
},
})
.version('DEV')
.help()
@@ -103,7 +108,9 @@ async function copyStaticResources() {
async function restartServer() {
try {
await compileServerMain();
await launchServer(true, ++startCount === 1); // only open on the first time
// Only open the UI the first time it runs. Subsequent runs, likely triggered after
// saving changes, should just reload the existing UI.
await launchServer(true, argv.open && ++startCount === 1);
} catch (e) {
console.error(
chalk.red(