Gets the application version for the Electron main process.

If the Electron app module is not available or fetching the version fails.

const version = await getAppVersionElectron();
export const getAppVersionElectron = async (): Promise<string> => {
try {
// Only import app in Electron main process
if (typeof window === "undefined") {
const electron = await import("electron");
return electron.app.getVersion();
}
// Fallback for renderer process
return getAppVersion();
} catch {
// Fallback if app is not available
return process.env.npm_package_version || "1.0.0";
}
};
  • Returns Promise<string>

    A promise that resolves to the current application version as a string.