mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-30 17:40:53 -07:00
feat(launcher): bundle Bun and use it across all launchers (#243)
This commit is contained in:
+16
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user