build: improve cordova-js version ID in built file #230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Currently the SHA of the commit pointed to by
HEAD
is included in the builtcordova.js
file to identify the version ofcordova-js
used to build it. If platforms depend oncordova-js
in the future (see #169 & #229), they will most likely depend on published packages. Consequently there will be nocordova-js
repo to get aforementioned information from.To make things worse, git will automatically use a repo in any parent dir. So if you have
cordova-android/
containing.git/
andnode_modules/cordova-js/
, the old implementation would use the HEAD ofcordova-android/.git/
to describecordova-js
.Thus, we now include the version from
package.json
instead in that case.Description
git describe
instead ofgit rev-parse HEAD
if in acordova-js
repocordova-js
repobuild-id
Testing
Manually tested both cases.