feat(launcher): bundle Bun and use it across all launchers (#243)

This commit is contained in:
2026-09-11 00:21:10 -07:00
committed by GitHub
parent fb2d1a512b
commit 016a43b804
61 changed files with 6814 additions and 294 deletions
+16 -2
View File
@@ -388,6 +388,7 @@ import {
detectCommandLineLauncher,
installBun as installCommandLineBun,
installLauncher as installCommandLineLauncher,
refreshManagedCommandLineLauncher,
} from './main/runtime/command-line-launcher';
import {
createWindowsMpvLaunchDeps,
@@ -1433,6 +1434,10 @@ const createCommandLineLauncherRuntimeOptions = () => ({
cwd: process.cwd(),
resourcesPath: process.resourcesPath,
appExePath: process.execPath,
appVersion: app.getVersion(),
bundledBunPath: app.isPackaged
? path.join(process.resourcesPath, 'bun', process.platform === 'win32' ? 'bun.exe' : 'bun')
: undefined,
});
const firstRunSetupService = createFirstRunSetupService({
platform: process.platform,
@@ -1518,7 +1523,7 @@ const firstRunSetupService = createFirstRunSetupService({
},
installCommandLineLauncher: async () => {
const snapshot = await installCommandLineLauncher(createCommandLineLauncherRuntimeOptions());
const ok = snapshot.status === 'ready' || snapshot.status === 'installed_bun_missing';
const ok = snapshot.status === 'ready' || snapshot.status === 'not_on_path';
return {
ok,
installPath: snapshot.installPath,
@@ -5291,7 +5296,7 @@ const { getChangelogSnapshot } = createChangelogRuntime({
logWarn: (message) => logger.warn(message),
});
const { getUpdateService } = createUpdateServiceRuntime({
const { getUpdateService, takePendingLauncherMigrationPath } = createUpdateServiceRuntime({
userDataPath: USER_DATA_PATH,
getUpdatesConfig: () => configService.getConfig().updates,
logInfo: (message) => logger.info(message),
@@ -6249,6 +6254,15 @@ const { runAndApplyStartupState } = composeHeadlessStartupHandlers<
runAndApplyStartupState();
void app.whenReady().then(() => {
void takePendingLauncherMigrationPath(async (pendingLauncherPath) => {
const acknowledgedPaths = await refreshManagedCommandLineLauncher({
...createCommandLineLauncherRuntimeOptions(),
additionalLauncherPaths: pendingLauncherPath ? [pendingLauncherPath] : [],
});
return pendingLauncherPath !== undefined && acknowledgedPaths.includes(pendingLauncherPath);
}).catch((error) => {
logger.warn('Failed to refresh the installed command-line launcher', error);
});
if (!shouldStartAutomaticUpdateChecks(appState.initialArgs)) {
return;
}