electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.72k stars 1.74k forks source link

electron builder Please specify 'version' in the package.json #8381

Open skident opened 4 months ago

skident commented 4 months ago

I want to manage the application version from the outside using an environment variable. Everything works fine except I cannot build the dist of my app after I remove the version from the package.json file. The error is next: electron builder Please specify 'version' in the package.json

Is there a way to pass an app version from outside because this error looks very odd.

gilvrey commented 4 months ago

You can use extraMetadata to inject properties to package.json

Example:

extraMetadata: {
    version: process.env.APP_VERSION
}
github-actions[bot] commented 2 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

skident commented 1 month ago

I ended up by writing a JS script which injects the actual version in my package.json file when it's needed and then restores it back to kind of 1.0.0 version. Not very convenient but it solves my problem