Skip to content

Commit c12d036

Browse files
sbkafSimon-Laux
authored andcommitted
open the browser with -o, --open like in vite otherwise do nothing
1 parent 5561ca1 commit c12d036

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

backend/instance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { env } from "process";
1414

1515
export type Options = {
1616
basePort: number;
17+
open: boolean;
1718
csp: boolean;
1819
verbose: boolean;
1920
};

backend/program.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function createProgram(inject: Inject): Command {
3434
parsePort,
3535
7000,
3636
)
37+
.option("-o, --open", "automatically open webxdc-dev UI in the browser")
3738
.option("--no-csp", "run instances without CSP applied")
3839
.option(
3940
"-v, --verbose",
@@ -46,7 +47,12 @@ export function createProgram(inject: Inject): Command {
4647
.action(async (location, options) => {
4748
await run(
4849
location,
49-
{ basePort: options.port, csp: options.csp, verbose: options.verbose },
50+
{
51+
basePort: options.port,
52+
open: options.open,
53+
csp: options.csp,
54+
verbose: options.verbose,
55+
},
5056
inject,
5157
);
5258
});

backend/run.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ async function actualRun(
4343

4444
instances.start();
4545

46-
if (!env["CODESPACE_NAME"]) {
47-
// do not auto open on gh codespace
46+
if (options.open) {
4847
open("http://localhost:" + options.basePort);
4948
}
5049
}

0 commit comments

Comments
 (0)