Skip to content

Commit 8f0cadb

Browse files
committed
feat: build passing
1 parent 0a27151 commit 8f0cadb

File tree

6 files changed

+64
-3
lines changed

6 files changed

+64
-3
lines changed

forge.config.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
import { execSync } from "node:child_process";
2-
import { existsSync } from "node:fs";
2+
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
3+
import path from "node:path";
34
import { MakerDMG } from "@electron-forge/maker-dmg";
45
import { MakerZIP } from "@electron-forge/maker-zip";
56
import { VitePlugin } from "@electron-forge/plugin-vite";
67
import { PublisherGithub } from "@electron-forge/publisher-github";
78
import type { ForgeConfig } from "@electron-forge/shared-types";
89

10+
function copyNativeDependency(
11+
dependency: string,
12+
destinationRoot: string,
13+
): void {
14+
const source = path.resolve("node_modules", dependency);
15+
if (!existsSync(source)) {
16+
console.warn(
17+
`[forge] Native dependency "${dependency}" not found, skipping copy`,
18+
);
19+
return;
20+
}
21+
22+
const nodeModulesDir = path.join(destinationRoot, "node_modules");
23+
mkdirSync(nodeModulesDir, { recursive: true });
24+
25+
const destination = path.join(nodeModulesDir, dependency);
26+
rmSync(destination, { recursive: true, force: true });
27+
cpSync(source, destination, { recursive: true, dereference: true });
28+
console.log(
29+
`[forge] Copied native dependency "${dependency}" into ${path.relative(
30+
process.cwd(),
31+
destination,
32+
)}`,
33+
);
34+
}
35+
936
const config: ForgeConfig = {
1037
packagerConfig: {
1138
asar: {
@@ -15,6 +42,8 @@ const config: ForgeConfig = {
1542
name: "Array",
1643
executableName: "Array",
1744
icon: "./build/app-icon", // Forge adds .icns/.ico/.png based on platform
45+
appBundleId: "com.posthog.array",
46+
appCategoryType: "public.app-category.productivity",
1847
extraResource: existsSync("build/Assets.car") ? ["build/Assets.car"] : [],
1948
extendInfo: existsSync("build/Assets.car")
2049
? {
@@ -56,6 +85,9 @@ const config: ForgeConfig = {
5685
}
5786
}
5887
},
88+
packageAfterCopy: async (_forgeConfig, buildPath) => {
89+
copyNativeDependency("node-pty", buildPath);
90+
},
5991
},
6092
publishers: [
6193
new PublisherGithub({

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "array",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Array - PostHog desktop task manager",
55
"main": ".vite/build/index.js",
6+
"versionHash": "dynamic",
67
"engines": {
78
"node": ">=22.0.0",
89
"pnpm": ">=9.0.0"

src/main/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
55
import {
66
app,
77
BrowserWindow,
8+
ipcMain,
89
Menu,
910
type MenuItemConstructorOptions,
1011
shell,
@@ -181,6 +182,8 @@ app.on("activate", () => {
181182
// Background services
182183
registerAutoUpdater(() => mainWindow);
183184

185+
ipcMain.handle("app:get-version", () => app.getVersion());
186+
184187
// Register IPC handlers via services
185188
registerPosthogIpc();
186189
registerOsIpc(() => mainWindow);

src/main/preload.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
134134
ipcRenderer.on("open-settings", wrapped);
135135
return () => ipcRenderer.removeListener("open-settings", wrapped);
136136
},
137+
getAppVersion: (): Promise<string> => ipcRenderer.invoke("app:get-version"),
137138
onUpdateReady: (listener: () => void): (() => void) => {
138139
const channel = "updates:ready";
139140
const wrapped = () => listener();

src/renderer/components/StatusBar.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Kbd,
99
Tooltip,
1010
} from "@radix-ui/themes";
11+
import { useEffect, useState } from "react";
1112
import { useStatusBarStore } from "../stores/statusBarStore";
1213
import { StatusBarMenu } from "./StatusBarMenu";
1314

@@ -21,10 +22,32 @@ export function StatusBar({
2122
onOpenSettings,
2223
}: StatusBarProps) {
2324
const { statusText, keyHints } = useStatusBarStore();
25+
const [appVersion, setAppVersion] = useState<string | null>(null);
2426

2527
// Determine if we're in development mode
2628
const isDev = import.meta.env.DEV;
27-
const version = "0.1.0"; // You can get this from package.json or env vars
29+
const fallbackVersion = import.meta.env.VITE_APP_VERSION ?? "dev";
30+
31+
useEffect(() => {
32+
let cancelled = false;
33+
34+
window.electronAPI
35+
?.getAppVersion()
36+
.then((version) => {
37+
if (!cancelled) {
38+
setAppVersion(version);
39+
}
40+
})
41+
.catch((error) => {
42+
console.warn("[statusbar] Failed to load app version", error);
43+
});
44+
45+
return () => {
46+
cancelled = true;
47+
};
48+
}, []);
49+
50+
const version = appVersion ?? fallbackVersion;
2851

2952
return (
3053
<Box className="flex flex-row items-center justify-between border-gray-6 border-t bg-gray-2 px-4 py-2">

src/renderer/types/electron.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export interface IElectronAPI {
7878
}>,
7979
) => Promise<void>;
8080
onOpenSettings: (listener: () => void) => () => void;
81+
getAppVersion: () => Promise<string>;
8182
onUpdateReady: (listener: () => void) => () => void;
8283
installUpdate: () => Promise<{ installed: boolean }>;
8384
// Recording API

0 commit comments

Comments
 (0)