Skip to content

Instantly share code, notes, and snippets.

@hypest
Created November 27, 2018 12:23
Show Gist options
  • Save hypest/742448b9588b3a0aa580a5e80ae95bdf to your computer and use it in GitHub Desktop.
Save hypest/742448b9588b3a0aa580a5e80ae95bdf to your computer and use it in GitHub Desktop.
Gradle util to extract react-native version from package.json
import groovy.json.JsonSlurper
def readReactNativeVersion(packagejson, section) {
def packageSlurper = new JsonSlurper()
def packageJson = packageSlurper.parse file(packagejson)
return packageJson.get(section).get('react-native')
}
ext {
readReactNativeVersion = this.&readReactNativeVersion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment