Skip to content

Commit

Permalink
Fixed scripts to support rn 73
Browse files Browse the repository at this point in the history
  • Loading branch information
gosha212 committed Dec 29, 2024
1 parent 3de2795 commit 36ccf80
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions detox/scripts/updateGradle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
20 changes: 19 additions & 1 deletion scripts/change_react_native_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,35 @@ 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}`);

packageJson.dependencies['react'] = reactVersion;
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 => {
Expand Down

0 comments on commit 36ccf80

Please sign in to comment.