Skip to content

Commit

Permalink
Upgrade CLI and Metro, update status check refs (#38988)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #38988

- Upgrade to RN CLI `12.0.0-alpha.9`, including Metro bump to `0.78.0`.
- Update test scripts, since this CLI release made a breaking change to the `/status` response.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D48311214

fbshipit-source-id: 91702c3aebbec9e280d3a660f03b2412484dfae0
  • Loading branch information
huntie authored and facebook-github-bot committed Aug 14, 2023
1 parent 54033fd commit ea24c70
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 315 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
"jest": "^29.2.1",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.14.0",
"metro-babel-register": "0.77.0",
"metro-memory-fs": "0.77.0",
"metro-babel-register": "0.78.0",
"metro-memory-fs": "0.78.0",
"micromatch": "^4.0.4",
"mkdirp": "^0.5.1",
"mock-fs": "^5.1.4",
Expand Down
14 changes: 8 additions & 6 deletions packages/community-cli-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@
"launchPackager.command"
],
"dependencies": {
"@react-native-community/cli-server-api": "12.0.0-alpha.7",
"@react-native-community/cli-tools": "12.0.0-alpha.7",
"@react-native-community/cli-server-api": "12.0.0-alpha.9",
"@react-native-community/cli-tools": "12.0.0-alpha.9",
"@react-native/metro-babel-transformer": "^0.73.11",
"chalk": "^4.0.0",
"execa": "^5.1.1",
"metro": "0.77.0",
"metro-config": "0.77.0",
"metro-core": "0.77.0",
"metro-resolver": "0.77.0",
"metro": "0.78.0",
"metro-config": "0.78.0",
"metro-core": "0.78.0",
"readline": "^1.3.0"
},
"devDependencies": {
"metro-resolver": "0.78.0"
},
"engines": {
"node": ">=18"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@react-native/metro-babel-transformer": "^0.73.11",
"@react-native/js-polyfills": "^0.73.0",
"metro-config": "0.77.0",
"metro-runtime": "0.77.0"
"metro-config": "0.78.0",
"metro-runtime": "0.78.0"
}
}
2 changes: 1 addition & 1 deletion packages/react-native/React/Base/RCTBundleURLProvider.mm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ + (BOOL)isPackagerRunning:(NSString *)hostPort scheme:(NSString *)scheme
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

NSString *status = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return [status isEqualToString:@"packager-status:running"];
return [status containsString:@"status: \"running\""];
}

- (NSString *)guessPackagerHost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/** Use this class to check if the JavaScript packager is running on the provided host. */
public class PackagerStatusCheck {

private static final String PACKAGER_OK_STATUS = "packager-status:running";
private static final String PACKAGER_OK_STATUS = "status: \"running\"";
private static final int HTTP_CONNECT_TIMEOUT_MS = 5000;
private static final String PACKAGER_STATUS_URL_TEMPLATE = "http://%s/status";

Expand Down Expand Up @@ -81,7 +81,7 @@ public void onResponse(Call call, Response response) throws IOException {
String bodyString =
body.string(); // cannot call body.string() twice, stored it into variable.
// https://github.com/square/okhttp/issues/1240#issuecomment-68142603
if (!PACKAGER_OK_STATUS.equals(bodyString)) {
if (!bodyString.contains(PACKAGER_OK_STATUS)) {
FLog.e(
ReactConstants.TAG,
"Got unexpected response from packager when requesting status: "
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
},
"dependencies": {
"@jest/create-cache-key-function": "^29.2.1",
"@react-native-community/cli": "12.0.0-alpha.7",
"@react-native-community/cli-platform-android": "12.0.0-alpha.7",
"@react-native-community/cli-platform-ios": "12.0.0-alpha.7",
"@react-native-community/cli": "12.0.0-alpha.9",
"@react-native-community/cli-platform-android": "12.0.0-alpha.9",
"@react-native-community/cli-platform-ios": "12.0.0-alpha.9",
"@react-native/assets-registry": "^0.73.0",
"@react-native/codegen": "^0.73.0",
"@react-native/gradle-plugin": "^0.73.0",
Expand All @@ -112,8 +112,8 @@
"jest-environment-node": "^29.2.1",
"jsc-android": "^250231.0.0",
"memoize-one": "^5.0.0",
"metro-runtime": "0.76.7",
"metro-source-map": "0.76.7",
"metro-runtime": "0.78.0",
"metro-source-map": "0.78.0",
"mkdirp": "^0.5.1",
"nullthrows": "^1.1.1",
"pretty-format": "^26.5.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/objc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ waitForPackager() {
local -i max_attempts=60
local -i attempt_num=1

until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do
until curl -s http://localhost:8081/status | grep "status: \"running\"" -q; do
if (( attempt_num == max_attempts )); then
echo "Packager did not respond in time. No more attempts left."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion scripts/testing-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function isPackagerRunning(
silent: true,
}).stdout;

return status === 'packager-status:running' ? 'running' : 'unrecognized';
return status.includes('status: "running') ? 'running' : 'unrecognized';
} catch (_error) {
return 'not_running';
}
Expand Down
Loading

0 comments on commit ea24c70

Please sign in to comment.