cordova
cordova copied to clipboard
Smarter way to set Cordova platform version number
I find it really unfortunate that we have to use tooling to set Cordova platform versions in multiple places such as package.json, generated cordova.js, VERSION file, Android Gradle file, etc.
I think it should be relatively straightforward to update the Cordova tooling so that we can mark the version in package.json and the scripts would generate the platform files with the correct version where it is needed whenever the user does cordova platform add
.
And I suspect that in Gradle we should be able to define a constant or variable with the version in one place and reference it in the other places.
What does "mark a version" mean exactly? Set the version numbers? Isn't there already a command that does all the replacing in coho?
Set the version numbers?
Yes, just edited title & description to reflect the answer
Isn't there already a command that does all the replacing in coho?
Yes and I do not find it 100% satisfactory for the following reasons:
- It updates cordova.js by regenerating it from the master branch of cordova-js. I would like to have better control over when it updates the behavior of cordova.js. For example, the master branch of cordova-js has changes to remove browserify, with version 5.0.0-dev, which I think is not wanted in a patch release. I have my own fork, with changes in https://github.com/apache/cordova-coho/pull/188 (WIP PR) that I can use to generate from a specific cordova-js version but find this whole step to be a bit clumsy and non-intuitive.
- cordova-coho seems to make the updates in multiple commits. While it would be straightforward for a developer to squash the commits I find this to be clumsy as well.
My idea is that we can set the desired version number in one place, and the scripts would generate the platform files with the right version numbers whenver the user does cordova platform add
. I think this should be very straightforward with help from existing npm packages. I can raise a PR to demonstrate this idea if desired.
... generate the platform files with the right version numbers whenver the user does cordova platform add
Cordova platforms historically should also work as packaged downloads without using the CLI, so I think this is not really an option.
Looking at why we need those versions in so many places seems like a valid thing to do though.