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
39 changes: 38 additions & 1 deletion apps/array/src/main/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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...",
Expand Down
17 changes: 17 additions & 0 deletions apps/array/vite.main.config.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { execSync } from "node:child_process";
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
import path, { join } from "node:path";
import { fileURLToPath } from "node:url";
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));

/**
Expand Down Expand Up @@ -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")),
Expand Down