Hi,
I am working on one of the electron app which will be installed into the user's window machine using appstore.
The App version is mentioned into the package.json.
I thought using below code it will work in the release mode.
package.json :
{
"name": "My-electron-uwp",
"version": "1.0.0",
"description": "My Windows Mobile",
"main": "./src/main.js",
"scripts": {
},
"repository": "",
"keywords": [
"TestApp",
"Electron",
"UWP",
"Windows Mobile"
],
"author": "xxxxxx",
"devDependencies": {
"archiver": "^3.0.0",
"cross-env": "^5.2.0",
"electron": "^5.0.0",
"electron-packager": "^12.2.0",
"electron-windows-store": "^2.1.0",
"mocha": "^6.0.2",
"mocha-junit-reporter": "^1.23.0",
"mocha-steps": "^1.3.0",
"mustache": "^3.0.1",
"p-iteration": "^1.1.8",
"shelljs": "^0.8.3",
"spectron": "file:3p/spectron-7.0.0.tgz",
"uuid": "^3.3.2",
"read-package-json": "^2.0.13"
},
"dependencies": {
"@sentry/electron": "^0.14.0",
"electron-window-state": "^5.0.3"
},
"windowsStorePackage": {
"beta": {
],
"win32metadata": {
"CompanyName": ""
},
"identityName": "xxxxxxxxxx",
"identityPublisher": "",
"displayName": "TestApp",
"displayShortName": "TestApp",
"publisherDisplayName": "",
"packageDescription": "",
"executable": "TestApp.exe",
"tileShortName": "test"
},
"production": {
"name": "MyApp",
"version": "5.2.0.0",
"appDirectory": "../",
"appCopyright": "",
"icon": "",
"platform": "win32",
"arch": "x64",
"overwrite": "true",
"ignore": [
],
"win32metadata": {
"CompanyName": ""
}
}
}
}
I want to read windowsStorePackage.production.version at the run time
I tried something like below to read in the main process.
var readJson = require('read-package-json')
ipcMain.on('Electron-App-Version', (event) => {
readJson('../electron/package.json', console.error, false, function (err, data) {
if (err) {
console.error("There was an error reading the file")
return
}
event.returnValue = data.windowsStorePackage.production.version;
});
})
it works well in debug mode. but in the release mode its not able to find the package.json
How can i get rid of this ?
please guide me !!!