Refactor app version handling in appupdate.js and rpc.js
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Updated `getRunningAppVersion` to retrieve the version from `package.json`, ensuring accurate version representation. - Modified `getAppVersion` in `rpc.js` to utilize the refactored `getRunningAppVersion`, improving consistency in version reporting.
This commit is contained in:
parent
578caaffc2
commit
f52f0e35a9
@ -10,6 +10,7 @@ import { launchWindowsInstaller } from './winappupdate.js'
|
||||
import { checkForDuplicateInstallations } from './check-duplicate-installations.js'
|
||||
import { scheduleAppRestart } from './updater-runner.js'
|
||||
import buildInfo from '../buildInfo.json'
|
||||
import { version as packageVersion } from '../../package.json'
|
||||
import { getAppSettings, setAppSettings } from './store.js'
|
||||
|
||||
const SUPPORTED_TARGETS = {
|
||||
@ -232,11 +233,8 @@ const formatFullAppVersion = (version, buildNumber) => {
|
||||
return `v${normalizedVersion}-${buildSuffix}`
|
||||
}
|
||||
|
||||
const getRunningAppVersion = () =>
|
||||
formatFullAppVersion(
|
||||
process.env.ELECTROBUN_VERSION,
|
||||
buildInfo?.buildNumber
|
||||
)
|
||||
export const getRunningAppVersion = () =>
|
||||
formatFullAppVersion(packageVersion, buildInfo?.buildNumber)
|
||||
|
||||
const getRunningAppState = (mainWindow, settings) => ({
|
||||
version: getRunningAppVersion(),
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
import { BrowserView } from 'electrobun/bun'
|
||||
import { checkForCompletedUpdate, startAppUpdate } from './appupdate.js'
|
||||
import {
|
||||
checkForCompletedUpdate,
|
||||
getRunningAppVersion,
|
||||
startAppUpdate
|
||||
} from './appupdate.js'
|
||||
import {
|
||||
checkForDuplicateInstallations,
|
||||
removeDuplicateInstallations
|
||||
@ -89,7 +93,7 @@ export function createAppRpc() {
|
||||
})
|
||||
return { ok: true }
|
||||
},
|
||||
getAppVersion: async () => process.env.ELECTROBUN_VERSION || 'desktop',
|
||||
getAppVersion: async () => getRunningAppVersion() || 'desktop',
|
||||
getAppEngine: async () => {
|
||||
const mainWindow = getMainWindow()
|
||||
const renderer = mainWindow?.renderer || 'native'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user