write version at build time

This commit is contained in:
Jeffrey Morgan 2023-07-07 11:41:53 -04:00 committed by Jeffrey Morgan
parent 962d351281
commit 7406881eeb

View file

@ -1,4 +1,4 @@
import type { ForgeConfig } from '@electron-forge/shared-types' import type { ForgeConfig, ResolvedForgeConfig, ForgeMakeResult } from '@electron-forge/shared-types'
import { MakerSquirrel } from '@electron-forge/maker-squirrel' import { MakerSquirrel } from '@electron-forge/maker-squirrel'
import { MakerZIP } from '@electron-forge/maker-zip' import { MakerZIP } from '@electron-forge/maker-zip'
import { PublisherGithub } from '@electron-forge/publisher-github' import { PublisherGithub } from '@electron-forge/publisher-github'
@ -49,6 +49,11 @@ const config: ForgeConfig = {
prerelease: true, prerelease: true,
}), }),
], ],
hooks: {
readPackageJson: async (_, packageJson) => {
return { ...packageJson, version: process.env.VERSION || packageJson.version }
},
},
plugins: [ plugins: [
new AutoUnpackNativesPlugin({}), new AutoUnpackNativesPlugin({}),
new WebpackPlugin({ new WebpackPlugin({