From 2cc6ac4667459a129f1b73bd7338f74b9b39ee76 Mon Sep 17 00:00:00 2001 From: izzy Date: Wed, 8 Oct 2025 17:28:30 +0100 Subject: [PATCH] chore: try to get everything building --- .github/workflows/build.yml | 44 +++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 1 - assets | 2 +- forge.config.ts | 22 +++++++++---------- src/native/badges.ts | 7 +++--- src/native/tray.ts | 7 ++---- src/native/window.ts | 17 ++++++-------- tsconfig.json | 3 ++- 8 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..31afab9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +on: + push: + tags: + - "*" + branches: + - "**" + +jobs: + build-and-release: + name: Build App + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Checkout (with submodules) + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Build or Publish + run: | + if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then + pnpm run publish + else + pnpm run make + fi + shell: bash diff --git a/.vscode/settings.json b/.vscode/settings.json index 577c9f5..35d980e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { "editor.formatOnSave": true, "files.exclude": { - "**/.vite": true, "**/node_modules": true, "**/tsconfig.json": false }, diff --git a/assets b/assets index f60a38e..628eb2f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f60a38e13761d08b578ec061d13bb4f7759c3f80 +Subproject commit 628eb2f8255c215148007f4227d2e0d5d1a67582 diff --git a/forge.config.ts b/forge.config.ts index 95f2f47..70d9937 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -9,7 +9,8 @@ import { VitePlugin } from "@electron-forge/plugin-vite"; import { PublisherGithub } from "@electron-forge/publisher-github"; import type { ForgeConfig } from "@electron-forge/shared-types"; import { FuseV1Options, FuseVersion } from "@electron/fuses"; -import { globSync } from "node:fs"; + +// import { globSync } from "node:fs"; const STRINGS = { author: "Revolt Platforms LTD", @@ -26,10 +27,10 @@ const config: ForgeConfig = { name: STRINGS.name, executableName: STRINGS.execName, icon: `${ASSET_DIR}/icon`, - extraResource: [ - // include all the asset files - ...globSync(ASSET_DIR + "/**/*"), - ], + // extraResource: [ + // // include all the asset files + // ...globSync(ASSET_DIR + "/**/*"), + // ], }, rebuildConfig: {}, makers: [ @@ -42,8 +43,12 @@ const config: ForgeConfig = { authors: STRINGS.author, // todo: hoist this iconUrl: `https://stoat.chat/app/assets/icon-DUSNE-Pb.ico`, + // todo: loadingGif setupIcon: `${ASSET_DIR}/icon.ico`, description: STRINGS.description, + exe: `${STRINGS.execName}.exe`, + setupExe: `${STRINGS.execName}-setup.exe`, + copyright: "Copyright (C) 2025 Revolt Platforms LTD", }), new MakerZIP({}), new MakerFlatpak({ @@ -130,12 +135,7 @@ const config: ForgeConfig = { target: "preload", }, ], - renderer: [ - { - name: "main_window", - config: "vite.renderer.config.ts", - }, - ], + renderer: [], }), // Fuses are used to enable/disable various Electron functionality // at package time, before code signing the application diff --git a/src/native/badges.ts b/src/native/badges.ts index 3295c6a..7d8796c 100644 --- a/src/native/badges.ts +++ b/src/native/badges.ts @@ -1,5 +1,4 @@ import dbus from "@homebridge/dbus-native"; -import { resolve } from "node:path"; import { NativeImage, app, nativeImage } from "electron"; @@ -19,8 +18,10 @@ export async function setBadgeCount(count: number) { } if (!nativeIcons[count]) - nativeIcons[count] = nativeImage.createFromPath( - resolve(process.resourcesPath, `${Math.min(count, 10)}.ico`), + nativeIcons[count] = nativeImage.createFromDataURL( + await import( + `../../assets/desktop/badges/${Math.min(count, 10)}.ico?asset` + ), ); mainWindow.setOverlayIcon( diff --git a/src/native/tray.ts b/src/native/tray.ts index a6cefcb..5d720e9 100644 --- a/src/native/tray.ts +++ b/src/native/tray.ts @@ -1,7 +1,6 @@ -import { resolve } from "node:path"; - import { Menu, Tray, nativeImage } from "electron"; +import trayIconAsset from "../../assets/desktop/icon.png?asset"; import { version } from "../../package.json"; import { mainWindow, quitApp } from "./window"; @@ -10,9 +9,7 @@ import { mainWindow, quitApp } from "./window"; let tray: Tray = null; // load the tray icon -const trayIcon = nativeImage.createFromPath( - resolve(process.resourcesPath, "icon.png"), -); +const trayIcon = nativeImage.createFromDataURL(trayIconAsset); // trayIcon.setTemplateImage(true); diff --git a/src/native/window.ts b/src/native/window.ts index 905b88d..2aa32a4 100644 --- a/src/native/window.ts +++ b/src/native/window.ts @@ -1,4 +1,4 @@ -import { join, resolve } from "node:path"; +import { join } from "node:path"; import { BrowserWindow, @@ -9,7 +9,8 @@ import { nativeImage, } from "electron"; -import { setBadgeCount } from "./badges"; +import windowIconAsset from "../../assets/desktop/icon.png?asset"; + import { config } from "./config"; import { updateTrayMenu } from "./tray"; @@ -27,11 +28,7 @@ export const BUILD_URL = new URL( let shouldQuit = false; // load the window icon -const windowIcon = nativeImage.createFromPath( - resolve(process.resourcesPath, "icon.png"), -); - -console.info(resolve(process.resourcesPath, "icon.png")); +const windowIcon = nativeImage.createFromDataURL(windowIconAsset); // windowIcon.setTemplateImage(true); @@ -43,7 +40,7 @@ export function createMainWindow() { mainWindow = new BrowserWindow({ minWidth: 300, minHeight: 300, - width: 800, + width: 1100, height: 600, backgroundColor: "#191919", frame: !config.customFrame, @@ -156,8 +153,8 @@ export function createMainWindow() { // mainWindow.webContents.openDevTools(); - let i = 0; - setInterval(() => setBadgeCount((++i % 30) + 1), 1000); + // let i = 0; + // setInterval(() => setBadgeCount((++i % 30) + 1), 1000); } /** diff --git a/tsconfig.json b/tsconfig.json index 74434b2..a38291d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "baseUrl": ".", "outDir": "dist", "moduleResolution": "node", - "resolveJsonModule": true + "resolveJsonModule": true, + "types": ["electron-vite/node"] } }