Specify electron version to use
zoltan-mihalyi opened this issue · 2 comments
Feature Request
Motivation Behind Feature
It would be possible to use the latest electron features and fixes.
Feature Description
build.json:
{
"electron": {
"electronVersion": "11.1.1"
}
}
Alternatives or Workarounds
I am experimenting with changing version in electron/package.json, removing electron/dist folder and runnning electron/install.js
This request has been mentioned a few times but it is a bit challenging.
There are two places where the version is defined.
- The
package.json
of the platform. This dependency is used for thecordova run
command. Currently, the pinning contains^
which accepts new minor and patches. This^
is problematic and should be hard pin to follow the second location. The reason it is problematic is that the run command may eventually fail with no changes to the user's project. - The
build.json
is hard pinned. This is used for building the packages. Because it is hard pinned, it is consistent and should not fail unexpectedly if there is no change to the project. This is used in thecordova build
command.
If we allow the users to specify a version, we can not guarantee that the project will build or run successfully. Nor can we provide speedy support for versions that were not tested or approved.
Should something be implemented, which I am not against, I would rather refer to it as an experimental feature.
Any issues reported by using a version that is not been tested and approved might get closed or thrown in a backlog.
I had taken a look at solutions before, for example, using a post-install script but the post-install script was not being executed as expected. The idea is that the script would install either the default version or targeted version that would have been defined maybe in an environment variable, project's package.json
or config.xml
.
Shortly, I will be changing the pinning in package.json
to be hard pinned to resolve the current issue where the cordova run
outcome might not match with cordova build
.
Whatever solution you had in mind will need to support both run and build and potentially resolving the builder dependency to match with the electron version. I think sometimes changes in Electron might require changes with the builder dependency. They might go hand in hand.
All in all, I think the default pinned version is supported and anything else could not be guaranteed.
I think the config.xml
is the right place:
<platform name="electron">
<preference name="ElectronVersion" value="11.2.0" />
</platform>
Maybe the preference name should be "ExperimentalElectronVersion".
Using this version in build
seems an easy task to me, but it is difficult in run
, because we should install electron with the given version.
Installing electron would happen in prepare
. I can see two solutions:
- install
electron
with npm somewhere in platform folder - use
@electron/get
directly, and implement code similar toelectron/install.js
(version check, download, extract, determine executeble path)
What do you think?