diff --git a/apps/array/src/main/index.ts b/apps/array/src/main/index.ts index a846ee62a9..5204ff6876 100644 --- a/apps/array/src/main/index.ts +++ b/apps/array/src/main/index.ts @@ -1,10 +1,16 @@ +declare const __BUILD_COMMIT__: string | undefined; +declare const __BUILD_DATE__: string | undefined; + import dns from "node:dns"; import { mkdirSync } from "node:fs"; +import os from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { app, BrowserWindow, + clipboard, + dialog, ipcMain, Menu, type MenuItemConstructorOptions, @@ -116,7 +122,38 @@ function createWindow(): void { { label: "Array", submenu: [ - { role: "about" }, + { + label: "About Array", + click: () => { + const commit = __BUILD_COMMIT__ ?? "dev"; + const buildDate = __BUILD_DATE__ ?? "dev"; + const info = [ + `Version: ${app.getVersion()}`, + `Commit: ${commit}`, + `Date: ${buildDate}`, + `Electron: ${process.versions.electron}`, + `Chromium: ${process.versions.chrome}`, + `Node.js: ${process.versions.node}`, + `V8: ${process.versions.v8}`, + `OS: ${process.platform} ${process.arch} ${os.release()}`, + ].join("\n"); + + dialog + .showMessageBox({ + type: "info", + title: "About Array", + message: "Array", + detail: info, + buttons: ["Copy", "OK"], + defaultId: 1, + }) + .then((result) => { + if (result.response === 0) { + clipboard.writeText(info); + } + }); + }, + }, { type: "separator" }, { label: "Check for Updates...", diff --git a/apps/array/vite.main.config.mts b/apps/array/vite.main.config.mts index 132e4139dd..979898a245 100644 --- a/apps/array/vite.main.config.mts +++ b/apps/array/vite.main.config.mts @@ -1,3 +1,4 @@ +import { execSync } from "node:child_process"; import { copyFileSync, existsSync, mkdirSync } from "node:fs"; import path, { join } from "node:path"; import { fileURLToPath } from "node:url"; @@ -5,6 +6,18 @@ import { defineConfig, type Plugin } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; import { autoServicesPlugin } from "./vite-plugin-auto-services.js"; +function getGitCommit(): string { + try { + return execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim(); + } catch { + return "unknown"; + } +} + +function getBuildDate(): string { + return new Date().toISOString(); +} + const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** @@ -139,6 +152,10 @@ function copyClaudeExecutable(): Plugin { } export default defineConfig({ + define: { + __BUILD_COMMIT__: JSON.stringify(getGitCommit()), + __BUILD_DATE__: JSON.stringify(getBuildDate()), + }, plugins: [ tsconfigPaths(), autoServicesPlugin(join(__dirname, "src/main/services")),