Skip to content

Commit a710f9a

Browse files
davidaureliofacebook-github-bot
authored andcommitted
Move packager launcher scripts outside of packager/
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist. Reviewed By: javache Differential Revision: D5112193 fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
1 parent 674a642 commit a710f9a

File tree

17 files changed

+29
-27
lines changed

17 files changed

+29
-27
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Note that you'll need the Android NDK installed, see [prerequisites](https://git
6464
```bash
6565
./gradlew :Examples:Movies:android:app:installDebug
6666
# Start the packager in a separate shell (make sure you ran npm install):
67-
./packager/packager.sh
67+
./scripts/packager.sh
6868
# Open the Movies app in your emulator
6969
```
7070

RNTester/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Start an Android emulator ([Genymotion](https://www.genymotion.com) is recommend
2727

2828
cd react-native
2929
./gradlew :RNTester:android:app:installDebug
30-
./packager/packager.sh
30+
./scripts/packager.sh
3131

3232
_Note: Building for the first time can take a while._
3333

@@ -46,7 +46,7 @@ Run the following commands from the react-native folder:
4646
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
4747
buck fetch rntester
4848
buck install -r rntester
49-
./packager/packager.sh
49+
./scripts/packager.sh
5050

5151
_Note: The native libs are still built using gradle. Full build with buck is coming soon(tm)._
5252

RNTester/RNTester.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@
14391439
);
14401440
runOnlyForDeploymentPostprocessing = 0;
14411441
shellPath = /bin/sh;
1442-
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
1442+
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
14431443
};
14441444
68CD48B71D2BCB2C007E06A9 /* Run Script */ = {
14451445
isa = PBXShellScriptBuildPhase;
@@ -1453,7 +1453,7 @@
14531453
);
14541454
runOnlyForDeploymentPostprocessing = 0;
14551455
shellPath = /bin/sh;
1456-
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
1456+
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
14571457
};
14581458
/* End PBXShellScriptBuildPhase section */
14591459

RNTester/RNTesterLegacy.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@
14321432
);
14331433
runOnlyForDeploymentPostprocessing = 0;
14341434
shellPath = /bin/sh;
1435-
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
1435+
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
14361436
};
14371437
68CD48B71D2BCB2C007E06A9 /* Run Script */ = {
14381438
isa = PBXShellScriptBuildPhase;
@@ -1446,7 +1446,7 @@
14461446
);
14471447
runOnlyForDeploymentPostprocessing = 0;
14481448
shellPath = /bin/sh;
1449-
shellScript = "export NODE_BINARY=node\n$SRCROOT/../packager/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
1449+
shellScript = "export NODE_BINARY=node\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js";
14501450
};
14511451
/* End PBXShellScriptBuildPhase section */
14521452

React/React.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -3335,7 +3335,7 @@
33353335
);
33363336
runOnlyForDeploymentPostprocessing = 0;
33373337
shellPath = /bin/sh;
3338-
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
3338+
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
33393339
showEnvVarsInLog = 0;
33403340
};
33413341
142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = {
@@ -3394,7 +3394,7 @@
33943394
);
33953395
runOnlyForDeploymentPostprocessing = 0;
33963396
shellPath = /bin/sh;
3397-
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
3397+
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
33983398
showEnvVarsInLog = 0;
33993399
};
34003400
3D383D3E1EBD27B9005632C8 /* Install Third Party */ = {

React/ReactLegacy.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2398,7 +2398,7 @@
23982398
);
23992399
runOnlyForDeploymentPostprocessing = 0;
24002400
shellPath = /bin/sh;
2401-
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
2401+
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi";
24022402
showEnvVarsInLog = 0;
24032403
};
24042404
142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = {
@@ -2443,7 +2443,7 @@
24432443
);
24442444
runOnlyForDeploymentPostprocessing = 0;
24452445
shellPath = /bin/sh;
2446-
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
2446+
shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";
24472447
showEnvVarsInLog = 0;
24482448
};
24492449
/* End PBXShellScriptBuildPhase section */

docs/IntegrationWithExistingApps.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ import React
454454
455455
<block class="objc" />
456456

457-
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/packager/` to generate that pre-bundled file.
457+
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/scripts/` to generate that pre-bundled file.
458458
459459
<block class="swift" />
460460

