Electron.NET icon indicating copy to clipboard operation
Electron.NET copied to clipboard

electronize doesn't add `version` or `description` to the package.json it uses in a build.

Open danatcofo opened this issue 4 years ago • 5 comments

Using the latest version (11.5.1)

This is causing a build error for linux targets with a message of Please specify 'version' in the package.json and also causes a warning with message of description is missed in the package.json

Steps to Reproduce:

  1. add a version and description to the package.json in the application
  2. execute electronize /target linux on a linux system (other steps may need to be done here to get linux building correctly)
  3. look at the package.json used during electronize call and notice its not there.

the file used during the electronize call is put in this general location ~/obj/desktop/-encodedCommand/package.json

danatcofo avatar Feb 18 '21 20:02 danatcofo

Since version 8.31.1 we have a feature to set the name and author of the app in electron.manifest.json.

Already tried?

GregorBiswanger avatar Feb 18 '21 20:02 GregorBiswanger

that is set just fine, its not the name and the author that is causing any issues, its version/description.

I noticed that name/author was in the output package.json already but didn't comment on it. Honestly I think something changed upstream of us that is now causing electronize to fail on a linux target where it did not before. It exposed something electronize should probably do but isn't.

this is the output of the electronize package.json

something that stand out here... version, description, repository all should be overridable. possibly license as well.

{
   "name":"prefix",
   "version":"",
   "description":"",
   "repository":{
      "url":"https://github.com/ElectronNET/Electron.NET"
   },
   "main":"main.js",
   "author":{
      "name":"Stackify",
      "email":"[email protected]"
   },
   "license":"MIT",
   "scripts":{
      "start":"tsc -p ."
   },
   "dependencies":{
      "dasherize":"^2.0.0",
      "electron-updater":"^4.3.5",
      "image-size":"^0.9.3",
      "portscanner":"^2.2.0",
      "socket.io":"^2.4.0"
   },
   "devDependencies":{
      "@types/node":"^10.17.20",
      "@types/socket.io":"^2.1.12",
      "electron":"^11.1.1",
      "tslint":"^6.1.3",
      "typescript":"^4.1.3"
   }
}

danatcofo avatar Feb 18 '21 20:02 danatcofo

It seems that name, author and version are only written to package.json and package-lock.json, if the "buildVersion" value is set: https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.Host/build-helper.js

electron.manifest.json:

{
  "name": "Example-App",
  "author": "The Author",
  ...
  "build": {
    "appId": "com.my.app",
    ...
    "buildVersion": "1.0.0",
    ...
  },
  ...
}

BenjaminVettori avatar Feb 25 '21 15:02 BenjaminVettori

I need to add build version like "1.0.0.9" but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"' But when i try "1.0.9" it's works fine

nakibulshaki avatar Aug 30 '22 09:08 nakibulshaki

I need to add build version like "1.0.0.9" but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"' But when i try "1.0.9" it's works fine

That error appears probably because the package.json version which is set by electron.net needs to be in semantic version format. You can find more about semantic versioning at semver and npmjs

BenjaminVettori avatar Sep 04 '22 23:09 BenjaminVettori

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

GregorBiswanger avatar Mar 28 '23 15:03 GregorBiswanger