Skip to content

Commit

Permalink
chore: update compileSdkVersion for RN 0.70 pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dimninik committed Oct 27, 2023
1 parent 7332af5 commit 8bad3f2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/copyExampleProjectFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,15 @@ const changePackageJsonName = () => {
fs.writeFileSync(packageJsonDestinationPath, JSON.stringify(packageJson, null, 2) + '\n')
}

const setMinSdkVersion = () => {
const gradlePath = path.join(__dirname, TEST_PROJECT_DIR_NAME, 'android', 'app', 'build.gradle')
const gradleLines = fs.readFileSync(gradlePath, 'utf8').split('\n')
const indexOfManifestTagEndLine = gradleLines.findIndex(line => line.includes('minSdkVersion'))
gradleLines[indexOfManifestTagEndLine] = 'minSdkVersion 23'
fs.writeFileSync(gradlePath, gradleLines.join('\n'))
const setCompileSdkVersion = () => {
console.log(process.env)
if (process.env.inputs.REACT_NATIVE_VERSION.includes('0.70')) {
const gradlePath = path.join(__dirname, TEST_PROJECT_DIR_NAME, 'android', 'app', 'build.gradle')
const gradleLines = fs.readFileSync(gradlePath, 'utf8').split('\n')
const indexOfManifestTagEndLine = gradleLines.findIndex(line => line.includes('compileSdkVersion'))
gradleLines[indexOfManifestTagEndLine] = 'compileSdkVersion 32'
fs.writeFileSync(gradlePath, gradleLines.join('\n'))
}
}

const copyExampleProjectFiles = () => {
Expand All @@ -136,7 +139,7 @@ const copyExampleProjectFiles = () => {
copyReactNativeConfig()
copyBabelConfig()
changePackageJsonName()
setMinSdkVersion()
setCompileSdkVersion()
}

copyExampleProjectFiles()

0 comments on commit 8bad3f2

Please sign in to comment.