mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Metro Bundler -> Metro
Summary: This bothers me, we renamed the project to drop the "Metro" a while ago. Reviewed By: rubennorte Differential Revision: D16831281 fbshipit-source-id: bb6de412eccda61b617580f3660e3e635f2d2815
This commit is contained in:
committed by
Facebook Github Bot
parent
bb625e5238
commit
88d0ac17e8
+1
-1
@@ -70,7 +70,7 @@ When developing E2E tests, you may want to run in development mode, so that chan
|
||||
detox build -c ios.sim.debug
|
||||
detox test -c ios.sim.debug
|
||||
|
||||
You will also need to have Metro Bundler running in another terminal. Note that if you've previously run the E2E tests in release mode, you may need to delete the `RNTester/build` folder before rerunning `detox build`.
|
||||
You will also need to have Metro running in another terminal. Note that if you've previously run the E2E tests in release mode, you may need to delete the `RNTester/build` folder before rerunning `detox build`.
|
||||
|
||||
## Building from source
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#if RCT_DEV && !TARGET_OS_UIKITFORMAC
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTInspectorPackagerConnection.h>
|
||||
@@ -37,12 +37,14 @@ static NSURL *getInspectorDeviceUrl(NSURL *bundleURL)
|
||||
if (inspectorProxyPortStr && [inspectorProxyPortStr length] > 0) {
|
||||
inspectorProxyPort = [NSNumber numberWithInt:[inspectorProxyPortStr intValue]];
|
||||
}
|
||||
NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
||||
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
||||
NSString *escapedDeviceName = [[[UIDevice currentDevice] name]
|
||||
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
||||
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier]
|
||||
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
||||
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@",
|
||||
getServerHost(bundleURL, inspectorProxyPort),
|
||||
escapedDeviceName,
|
||||
escapedAppName]];
|
||||
getServerHost(bundleURL, inspectorProxyPort),
|
||||
escapedDeviceName,
|
||||
escapedAppName]];
|
||||
}
|
||||
|
||||
static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title)
|
||||
@@ -52,18 +54,20 @@ static NSURL *getAttachDeviceUrl(NSURL *bundleURL, NSString *title)
|
||||
if (metroBundlerPortStr && [metroBundlerPortStr length] > 0) {
|
||||
metroBundlerPort = [NSNumber numberWithInt:[metroBundlerPortStr intValue]];
|
||||
}
|
||||
NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
|
||||
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
|
||||
NSString *escapedDeviceName = [[[UIDevice currentDevice] name]
|
||||
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
|
||||
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier]
|
||||
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLHostAllowedCharacterSet];
|
||||
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/attach-debugger-nuclide?title=%@&device=%@&app=%@",
|
||||
getServerHost(bundleURL, metroBundlerPort),
|
||||
title,
|
||||
escapedDeviceName,
|
||||
escapedAppName]];
|
||||
getServerHost(bundleURL, metroBundlerPort),
|
||||
title,
|
||||
escapedDeviceName,
|
||||
escapedAppName]];
|
||||
}
|
||||
|
||||
@implementation RCTInspectorDevServerHelper
|
||||
|
||||
RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
|
||||
static NSMutableDictionary<NSString *, RCTInspectorPackagerConnection *> *socketConnections = nil;
|
||||
|
||||
@@ -74,23 +78,18 @@ static void sendEventToAllConnections(NSString *event)
|
||||
}
|
||||
}
|
||||
|
||||
static void displayErrorAlert(UIViewController *view, NSString *message) {
|
||||
UIAlertController *alert =
|
||||
[UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
static void displayErrorAlert(UIViewController *view, NSString *message)
|
||||
{
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
|
||||
message:message
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[view presentViewController:alert animated:YES completion:nil];
|
||||
dispatch_after(
|
||||
dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5),
|
||||
dispatch_get_main_queue(),
|
||||
^{
|
||||
[alert dismissViewControllerAnimated:YES completion:nil];
|
||||
});
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 2.5), dispatch_get_main_queue(), ^{
|
||||
[alert dismissViewControllerAnimated:YES completion:nil];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)attachDebugger:(NSString *)owner
|
||||
withBundleURL:(NSURL *)bundleURL
|
||||
withView:(UIViewController *)view
|
||||
+ (void)attachDebugger:(NSString *)owner withBundleURL:(NSURL *)bundleURL withView:(UIViewController *)view
|
||||
{
|
||||
NSURL *url = getAttachDeviceUrl(bundleURL, owner);
|
||||
|
||||
@@ -98,15 +97,15 @@ static void displayErrorAlert(UIViewController *view, NSString *message) {
|
||||
[request setHTTPMethod:@"GET"];
|
||||
|
||||
__weak UIViewController *viewCapture = view;
|
||||
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:
|
||||
^(__unused NSData *_Nullable data,
|
||||
__unused NSURLResponse *_Nullable response,
|
||||
NSError *_Nullable error) {
|
||||
UIViewController *viewCaptureStrong = viewCapture;
|
||||
if (error != nullptr && viewCaptureStrong != nullptr) {
|
||||
displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro Bundler!");
|
||||
}
|
||||
}] resume];
|
||||
[[[NSURLSession sharedSession]
|
||||
dataTaskWithRequest:request
|
||||
completionHandler:^(
|
||||
__unused NSData *_Nullable data, __unused NSURLResponse *_Nullable response, NSError *_Nullable error) {
|
||||
UIViewController *viewCaptureStrong = viewCapture;
|
||||
if (error != nullptr && viewCaptureStrong != nullptr) {
|
||||
displayErrorAlert(viewCaptureStrong, @"The request to attach Nuclide couldn't reach Metro!");
|
||||
}
|
||||
}] resume];
|
||||
}
|
||||
|
||||
+ (void)disableDebugger
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
:: LICENSE file in the root directory of this source tree.
|
||||
|
||||
@echo off
|
||||
title Metro Bundler
|
||||
title Metro
|
||||
call .packager.bat
|
||||
cd ../../../
|
||||
node "%~dp0..\cli.js" start
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
# Set terminal title
|
||||
echo -en "\\033]0;Metro Bundler\\a"
|
||||
echo -en "\\033]0;Metro\\a"
|
||||
clear
|
||||
|
||||
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
set -x
|
||||
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
|
||||
|
||||
# Enables iOS devices to get the IP address of the machine running Metro Bundler
|
||||
# Enables iOS devices to get the IP address of the machine running Metro
|
||||
if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
|
||||
IP=$(ipconfig getifaddr en0)
|
||||
if [ -z "$IP" ]; then
|
||||
|
||||
Reference in New Issue
Block a user