461-
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `let mainBundle = NSBundle(URLForResource: "main" withExtension:"jsbundle")`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/packager/` to generate that pre-bundled file.
461+
> When moving your app to production, the `NSURL` can point to a pre-bundled file on disk via something like `let mainBundle = NSBundle(URLForResource: "main" withExtension:"jsbundle")`. You can use the `react-native-xcode.sh` script in `node_modules/react-native/scripts/` to generate that pre-bundled file.
462462
463463
<block class="objc swift" />
464464

local-cli/core/__fixtures__/files/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@
539539
);
540540
runOnlyForDeploymentPostprocessing = 0;
541541
shellPath = /bin/sh;
542-
shellScript = "../node_modules/react-native/packager/react-native-xcode.sh";
542+
shellScript = "../node_modules/react-native/scripts/react-native-xcode.sh";
543543
};
544544
/* End PBXShellScriptBuildPhase section */
545545

local-cli/link/__fixtures__/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@
782782
);
783783
runOnlyForDeploymentPostprocessing = 0;
784784
shellPath = /bin/sh;
785-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
785+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
786786
};
787787
/* End PBXShellScriptBuildPhase section */
788788

local-cli/runAndroid/runAndroid.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ function startServerInNewWindow() {
247247
const scriptFile = /^win/.test(process.platform) ?
248248
'launchPackager.bat' :
249249
'launchPackager.command';
250-
const packagerDir = path.resolve(__dirname, '..', '..', 'packager');
251-
const launchPackagerScript = path.resolve(packagerDir, scriptFile);
252-
const procConfig = {cwd: packagerDir};
250+
const scriptsDir = path.resolve(__dirname, '..', '..', 'scripts');
251+
const launchPackagerScript = path.resolve(scriptsDir, scriptFile);
252+
const procConfig = {cwd: scriptsDir};
253253

254254
if (process.platform === 'darwin') {
255255
if (yargV.open) {

local-cli/templates/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@
874874
);
875875
runOnlyForDeploymentPostprocessing = 0;
876876
shellPath = /bin/sh;
877-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
877+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
878878
};
879879
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
880880
isa = PBXShellScriptBuildPhase;
@@ -888,7 +888,7 @@
888888
);
889889
runOnlyForDeploymentPostprocessing = 0;
890890
shellPath = /bin/sh;
891-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
891+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
892892
};
893893
/* End PBXShellScriptBuildPhase section */
894894

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@
9393
"init.sh",
9494
"scripts/ios-configure-glog.sh",
9595
"scripts/ios-install-third-party.sh",
96+
"scripts/launchPackager.bat",
97+
"scripts/launchPackager.command",
98+
"scripts/packager.sh",
99+
"scripts/react-native-xcode.sh",
96100
"jest-preset.json",
97101
"jest",
98102
"lib",
@@ -114,7 +118,7 @@
114118
"test": "jest",
115119
"flow": "flow",
116120
"lint": "eslint RNTester/ Libraries/",
117-
"start": "/usr/bin/env bash -c './packager/packager.sh \"$@\" || true' --",
121+
"start": "/usr/bin/env bash -c './scripts/packager.sh \"$@\" || true' --",
118122
"test-android-setup": "docker pull containership/android-base:latest",
119123
"test-android-build": "docker build -t react/android -f ContainerShip/Dockerfile.android .",
120124
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
File renamed without changes.

packager/launchPackager.command scripts/launchPackager.command

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ echo -en "\033]0;React Packager\a"
1212
clear
1313

1414
THIS_DIR=$(dirname "$0")
15-
pushd "$THIS_DIR/.."
16-
. packager/packager.sh
17-
popd
15+
. "$THIS_DIR/packager.sh"
1816

1917
echo "Process terminated. Press <enter> to close the window"
2018
read

scripts/objc-test.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ trap cleanup EXIT
3636

3737
if [ "$1" = "test" ]; then
3838

39-
# Start the packager
40-
open "./packager/launchPackager.command" || echo "Can't start packager automatically"
39+
# Start the packager
40+
open "./scripts/launchPackager.command" || echo "Can't start packager automatically"
4141
# Start the WebSocket test server
4242
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
4343

@@ -73,6 +73,6 @@ xcodebuild \
7373
-project "RNTester/RNTester.xcodeproj" \
7474
-scheme $SCHEME \
7575
-sdk $SDK \
76-
build
76+
build
7777

7878
fi
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)