This commit is contained in:
Nathan Bierema 2021-08-29 14:48:21 -04:00
parent d15e6ee0e4
commit 437d6c8b9a
3 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import path from 'path';
import spawn from 'cross-spawn'; import spawn from 'cross-spawn';
import { Options } from '../options'; import { Options } from '../options';
export default function openApp(app: boolean | string, options: Options) { export default async function openApp(app: true | string, options: Options) {
if (app === true || app === 'electron') { if (app === true || app === 'electron') {
try { try {
const port = options.port ? `--port=${options.port}` : ''; const port = options.port ? `--port=${options.port}` : '';
@ -31,9 +31,9 @@ export default function openApp(app: boolean | string, options: Options) {
} }
return; return;
} }
// eslint-disable-next-line @typescript-eslint/no-floating-promises
open( await open(
`http://localhost:${options.port}/`, `http://localhost:${options.port}/`,
app !== 'browser' ? { app: app as string } : undefined app !== 'browser' ? { app: { name: app } } : undefined
); );
} }

View File

@ -90,8 +90,8 @@ if (argv.injectserver) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
server(argv).then(function (r) { server(argv).then(function (r) {
if (argv.open && argv.open !== 'false') { if (argv.open && argv.open !== 'false') {
r.on('ready', function () { r.on('ready', async function () {
openApp(argv.open, options); await openApp(argv.open, options);
}); });
} }
}); });

View File

@ -14,7 +14,7 @@ export interface ExtendedOptions extends Options {
export default function (argv: { [arg: string]: any }): Promise<{ export default function (argv: { [arg: string]: any }): Promise<{
portAlreadyUsed?: boolean; portAlreadyUsed?: boolean;
on: (status: 'ready', cb: () => void) => void; on: (status: 'ready', cb: (() => void) | (() => Promise<void>)) => void;
}> { }> {
const options = Object.assign(getOptions(argv), { const options = Object.assign(getOptions(argv), {
workerController: __dirname + '/worker.js', workerController: __dirname + '/worker.js',