electrobun 0.0.19-beta.91 → 0.0.19-beta.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,50 @@ import { native } from '../proc/native';
13
13
  // native.symbols.killApp();
14
14
  // }, 1000)
15
15
 
16
+ // Create or update run.sh launcher script for Linux
17
+ async function createLinuxLauncherScript(appDir: string): Promise<void> {
18
+ const parentDir = dirname(appDir);
19
+ const launcherPath = join(parentDir, "run.sh");
20
+
21
+ const launcherContent = `#!/bin/bash
22
+ # Electrobun App Launcher
23
+ # This script sets up the environment and launches the app
24
+
25
+ # Get the directory where this script is located
26
+ SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
27
+ APP_DIR="$SCRIPT_DIR/app"
28
+
29
+ cd "$APP_DIR/bin"
30
+ export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
31
+
32
+ # Force X11 backend for compatibility
33
+ export GDK_BACKEND=x11
34
+
35
+ # Check if CEF libraries exist and set LD_PRELOAD
36
+ if [ -f "./libcef.so" ] || [ -f "./libvk_swiftshader.so" ]; then
37
+ CEF_LIBS=""
38
+ [ -f "./libcef.so" ] && CEF_LIBS="./libcef.so"
39
+ if [ -f "./libvk_swiftshader.so" ]; then
40
+ if [ -n "$CEF_LIBS" ]; then
41
+ CEF_LIBS="$CEF_LIBS:./libvk_swiftshader.so"
42
+ else
43
+ CEF_LIBS="./libvk_swiftshader.so"
44
+ fi
45
+ fi
46
+ export LD_PRELOAD="$CEF_LIBS"
47
+ fi
48
+
49
+ exec ./launcher "$@"
50
+ `;
51
+
52
+ await Bun.write(launcherPath, launcherContent);
53
+
54
+ // Make it executable
55
+ execSync(`chmod +x "${launcherPath}"`);
56
+
57
+ console.log(`Created/updated Linux launcher script: ${launcherPath}`);
58
+ }
59
+
16
60
  // Cross-platform app data directory
17
61
  function getAppDataDir(): string {
18
62
  switch (currentOS) {
@@ -473,6 +517,9 @@ const Updater = {
473
517
 
474
518
  // Move new app to app location
475
519
  renameSync(newAppBundlePath, runningAppBundlePath);
520
+
521
+ // Recreate run.sh launcher script
522
+ await createLinuxLauncherScript(runningAppBundlePath);
476
523
  } else {
477
524
  // On Windows, use versioned app folders
478
525
  const parentDir = dirname(runningAppBundlePath);
@@ -558,18 +605,20 @@ start "" launcher.exe
558
605
  Bun.spawn(["sh", "-c", `${linuxLauncher} &`], { detached: true});
559
606
  break;
560
607
  }
561
- // Use native killApp to properly clean up all resources on Linux
562
- // On other platforms, process.exit works fine
563
- if (currentOS === 'linux') {
608
+ // Use native killApp to properly clean up all resources on Windows/Linux
609
+ // macOS handles process.exit correctly
610
+ if (currentOS === 'linux' || currentOS === 'win') {
564
611
  try {
565
-
566
612
  native.symbols.killApp();
613
+ // Still call process.exit as a fallback
567
614
  process.exit(0);
568
615
  } catch (e) {
569
616
  // Fallback if native binding fails
617
+ console.error('Failed to call native killApp:', e);
570
618
  process.exit(0);
571
619
  }
572
620
  } else {
621
+ // macOS handles cleanup properly with process.exit
573
622
  process.exit(0);
574
623
  }
575
624
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.19-beta.91",
3
+ "version": "0.0.19-beta.94",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",