bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
320 stars 84 forks source link

Passing version with extraMetadata is not used in environments __BUILD_VERSION__ #224

Closed mtrefzer closed 11 months ago

mtrefzer commented 1 year ago

Describe the bug When I pass a version with --extraMetadata.version=x.y.z I expect that this version is used in environments __BUILD_VERSION__

To Reproduce Steps to reproduce the behavior:

  1. set the package.json version to 0.0.1
  2. run nx run <electron-app-name>:build --extraMetadata.version=0.0.2
  3. run nx run <electron-app-name>:make --extraMetadata.version=0.0.2
  4. :build uses the version of package.json while :make uses the passed extraMetadata.version, which leads to inconsistent autoupdates with electron-updater

Expected behavior nx run <electron-app-name>:build --extraMetadata.version=0.0.2 should use the passed value instead of the one from package.json

Desktop:

Additional context utils/config.ts l.86

new DefinePlugin({
        __BUILD_VERSION__: JSON.stringify(require(join(options.root, "package.json")).version),
        __BUILD_DATE__: Date.now()
      })
alkrobinson commented 1 year ago

@bennymeg any updates on this? Trying to setup a update server but this is blocking me.

bennymeg commented 1 year ago

Will be published in the next release.

alkrobinson commented 1 year ago

Any update on this or a workaround? Is it possible to write/update the version in the asar packaged package.json after make? We are really trying to setup an update server/show accurate versions in our application and this is a blocker.

bennymeg commented 1 year ago

I was extremely busy in past weeks, so I did not get the chance to publish a new release yet. As a workaround, you can open the package with 7zip, edit your file and zip it again with asar.

bennymeg commented 11 months ago

Released