@@ -81,19 +81,36 @@ const config: ForgeConfig = {
8181
8282 console . log ( '[postPackage] Re-signing helper apps with correct entitlements for MAS...' ) ;
8383
84- const appPath = options . outputPaths [ 0 ] ;
85- const frameworksPath = path . join ( appPath , 'Contents' , 'Frameworks' ) ;
84+ const outputDir = options . outputPaths [ 0 ] ;
8685 const identity = process . env . SIGNING_IDENTITY_APPSTORE || 'Apple Distribution' ;
8786 const childEntitlements = path . resolve ( 'entitlements.child.plist' ) ;
87+ const mainEntitlements = path . resolve ( 'entitlements.mas.plist' ) ;
88+
89+ // Find the .app bundle inside the output directory
90+ const items = fs . readdirSync ( outputDir ) ;
91+ const appBundle = items . find ( item => item . endsWith ( '.app' ) ) ;
92+
93+ if ( ! appBundle ) {
94+ console . log ( '[postPackage] No .app bundle found in output directory, skipping' ) ;
95+ return ;
96+ }
97+
98+ const appPath = path . join ( outputDir , appBundle ) ;
99+ const frameworksPath = path . join ( appPath , 'Contents' , 'Frameworks' ) ;
100+
101+ console . log ( `[postPackage] App bundle: ${ appPath } ` ) ;
102+ console . log ( `[postPackage] Frameworks path: ${ frameworksPath } ` ) ;
88103
89104 if ( ! fs . existsSync ( frameworksPath ) ) {
90105 console . log ( '[postPackage] No Frameworks directory found, skipping helper re-signing' ) ;
91106 return ;
92107 }
93108
94109 // Find all helper apps
95- const items = fs . readdirSync ( frameworksPath ) ;
96- const helperApps = items . filter ( item => item . endsWith ( '.app' ) ) ;
110+ const frameworkItems = fs . readdirSync ( frameworksPath ) ;
111+ const helperApps = frameworkItems . filter ( item => item . endsWith ( '.app' ) ) ;
112+
113+ console . log ( `[postPackage] Found ${ helperApps . length } helper apps to re-sign` ) ;
97114
98115 for ( const helperApp of helperApps ) {
99116 const helperPath = path . join ( frameworksPath , helperApp ) ;
@@ -114,7 +131,6 @@ const config: ForgeConfig = {
114131
115132 // Re-sign the main app to update the seal after helper modifications
116133 console . log ( '[postPackage] Re-signing main app to update seal...' ) ;
117- const mainEntitlements = path . resolve ( 'entitlements.mas.plist' ) ;
118134 try {
119135 execSync (
120136 `codesign --force --sign "${ identity } " --entitlements "${ mainEntitlements } " --timestamp=none "${ appPath } "` ,
0 commit comments