Skip to content

Commit

Permalink
[updates] fix e2e errors on ios (#28611)
Browse files Browse the repository at this point in the history
# Why

fix
https://expo.dev/accounts/expo-ci/projects/updates-e2e/builds/b9722d1c-b4d6-4d0a-aaaa-09e519875b9c

# How

- temporarily apply fix for
facebook/react-native#44401
- suppress expo-dev-client lookup warning
  • Loading branch information
Kudo committed May 3, 2024
1 parent 1711b6b commit ab69adb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/expo-updates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### 💡 Others

- Suppressed `Error: Cannot find module 'expo-dev-client/package.json'` from `pod install` on iOS. ([#28611](https://github.com/expo/expo/pull/28611) by [@kudo](https://github.com/kudo))

## 0.25.7 — 2024-05-02

### 🐛 Bug fixes
Expand Down
23 changes: 23 additions & 0 deletions packages/expo-updates/e2e/setup/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@ export async function initAsync(
stdio: 'inherit',
});

// Applying patches for 3rd party dependencies
await patchReactNativeAsync(projectRoot);

// enable proguard on Android
await fs.appendFile(
path.join(projectRoot, 'android', 'gradle.properties'),
Expand Down Expand Up @@ -898,3 +901,23 @@ export async function setupUpdatesDevClientE2EAppAsync(
path.join(projectRoot, 'e2e', 'tests', 'Updates.e2e.ts')
);
}

/**
* Apply temporary fix from https://github.com/facebook/react-native/pull/44402
*/
export async function patchReactNativeAsync(projectRoot: string) {
const packageJson = require(path.join(projectRoot, 'package.json'));
let postInstallScript = packageJson.scripts?.postinstall ?? '';
const reactNativeRoot = path.join(projectRoot, 'node_modules', 'react-native');
const reactNativeVersion = require(path.join(reactNativeRoot, 'package.json')).version;
if (reactNativeVersion === '0.74.1') {
if (postInstallScript !== '') {
postInstallScript += ' && ';
}
postInstallScript +=
'curl -sL https://patch-diff.githubusercontent.com/raw/facebook/react-native/pull/44402.diff \
| patch -p3 -d node_modules/react-native';
}
packageJson.scripts.postinstall = postInstallScript;
await fs.writeFile(path.join(projectRoot, 'package.json'), JSON.stringify(packageJson, null, 2));
}
2 changes: 1 addition & 1 deletion packages/expo-updates/ios/EXUpdates.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))

use_dev_client = false
begin
use_dev_client = !!`node --print "require('expo-dev-client/package.json').version"`
use_dev_client = `node --print "require('expo-dev-client/package.json').version" 2>/dev/null`.length > 0
rescue
use_dev_client = false
end
Expand Down

0 comments on commit ab69adb

Please sign in to comment.