Skip to content

Commit 52bc58d

Browse files
committed
match appimage bin naming with existing convention
1 parent 0ea5776 commit 52bc58d

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

src-electron/electron-builder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
appId: io.phcode.dev
2-
productName: Phoenix Code
2+
productName: phoenix-code
33
copyright: Copyright © 2024 phcode.dev
44

55
asar: true

src-electron/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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"

src-electron/renameBin.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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}`);

0 commit comments

Comments
 (0)