electrobun 0.1.12 → 0.1.13-beta.2
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 +46 -20
- 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.2",
|
|
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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
symlinkSync,
|
|
14
14
|
statSync,
|
|
15
15
|
copyFileSync,
|
|
16
|
+
renameSync,
|
|
16
17
|
} from "fs";
|
|
17
18
|
import { execSync } from "child_process";
|
|
18
19
|
import * as readline from "readline";
|
|
@@ -94,13 +95,18 @@ async function ensureCoreDependencies(targetOS?: 'macos' | 'win' | 'linux', targ
|
|
|
94
95
|
|
|
95
96
|
// Check platform-specific binaries
|
|
96
97
|
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
|
|
98
|
+
platformPaths.BUN_BINARY
|
|
103
99
|
];
|
|
100
|
+
if (platformOS === 'macos') {
|
|
101
|
+
requiredBinaries.push(
|
|
102
|
+
platformPaths.LAUNCHER_RELEASE,
|
|
103
|
+
platformPaths.NATIVE_WRAPPER_MACOS
|
|
104
|
+
);
|
|
105
|
+
} else if (platformOS === 'win') {
|
|
106
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_WIN);
|
|
107
|
+
} else {
|
|
108
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_LINUX);
|
|
109
|
+
}
|
|
104
110
|
|
|
105
111
|
// Check shared files (main.js should be in shared dist/)
|
|
106
112
|
const requiredSharedFiles = [
|
|
@@ -236,13 +242,17 @@ async function ensureCoreDependencies(targetOS?: 'macos' | 'win' | 'linux', targ
|
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
// Verify extraction completed successfully - check platform-specific binaries only
|
|
239
|
-
const requiredBinaries = [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
const requiredBinaries = [platformPaths.BUN_BINARY];
|
|
246
|
+
if (platformOS === 'macos') {
|
|
247
|
+
requiredBinaries.push(
|
|
248
|
+
platformPaths.LAUNCHER_RELEASE,
|
|
249
|
+
platformPaths.NATIVE_WRAPPER_MACOS
|
|
250
|
+
);
|
|
251
|
+
} else if (platformOS === 'win') {
|
|
252
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_WIN);
|
|
253
|
+
} else {
|
|
254
|
+
requiredBinaries.push(platformPaths.NATIVE_WRAPPER_LINUX);
|
|
255
|
+
}
|
|
246
256
|
|
|
247
257
|
const missingBinaries = requiredBinaries.filter(file => !existsSync(file));
|
|
248
258
|
if (missingBinaries.length > 0) {
|
|
@@ -1743,25 +1753,41 @@ if (commandArg === "init") {
|
|
|
1743
1753
|
// DMG creation for macOS only
|
|
1744
1754
|
if (targetOS === 'macos') {
|
|
1745
1755
|
console.log("creating dmg...");
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1756
|
+
const finalDmgPath = join(buildFolder, `${appFileName}.dmg`);
|
|
1757
|
+
// NOTE: For some ungodly reason using the bare name in CI can conflict with some mysterious
|
|
1758
|
+
// already mounted volume. I suspect the sanitized appFileName can match your github repo
|
|
1759
|
+
// or some other tool is mounting something somewhere. Either way, as a workaround
|
|
1760
|
+
// while creating the dmg for a stable build we temporarily give it a -stable suffix
|
|
1761
|
+
// to match the behaviour of -canary builds.
|
|
1762
|
+
const dmgCreationPath =
|
|
1763
|
+
buildEnvironment === "stable"
|
|
1764
|
+
? join(buildFolder, `${appFileName}-stable.dmg`)
|
|
1765
|
+
: finalDmgPath;
|
|
1766
|
+
const baseVolumeName = sanitizeVolumeNameForHdiutil(appFileName);
|
|
1767
|
+
const dmgVolumeName =
|
|
1768
|
+
buildEnvironment === "stable"
|
|
1769
|
+
? `${baseVolumeName}-stable`
|
|
1770
|
+
: baseVolumeName;
|
|
1749
1771
|
// hdiutil create -volname "YourAppName" -srcfolder /path/to/YourApp.app -ov -format UDZO YourAppName.dmg
|
|
1750
1772
|
// Note: use ULFO (lzfse) for better compatibility with large CEF frameworks and modern macOS
|
|
1751
1773
|
execSync(
|
|
1752
|
-
`hdiutil create -volname "${
|
|
1774
|
+
`hdiutil create -volname "${dmgVolumeName}" -srcfolder ${escapePathForTerminal(
|
|
1753
1775
|
selfExtractingBundle.appBundleFolderPath
|
|
1754
|
-
)} -ov -format ULFO ${escapePathForTerminal(
|
|
1776
|
+
)} -ov -format ULFO ${escapePathForTerminal(dmgCreationPath)}`
|
|
1755
1777
|
);
|
|
1778
|
+
if (buildEnvironment === "stable" && dmgCreationPath !== finalDmgPath) {
|
|
1779
|
+
renameSync(dmgCreationPath, finalDmgPath);
|
|
1780
|
+
}
|
|
1781
|
+
artifactsToUpload.push(finalDmgPath);
|
|
1756
1782
|
|
|
1757
1783
|
if (shouldCodesign) {
|
|
1758
|
-
codesignAppBundle(
|
|
1784
|
+
codesignAppBundle(finalDmgPath);
|
|
1759
1785
|
} else {
|
|
1760
1786
|
console.log("skipping codesign");
|
|
1761
1787
|
}
|
|
1762
1788
|
|
|
1763
1789
|
if (shouldNotarize) {
|
|
1764
|
-
notarizeAndStaple(
|
|
1790
|
+
notarizeAndStaple(finalDmgPath);
|
|
1765
1791
|
} else {
|
|
1766
1792
|
console.log("skipping notarization");
|
|
1767
1793
|
}
|