diff --git a/backend/instance.ts b/backend/instance.ts index 7c3c297..b987cdb 100644 --- a/backend/instance.ts +++ b/backend/instance.ts @@ -10,6 +10,7 @@ import { AppInfo } from "./appInfo"; import { getColorForId } from "./color"; import { Instance as FrontendInstance } from "../types/instance"; import { getInstanceUrl } from "./instance_url"; +import { env } from "process"; export type Options = { basePort: number; @@ -53,7 +54,9 @@ class Instance { start() { this.server = this.app.listen(this.port, () => { - console.log(`Starting webxdc instance at port ${this.port}`); + if (env["NODE_DEBUG"]) { + console.debug(`Starting webxdc instance at port ${this.port}`); + } }); } diff --git a/backend/run.ts b/backend/run.ts index c47b0b1..9cdfd78 100644 --- a/backend/run.ts +++ b/backend/run.ts @@ -1,11 +1,12 @@ import detectPort from "detect-port"; -import process from "process"; +import process, { env } from "process"; import open from "open"; import { createFrontend, InjectExpress } from "./app"; import { Instances, Options } from "./instance"; import { getLocation, Location, LocationError } from "./location"; import { getAppInfo, AppInfo, AppInfoError } from "./appInfo"; +import { getInstanceUrl } from "./instance_url"; export type Inject = { injectFrontend: InjectExpress; @@ -35,12 +36,17 @@ async function actualRun( ); frontend.listen(options.basePort, () => { - console.log("Starting webxdc-dev frontend"); + console.info( + `\n=> Started webxdc-dev frontend on ${getInstanceUrl(options.basePort)}`, + ); }); instances.start(); - open("http://localhost:" + options.basePort); + if (!env["CODESPACE_NAME"]) { + // do not auto open on gh codespace + open("http://localhost:" + options.basePort); + } } export async function run( @@ -65,7 +71,7 @@ export async function run( }); } - console.log("Starting webxdc project in:", locationStr); + console.debug("Starting webxdc project in:", locationStr); try { const appInfo = await getAppInfo(location);