From 36ccf80324f241241766a0839ed0d6bfc2d2ccee Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Mon, 30 Dec 2024 00:49:15 +0200 Subject: [PATCH] Fixed scripts to support rn 73 --- detox/scripts/updateGradle.js | 6 ++++++ scripts/change_react_native_version.js | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/detox/scripts/updateGradle.js b/detox/scripts/updateGradle.js index 9731e3b005..bdb2d64023 100644 --- a/detox/scripts/updateGradle.js +++ b/detox/scripts/updateGradle.js @@ -7,6 +7,12 @@ function getGradleVersionByRNVersion() { switch (rnMinor) { default: return '8.10.2'; + case '75': + return '8.8'; + case '74': + return '8.6'; + case '73': + return '8.3'; case '72': return '8.0'; case '71': diff --git a/scripts/change_react_native_version.js b/scripts/change_react_native_version.js index 45b2e8afc6..46b6d7bf30 100644 --- a/scripts/change_react_native_version.js +++ b/scripts/change_react_native_version.js @@ -20,7 +20,7 @@ async function run() { const data = await fetch(`https://registry.npmjs.org/react-native/${reactNativeVersion}`); const reactVersion = data.peerDependencies.react; - console.log(`Changed dependencies: + console.log(`Changed dependencies: react-native: ${reactNativeVersion} react: ${reactVersion}`); @@ -28,9 +28,27 @@ async function run() { packageJson.dependencies['react-native'] = reactNativeVersion; } + updateReactNative73DevDependencies(reactNativeVersion, packageJson); + fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2)); } +function updateReactNative73DevDependencies(reactNativeVersion, packageJson) { + const minorVersion = reactNativeVersion.split('.')[1]; + if (minorVersion !== '73') { + return; + } + + packageJson.devDependencies['@react-native/babel-preset'] = '0.73.21'; + packageJson.devDependencies['@react-native/eslint-config'] = '0.73.2'; + packageJson.devDependencies['@react-native/metro-config'] = '0.73.5'; + packageJson.devDependencies['@react-native/typescript-config'] = '0.73.1'; + + delete packageJson.devDependencies['@react-native-community/cli']; + delete packageJson.devDependencies['@react-native-community/cli-platform-android']; + delete packageJson.devDependencies['@react-native-community/cli-platform-ios']; +} + async function fetch(url) { return new Promise((resolve, reject) => { https.get(url, res => {