electrobun 0.1.12 → 0.1.13-beta.1
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.
- package/README.md +1 -1
- package/dist/api/bun/core/Socket.ts +3 -0
- package/dist/api/bun/core/Updater.ts +41 -18
- package/package.json +3 -2
- package/src/cli/index.ts +22 -13
- package/templates/multitab-browser/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Ways to get involved at this early stage:
|
|
|
60
60
|
- cmake
|
|
61
61
|
- webkit2gtk and GTK development packages
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
On Ubuntu/Debian based distros: `sudo apt install build-essential cmake pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev`
|
|
64
64
|
|
|
65
65
|
### First-time Setup
|
|
66
66
|
|
|
@@ -206,15 +206,36 @@ const Updater = {
|
|
|
206
206
|
`from-${currentHash}.tar`
|
|
207
207
|
);
|
|
208
208
|
|
|
209
|
+
const bunBinDir = dirname(process.execPath);
|
|
210
|
+
const bspatchPath = join(bunBinDir, "bspatch");
|
|
211
|
+
|
|
209
212
|
// Note: cwd should be Contents/MacOS/ where the binaries are in the amc app bundle
|
|
210
213
|
try {
|
|
211
|
-
Bun.spawnSync([
|
|
212
|
-
|
|
214
|
+
const patchResult = Bun.spawnSync([
|
|
215
|
+
bspatchPath,
|
|
213
216
|
currentTarPath,
|
|
214
217
|
tmpPatchedTarFilePath,
|
|
215
218
|
patchFilePath,
|
|
216
219
|
]);
|
|
220
|
+
|
|
221
|
+
if (patchResult.exitCode !== 0 || patchResult.success === false) {
|
|
222
|
+
const stderr = new TextDecoder().decode(patchResult.stderr || new Uint8Array());
|
|
223
|
+
const stdout = new TextDecoder().decode(patchResult.stdout || new Uint8Array());
|
|
224
|
+
if (updateInfo) {
|
|
225
|
+
updateInfo.error = stderr || `bspatch failed with exit code ${patchResult.exitCode}`;
|
|
226
|
+
}
|
|
227
|
+
console.error(
|
|
228
|
+
"bspatch failed",
|
|
229
|
+
{
|
|
230
|
+
exitCode: patchResult.exitCode,
|
|
231
|
+
stdout,
|
|
232
|
+
stderr,
|
|
233
|
+
},
|
|
234
|
+
);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
217
237
|
} catch (error) {
|
|
238
|
+
console.error("bspatch threw", error);
|
|
218
239
|
break;
|
|
219
240
|
}
|
|
220
241
|
|
|
@@ -590,7 +611,15 @@ start "" launcher.exe
|
|
|
590
611
|
// Cross-platform app launch
|
|
591
612
|
switch (currentOS) {
|
|
592
613
|
case 'macos':
|
|
593
|
-
|
|
614
|
+
// Use a detached shell so relaunch survives after killApp terminates the current process
|
|
615
|
+
await Bun.spawn(
|
|
616
|
+
[
|
|
617
|
+
"sh",
|
|
618
|
+
"-c",
|
|
619
|
+
`open "${runningAppBundlePath}" &`,
|
|
620
|
+
],
|
|
621
|
+
{ detached: true }
|
|
622
|
+
);
|
|
594
623
|
break;
|
|
595
624
|
case 'win':
|
|
596
625
|
// On Windows, launch the run.bat file which handles versioning
|
|
@@ -606,22 +635,16 @@ start "" launcher.exe
|
|
|
606
635
|
Bun.spawn(["sh", "-c", `${linuxLauncher} &`], { detached: true});
|
|
607
636
|
break;
|
|
608
637
|
}
|
|
609
|
-
// Use native killApp to properly clean up all resources
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
native.symbols.killApp();
|
|
614
|
-
// Still call process.exit as a fallback
|
|
615
|
-
process.exit(0);
|
|
616
|
-
} catch (e) {
|
|
617
|
-
// Fallback if native binding fails
|
|
618
|
-
console.error('Failed to call native killApp:', e);
|
|
619
|
-
process.exit(0);
|
|
620
|
-
}
|
|
621
|
-
} else {
|
|
622
|
-
// macOS handles cleanup properly with process.exit
|
|
638
|
+
// Use native killApp to properly clean up all resources
|
|
639
|
+
try {
|
|
640
|
+
native.symbols.killApp();
|
|
641
|
+
// Still call process.exit as a fallback
|
|
623
642
|
process.exit(0);
|
|
624
|
-
}
|
|
643
|
+
} catch (e) {
|
|
644
|
+
// Fallback if native binding fails
|
|
645
|
+
console.error('Failed to call native killApp:', e);
|
|
646
|
+
process.exit(0);
|
|
647
|
+
}
|
|
625
648
|
}
|
|
626
649
|
}
|
|
627
650
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrobun",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13-beta.1",
|
|
4
4
|
"description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blackboard Technologies Inc.",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"push:minor": "npm version minor && git push origin main --tags",
|
|
49
49
|
"push:major": "npm version major && git push origin main --tags",
|
|
50
50
|
"build:push:artifacts": "bun scripts/build-and-upload-artifacts.js",
|
|
51
|
-
"test": "bun build:dev && bun build:cli && cd tests && npm install && bun build:dev && bun start"
|
|
51
|
+
"test": "bun build:dev && bun build:cli && cd tests && npm install && bun build:dev && bun start",
|
|
52
|
+
"test:bsdiff": "cd src/bsdiff && ../../vendors/zig/zig build test && echo \"bsdiff tests passed\""
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/archiver": "^6.0.3",
|
package/src/cli/index.ts
CHANGED
|
@@ -94,13 +94,18 @@ async function ensureCoreDependencies(targetOS?: 'macos' | 'win' | 'linux', targ
|
|
|
94
94
|
|
|
95
95
|
// Check platform-specific binaries
|
|
96
96
|
const requiredBinaries = [
|
|
97
|
-
platformPaths.BUN_BINARY
|
|
98
|
-
platformPaths.LAUNCHER_RELEASE,
|
|
99
|
-
// Platform-specific native wrapper
|
|
100
|
-
platformOS === 'macos' ? platformPaths.NATIVE_WRAPPER_MACOS :
|
|
101
|
-
platformOS === 'win' ? platformPaths.NATIVE_WRAPPER_WIN :
|
|
102
|
-
platformPaths.NATIVE_WRAPPER_LINUX
|
|
97
|
+
platformPaths.BUN_BINARY
|
|
103
98
|
];
|
|
99
|
+
if (platformOS === 'macos') {
|
|
100
|
+
requiredBinaries.push(
|
|
101
|
+
platformPaths.LAUNCHER_RELEASE,
|
|
102
|
+
platformPaths.NATIVE_WRAPPER_MACOS
|
|
103
|
+
);
|
|
104
|
+
} else if (platformOS === 'win') {
|
|
105
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_WIN);
|
|
106
|
+
} else {
|
|
107
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_LINUX);
|
|
108
|
+
}
|
|
104
109
|
|
|
105
110
|
// Check shared files (main.js should be in shared dist/)
|
|
106
111
|
const requiredSharedFiles = [
|
|
@@ -236,13 +241,17 @@ async function ensureCoreDependencies(targetOS?: 'macos' | 'win' | 'linux', targ
|
|
|
236
241
|
}
|
|
237
242
|
|
|
238
243
|
// Verify extraction completed successfully - check platform-specific binaries only
|
|
239
|
-
const requiredBinaries = [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
const requiredBinaries = [platformPaths.BUN_BINARY];
|
|
245
|
+
if (platformOS === 'macos') {
|
|
246
|
+
requiredBinaries.push(
|
|
247
|
+
platformPaths.LAUNCHER_RELEASE,
|
|
248
|
+
platformPaths.NATIVE_WRAPPER_MACOS
|
|
249
|
+
);
|
|
250
|
+
} else if (platformOS === 'win') {
|
|
251
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_WIN);
|
|
252
|
+
} else {
|
|
253
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_LINUX);
|
|
254
|
+
}
|
|
246
255
|
|
|
247
256
|
const missingBinaries = requiredBinaries.filter(file => !existsSync(file));
|
|
248
257
|
if (missingBinaries.length > 0) {
|