initial commit

This commit is contained in:
Syahdan 2026-04-29 17:01:16 +07:00
commit 33e75c056f
77 changed files with 4329 additions and 0 deletions

1
apps/desktop/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
artifacts

View file

@ -0,0 +1,35 @@
import type { ElectrobunConfig } from "electrobun";
const webBuildDir = "../web/dist";
export default {
app: {
name: "minmon",
identifier: "dev.bettertstack.minmon.desktop",
version: "0.0.1",
},
runtime: {
exitOnLastWindowClosed: true,
},
build: {
bun: {
entrypoint: "src/bun/index.ts",
},
copy: {
[webBuildDir]: "views/mainview",
},
watchIgnore: [`${webBuildDir}/**`],
mac: {
bundleCEF: true,
defaultRenderer: "cef",
},
linux: {
bundleCEF: true,
defaultRenderer: "cef",
},
win: {
bundleCEF: true,
defaultRenderer: "cef",
},
},
} satisfies ElectrobunConfig;

23
apps/desktop/package.json Normal file
View file

@ -0,0 +1,23 @@
{
"name": "desktop",
"private": true,
"type": "module",
"scripts": {
"start": "turbo -F web build && electrobun dev",
"dev": "electrobun dev --watch",
"dev:hmr": "concurrently \"bun run hmr\" \"bun run start\"",
"hmr": "turbo -F web dev",
"build": "turbo -F web build && electrobun build",
"build:stable": "turbo -F web build && electrobun build --env=stable",
"build:canary": "turbo -F web build && electrobun build --env=canary",
"check-types": "tsc --noEmit"
},
"dependencies": {
"electrobun": "^1.15.1"
},
"devDependencies": {
"@types/bun": "catalog:",
"concurrently": "^9.1.0",
"typescript": "catalog:"
}
}

View 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.");

View file

@ -0,0 +1,14 @@
{
"extends": "../../packages/config/tsconfig.base.json",
"compilerOptions": {
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "electrobun.config.ts"]
}