@@ -210,7 +210,8 @@ const patchMonacoCssNestingWarnings = async (dashboardDir) => {
210210} ;
211211
212212const patchLegacyDesktopBridgeArtifacts = async ( dashboardDir ) => {
213- const patchFile = async ( filePath , transform , patchLabel ) => {
213+ const patchFile = async ( filePath , transform , patchLabel , options = { } ) => {
214+ const { warnOnNoChange = false } = options ;
214215 if ( ! existsSync ( filePath ) ) {
215216 return ;
216217 }
@@ -221,48 +222,55 @@ const patchLegacyDesktopBridgeArtifacts = async (dashboardDir) => {
221222 console . log (
222223 `[prepare-resources] Patched ${ patchLabel } in ${ path . relative ( projectRoot , filePath ) } ` ,
223224 ) ;
225+ } else if ( warnOnNoChange ) {
226+ console . warn (
227+ `[prepare-resources] WARN: No changes applied for ${ patchLabel } in ${ path . relative ( projectRoot , filePath ) } ` ,
228+ ) ;
224229 }
225230 } ;
226231
227232 await patchFile (
228233 path . join ( dashboardDir , 'src' , 'App.vue' ) ,
229234 ( source ) =>
230235 source . replace (
231- / i f \s * \( ! d e s k t o p B r i d g e \? \. \w + \ s* \| \| \s * ! d e s k t o p B r i d g e \. o n T r a y R e s t a r t B a c k e n d \) \s * \{ / ,
236+ / i f \s * \( \s * ! d e s k t o p B r i d g e \? \. i s E l e c t r o n \ s* \| \| \s * ! d e s k t o p B r i d g e \. o n T r a y R e s t a r t B a c k e n d \s * \) \s * \{ / ,
232237 'if (!desktopBridge?.onTrayRestartBackend) {' ,
233238 ) ,
234239 'tray restart desktop guard' ,
240+ { warnOnNoChange : true } ,
235241 ) ;
236242
237243 await patchFile (
238244 path . join ( dashboardDir , 'src' , 'types' , 'electron-bridge.d.ts' ) ,
239245 ( source ) => {
240246 let patched = source ;
241- patched = patched . replace ( / ^ \s + i s \w + : \s * b o o l e a n ; \n / m, ' isDesktop: boolean;\n' ) ;
247+ patched = patched . replace ( / ^ \s + i s E l e c t r o n : \s * b o o l e a n ; \n / m, ' isDesktop: boolean;\n' ) ;
242248 patched = patched . replace (
243- / ^ \s + i s \w + R u n t i m e : \s * \( \) \s * = > \s * P r o m i s e < b o o l e a n > ; \n / m,
249+ / ^ \s + i s E l e c t r o n R u n t i m e : \s * \( \) \s * = > \s * P r o m i s e < b o o l e a n > ; \n / m,
244250 ' isDesktopRuntime: () => Promise<boolean>;\n' ,
245251 ) ;
246252 return patched ;
247253 } ,
248254 'desktop bridge type definitions' ,
255+ { warnOnNoChange : true } ,
249256 ) ;
250257
251258 await patchFile (
252259 path . join ( dashboardDir , 'src' , 'layouts' , 'full' , 'vertical-header' , 'VerticalHeader.vue' ) ,
253260 ( source ) => {
254- let patched = source . replaceAll ( / \b i s \w + A p p \b / g, 'isDesktopReleaseMode' ) ;
261+ let patched = source . replaceAll ( / \b i s E l e c t r o n A p p \b / g, 'isDesktopReleaseMode' ) ;
255262 patched = patched . replace (
256- / t y p e o f w i n d o w ! = = ' u n d e f i n e d ' \s * & & \s * ! ! w i n d o w \. a s t r b o t D e s k t o p \? \. \w + / ,
263+ / t y p e o f w i n d o w ! = = ' u n d e f i n e d ' \s * & & \s * ! ! w i n d o w \. a s t r b o t D e s k t o p \? \. i s E l e c t r o n / ,
257264 'false' ,
258265 ) ;
259266 patched = patched . replace (
260- / i s D e s k t o p R e l e a s e M o d e \. v a l u e \s * = \s * ! ! w i n d o w \. a s t r b o t D e s k t o p \? \. \w + \ s* \| \| \s * \n \s * ! ! \( a w a i t w i n d o w \. a s t r b o t D e s k t o p \? \. \w + \? \. \( \) \) ; / ,
267+ / i s D e s k t o p R e l e a s e M o d e \. v a l u e \s * = \s * ! ! w i n d o w \. a s t r b o t D e s k t o p \? \. i s E l e c t r o n \ s* \| \| \s * \n \s * ! ! \( a w a i t w i n d o w \. a s t r b o t D e s k t o p \? \. i s E l e c t r o n R u n t i m e \? \. \( \) \) ; / ,
261268 'isDesktopReleaseMode.value = false;' ,
262269 ) ;
263270 return patched ;
264271 } ,
265272 'desktop update mode guards' ,
273+ { warnOnNoChange : true } ,
266274 ) ;
267275
268276 await patchFile (
@@ -272,7 +280,7 @@ const patchLegacyDesktopBridgeArtifacts = async (dashboardDir) => {
272280 return source ;
273281 }
274282 return source . replace (
275- / i f \s * \( d e s k t o p B r i d g e \? \. \w + \) \s * \{ / ,
283+ / i f \s * \( \s * d e s k t o p B r i d g e \? \. i s E l e c t r o n \s * \) \s * \{ / ,
276284 `const hasDesktopRestartCapability =
277285 !!desktopBridge &&
278286 typeof desktopBridge.restartBackend === 'function' &&
@@ -291,6 +299,7 @@ const patchLegacyDesktopBridgeArtifacts = async (dashboardDir) => {
291299 ) ;
292300 } ,
293301 'desktop restart capability guard' ,
302+ { warnOnNoChange : true } ,
294303 ) ;
295304} ;
296305
0 commit comments