build: Added 7zip to work with appimage

This commit is contained in:
Simeon Radivoev 2026-03-30 21:01:23 +03:00
parent b4e9112989
commit 58d3c31c56
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
2 changed files with 6 additions and 7 deletions

View file

@ -4,17 +4,12 @@ import fs from 'node:fs/promises';
import { appBuilderPath, } from 'app-builder-bin'; import { appBuilderPath, } from 'app-builder-bin';
import path from 'node:path'; import path from 'node:path';
import { ensureDir } from "fs-extra"; import { ensureDir } from "fs-extra";
import { rmdir } from "node:fs";
// ─────────────────────────────────────────────
// CONFIGURE THESE FOR YOUR APP
// ─────────────────────────────────────────────
const APP_DIR = process.env.BUILD_DIR ?? `./build/${process.platform}`; const APP_DIR = process.env.BUILD_DIR ?? `./build/${process.platform}`;
const BINARY_NAME = pkg.bin; const BINARY_NAME = pkg.bin;
const ICON = "./src/mainview/public/256x256.png"; const ICON = "./src/mainview/public/256x256.png";
const DESKTOP = "./flatpak/com.simeonradivoev.gameflow-deck.desktop"; const DESKTOP = "./flatpak/com.simeonradivoev.gameflow-deck.desktop";
const TMP_FOLDER = "."; const TMP_FOLDER = ".";
// ─────────────────────────────────────────────
const APP_NAME = pkg.displayName ?? pkg.name; const APP_NAME = pkg.displayName ?? pkg.name;
const APP_ID = pkg.name; const APP_ID = pkg.name;
@ -30,6 +25,7 @@ await ensureDir("build");
await fs.cp(`${APP_DIR}/.`, path.join(APPDIR, `usr`, 'share'), { recursive: true }); await fs.cp(`${APP_DIR}/.`, path.join(APPDIR, `usr`, 'share'), { recursive: true });
await fs.rename(path.join(APPDIR, `usr`, 'share', BINARY_NAME), path.join(APPDIR, `usr`, 'bin', BINARY_NAME)); await fs.rename(path.join(APPDIR, `usr`, 'share', BINARY_NAME), path.join(APPDIR, `usr`, 'bin', BINARY_NAME));
await fs.rename(path.join(APPDIR, `usr`, 'share', `libwebview-${process.arch}.so`), path.join(APPDIR, `usr`, 'lib', `libwebview-${process.arch}.so`)); await fs.rename(path.join(APPDIR, `usr`, 'share', `libwebview-${process.arch}.so`), path.join(APPDIR, `usr`, 'lib', `libwebview-${process.arch}.so`));
await fs.rename(path.join(APPDIR, `usr`, 'share', `7za`), path.join(APPDIR, `usr`, 'bin', `7za`));
await fs.writeFile(path.join(APPDIR, `${APP_ID}.desktop`), `[Desktop Entry] await fs.writeFile(path.join(APPDIR, `${APP_ID}.desktop`), `[Desktop Entry]
Version=${pkg.version} Version=${pkg.version}
@ -94,4 +90,4 @@ await fs.rm(APPDIR, { recursive: true, force: true });
await fs.rm(STAGE, { recursive: true, force: true }); await fs.rm(STAGE, { recursive: true, force: true });
if (code !== 0) process.exit(code); if (code !== 0) process.exit(code);
console.log(`\n Done!`); console.log(`\n Done!`);

View file

@ -26,8 +26,8 @@ if (process.env.TARGET)
compileOption.target = process.env.TARGET as any; compileOption.target = process.env.TARGET as any;
} }
let zip: string | undefined; let zip: string | undefined;
let zipPath: string = '';
let zipNodePath: string | undefined; let zipNodePath: string | undefined;
let webviewLib: string | undefined; let webviewLib: string | undefined;
switch (process.platform) switch (process.platform)
@ -53,7 +53,10 @@ if (!webviewLib) throw new Error("Could not find webviewlib");
let webviewLibPath = '.'; let webviewLibPath = '.';
if (process.env.APPIMAGE === "true") if (process.env.APPIMAGE === "true")
{
webviewLibPath = `./usr/lib`; webviewLibPath = `./usr/lib`;
zipPath = './usr/bin';
}
await Bun.build({ await Bun.build({
entrypoints: ["./src/bun/index.ts", `./src/bun/webview/${system.platform}.ts`], entrypoints: ["./src/bun/index.ts", `./src/bun/webview/${system.platform}.ts`],