initial commit
This commit is contained in:
commit
33e75c056f
77 changed files with 4329 additions and 0 deletions
35
apps/desktop/src/bun/index.ts
Normal file
35
apps/desktop/src/bun/index.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { BrowserWindow, Updater } from "electrobun/bun";
|
||||
|
||||
const DEV_SERVER_PORT = 3001;
|
||||
const DEV_SERVER_URL = `http://localhost:${DEV_SERVER_PORT}`;
|
||||
|
||||
// Check if the web dev server is running for HMR
|
||||
async function getMainViewUrl(): Promise<string> {
|
||||
const channel = await Updater.localInfo.channel();
|
||||
if (channel === "dev") {
|
||||
try {
|
||||
await fetch(DEV_SERVER_URL, { method: "HEAD" });
|
||||
console.log(`HMR enabled: Using web dev server at ${DEV_SERVER_URL}`);
|
||||
return DEV_SERVER_URL;
|
||||
} catch {
|
||||
console.log('Web dev server not running. Run "bun run dev:hmr" for HMR support.');
|
||||
}
|
||||
}
|
||||
|
||||
return "views://mainview/index.html";
|
||||
}
|
||||
|
||||
const url = await getMainViewUrl();
|
||||
|
||||
new BrowserWindow({
|
||||
title: "minmon",
|
||||
url,
|
||||
frame: {
|
||||
width: 1280,
|
||||
height: 820,
|
||||
x: 120,
|
||||
y: 120,
|
||||
},
|
||||
});
|
||||
|
||||
console.log("Electrobun desktop shell started.");
|
||||
Loading…
Add table
Add a link
Reference in a new issue