Skip to content

Instantly share code, notes, and snippets.

@iamcxa
Created September 16, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamcxa/cc5ac5f3d9ac0bade7d970a1e2c46f51 to your computer and use it in GitHub Desktop.
Save iamcxa/cc5ac5f3d9ac0bade7d970a1e2c46f51 to your computer and use it in GitHub Desktop.
react-native-android-release-gradle-fix.js
const fs = require('fs')
try {
var curDir = __dirname
var rootDir = process.cwd()
var file = `${rootDir}/node_modules/react-native/react.gradle`
var dataFix = fs.readFileSync(`${curDir}/android-react-gradle-fix`, 'utf8')
var data = fs.readFileSync(file, 'utf8')
var doLast = "doLast \{"
if (data.indexOf(doLast) !== -1) {
throw "Already fixed."
}
var result = data.replace(/\/\/ Set up inputs and outputs so gradle can cache the result/g, dataFix);
fs.writeFileSync(file, result, 'utf8')
console.log('Done')
} catch (error) {
console.error(error)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment