Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`);
}
});
}

Expand Down
14 changes: 10 additions & 4 deletions backend/run.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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);
Expand Down