How can I supply my own version while building electron

581 Views Asked by At

Is there any way I can supply a dynamic version no during the build of electron client.I am currently using electron builder for the same .My build script looks like below.

    "dist": "electron-builder",

I came across a post where it seems it was possible but not sure how to use it .He has mentioned something like below

"scripts": {
     "dist": "build --em.mode=prod --em.version=yourversion" 
}

Any clue on this would be helpful .

1

There are 1 best solutions below

0
On

The "version" key of package.json can be used for this purpose. Then the value can be accessed like this:

const { remote } = require("electron");

const applicationVersion = remote.app.getVersion();