11import { 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" ;
34import { MakerDMG } from "@electron-forge/maker-dmg" ;
45import { MakerZIP } from "@electron-forge/maker-zip" ;
56import { VitePlugin } from "@electron-forge/plugin-vite" ;
67import { PublisherGithub } from "@electron-forge/publisher-github" ;
78import 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+
936const 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 ( {
0 commit comments