11import { execSync } from 'child_process' ;
22import { fileURLToPath } from 'url' ;
33import { dirname , join } from 'path' ;
4- import { copyFileSync } from 'fs' ;
4+ import { copyFileSync , readFileSync , writeFileSync } from 'fs' ;
55
66const __filename = fileURLToPath ( import . meta. url ) ;
77const __dirname = dirname ( __filename ) ;
@@ -19,4 +19,11 @@ const configSrc = join(electronDir, 'config.json');
1919const configDest = join ( electronDir , 'config-effective.json' ) ;
2020console . log ( 'Copying config.json to config-effective.json...' ) ;
2121copyFileSync ( configSrc , configDest ) ;
22- console . log ( 'Config file copied successfully!' ) ;
22+
23+ // Inject version from package.json
24+ const packageJsonPath = join ( electronDir , 'package.json' ) ;
25+ const packageJson = JSON . parse ( readFileSync ( packageJsonPath , 'utf8' ) ) ;
26+ const effectiveConfig = JSON . parse ( readFileSync ( configDest , 'utf8' ) ) ;
27+ effectiveConfig . version = packageJson . version ;
28+ writeFileSync ( configDest , JSON . stringify ( effectiveConfig , null , 2 ) ) ;
29+ console . log ( 'Config file copied and version injected successfully!' ) ;
0 commit comments