Reputation: 3684
It is very annoying to change build version of my React Native (not Expo) application every time I build it.
It needs to be changed in at leats 4 places at moment:
Is there any way to automatize this? For example every place gets updates when package.json version changes?
Upvotes: 1
Views: 179
Reputation: 81
For android you could have in /android/build.gradle
a function:
import groovy.json.JsonSlurper
def getNPMVersion() {
def file = new File("$rootDir/../package.json")
def packageJson = new JsonSlurper().parseText(file.text)
return packageJson["version"]
}
and then in your /android/app/build.gradle
you'd use versionName getNPMVersion()
For ios I'm pretty sure you'll need a script that overrides the Info.plist
Upvotes: 2