File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11appId : io.phcode.dev
2- productName : Phoenix Code
2+ productName : phoenix-code
33copyright : Copyright © 2024 phcode.dev
44
55asar : true
Original file line number Diff line number Diff line change 88 "description" : " Phoenix Code Experimental Build" ,
99 "main" : " main.js" ,
1010 "scripts" : {
11- "build:appimage" : " electron-builder --linux AppImage"
11+ "build:appimage" : " electron-builder --linux AppImage && node renameBin.js "
1212 },
1313 "dependencies" : {
1414 "keytar" : " ^7.9.0"
Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const path = require ( 'path' ) ;
3+
4+ // Read config-effective.json for productName and version
5+ const configPath = path . join ( __dirname , 'config-effective.json' ) ;
6+ const config = JSON . parse ( fs . readFileSync ( configPath , 'utf8' ) ) ;
7+
8+ const productName = config . productName ;
9+ const version = config . version ;
10+
11+ // Transform "Phoenix Code Experimental Build" → "phoenix-code-experimental-build"
12+ const artifactBaseName = productName . toLowerCase ( ) . replace ( / \s + / g, '-' ) ;
13+
14+ // Find the built AppImage in dist/ folder
15+ const distDir = path . join ( __dirname , 'dist' ) ;
16+ const files = fs . readdirSync ( distDir ) ;
17+ const appImageFile = files . find ( f => f . endsWith ( '.AppImage' ) ) ;
18+
19+ if ( ! appImageFile ) {
20+ console . error ( 'No AppImage found in dist/' ) ;
21+ process . exit ( 1 ) ;
22+ }
23+
24+ const oldPath = path . join ( distDir , appImageFile ) ;
25+ const newName = `${ artifactBaseName } _${ version } .AppImage` ;
26+ const newPath = path . join ( distDir , newName ) ;
27+
28+ console . log ( `Renaming: ${ appImageFile } → ${ newName } ` ) ;
29+ fs . renameSync ( oldPath , newPath ) ;
30+ console . log ( `Done: ${ newPath } ` ) ;
You can’t perform that action at this time.
0 commit comments