diff --git a/package-lock.json b/package-lock.json index 0d1120c..9592748 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mrterm", - "version": "0.18.0", + "version": "0.18.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mrterm", - "version": "0.18.0", + "version": "0.18.1", "license": "MIT", "dependencies": { "@xterm/addon-fit": "^0.11.0", diff --git a/package.json b/package.json index c3563b4..b3e4c4e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mrterm", "productName": "MrTerm", - "version": "0.18.0", + "version": "0.18.1", "description": "Moderner SSH-, SFTP- und RDP-Client", "main": "src/main/main.js", "author": "MrBlake", @@ -53,6 +53,7 @@ "directories": { "buildResources": "build" }, + "beforePack": "scripts/ensure-koffi.js", "asarUnpack": [ "node_modules/koffi/**", "node_modules/@koromix/**" diff --git a/scripts/ensure-koffi.js b/scripts/ensure-koffi.js new file mode 100644 index 0000000..0f7a83b --- /dev/null +++ b/scripts/ensure-koffi.js @@ -0,0 +1,19 @@ +// electron-builder beforePack: stellt sicher, dass die native koffi-Binary der Zielplattform in node_modules liegt. +// npm installiert nur die Binary der Build-Plattform – beim Cross-Build (z. B. Windows-Paket auf Linux) fehlt sie sonst, +// und RDP im Tab fällt mit "koffi nicht verfügbar" auf ein externes Fenster zurück. +const fs = require('fs'); +const path = require('path'); +const { execSync } = require('child_process'); +const { Arch } = require('electron-builder'); + +module.exports = async (context) => { + const platform = context.electronPlatformName; + const arch = Arch[context.arch]; + const pkg = `@koromix/koffi-${platform}-${arch}`; + const root = path.join(__dirname, '..'); + if (fs.existsSync(path.join(root, 'node_modules', pkg))) return; + const { version } = require(path.join(root, 'node_modules', 'koffi', 'package.json')); + console.log(` • koffi-Binary für ${platform}-${arch} fehlt – installiere ${pkg}@${version}`); + execSync(`npm install --no-save --force ${pkg}@${version}`, { cwd: root, stdio: 'inherit' }); + if (!fs.existsSync(path.join(root, 'node_modules', pkg))) throw new Error(`${pkg} konnte nicht installiert werden`); +};