From d3ca200f59b86ae183b98c9e9be45b67d1f5fc0d Mon Sep 17 00:00:00 2001 From: Morgan Laco Date: Mon, 5 Nov 2018 16:28:24 -0500 Subject: [PATCH 1/5] Patch RCTWebSocket This is based off this solution: https://github.com/facebook/react-native/pull/19579 to this issue: https://github.com/facebook/react-native/issues/19569 --- boilerplate.js | 2 ++ lib/project.pbxproj.patch | 56 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 lib/project.pbxproj.patch diff --git a/boilerplate.js b/boilerplate.js index c8bde76..6c8d193 100644 --- a/boilerplate.js +++ b/boilerplate.js @@ -51,6 +51,8 @@ async function install (context) { }) if (rnInstall.exitCode > 0) process.exit(rnInstall.exitCode) + system.run(`git apply --include=${process.cwd()}/node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj ${__dirname}/lib/project.pbxproj.patch`) + // remove the __tests__ directory and App.js that come with React Native filesystem.remove('__tests__') filesystem.remove('App.js') diff --git a/lib/project.pbxproj.patch b/lib/project.pbxproj.patch new file mode 100644 index 0000000..11c2c8d --- /dev/null +++ b/lib/project.pbxproj.patch @@ -0,0 +1,56 @@ +diff --git a/before.pbxproj b/after.pbxproj +index efb2609..91cef26 100644 +--- a/before.pbxproj ++++ b/after.pbxproj +@@ -9,7 +9,7 @@ + /* Begin PBXBuildFile section */ + 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; + 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; +- 13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13526A511F362F7F0008EF00 /* libfishhook.a */; }; ++ 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; }; + 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; + 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; + 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; +@@ -87,7 +87,7 @@ + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( +- 13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */, ++ 2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +@@ -373,7 +373,7 @@ + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; +- IPHONEOS_DEPLOYMENT_TARGET = 8.0; ++ IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; +@@ -417,7 +417,7 @@ + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; +- IPHONEOS_DEPLOYMENT_TARGET = 8.0; ++ IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; +@@ -435,7 +435,7 @@ + EXECUTABLE_PREFIX = lib; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", +- "RCT_METRO_PORT=${RCT_METRO_PORT}", ++ "RCT_METRO_PORT=${RCT_METRO_PORT}", + "$(inherited)", + ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; +@@ -556,4 +556,4 @@ + /* End XCConfigurationList section */ + }; + rootObject = 3C86DF3E1ADF2C930047B81A /* Project object */; +-} ++} +\ No newline at end of file From faa0fbfeee787dcaf359163436bfcc7ed8167449 Mon Sep 17 00:00:00 2001 From: Morgan Laco Date: Mon, 5 Nov 2018 17:06:25 -0500 Subject: [PATCH 2/5] Correctly apply patch --- boilerplate.js | 2 +- lib/{project.pbxproj.patch => project-pbxproj.patch} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename lib/{project.pbxproj.patch => project-pbxproj.patch} (96%) diff --git a/boilerplate.js b/boilerplate.js index 6c8d193..015d134 100644 --- a/boilerplate.js +++ b/boilerplate.js @@ -51,7 +51,7 @@ async function install (context) { }) if (rnInstall.exitCode > 0) process.exit(rnInstall.exitCode) - system.run(`git apply --include=${process.cwd()}/node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj ${__dirname}/lib/project.pbxproj.patch`) + system.run(`cd node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj && git apply ../../../../../../ignite-ir-boilerplate-andross/lib/project-pbxproj.patch`) // remove the __tests__ directory and App.js that come with React Native filesystem.remove('__tests__') diff --git a/lib/project.pbxproj.patch b/lib/project-pbxproj.patch similarity index 96% rename from lib/project.pbxproj.patch rename to lib/project-pbxproj.patch index 11c2c8d..8ef9ea5 100644 --- a/lib/project.pbxproj.patch +++ b/lib/project-pbxproj.patch @@ -1,7 +1,7 @@ -diff --git a/before.pbxproj b/after.pbxproj +diff --git a/project.pbxproj b/project.pbxproj index efb2609..91cef26 100644 ---- a/before.pbxproj -+++ b/after.pbxproj +--- a/project.pbxproj ++++ b/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; From ac1189c54c265f310326974e9687c5363f9e9e2d Mon Sep 17 00:00:00 2001 From: Morgan Laco Date: Tue, 6 Nov 2018 12:02:57 -0500 Subject: [PATCH 3/5] Correct patch path --- boilerplate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boilerplate.js b/boilerplate.js index 015d134..ff701c3 100644 --- a/boilerplate.js +++ b/boilerplate.js @@ -51,8 +51,8 @@ async function install (context) { }) if (rnInstall.exitCode > 0) process.exit(rnInstall.exitCode) - system.run(`cd node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj && git apply ../../../../../../ignite-ir-boilerplate-andross/lib/project-pbxproj.patch`) - + system.run(`cd ./node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj && git apply ../../../../../../node_modules/ignite-ir-boilerplate-andross/lib/project-pbxproj.patch`) + // remove the __tests__ directory and App.js that come with React Native filesystem.remove('__tests__') filesystem.remove('App.js') From 5b8f5472604ecad6d3461fd4542ca7fc8a14d24e Mon Sep 17 00:00:00 2001 From: Morgan Laco Date: Tue, 6 Nov 2018 13:36:46 -0500 Subject: [PATCH 4/5] Add spinner message for patch --- boilerplate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boilerplate.js b/boilerplate.js index ff701c3..bc6c0d9 100644 --- a/boilerplate.js +++ b/boilerplate.js @@ -51,8 +51,11 @@ async function install (context) { }) if (rnInstall.exitCode > 0) process.exit(rnInstall.exitCode) + spinner.text = "Applying patch to RCTWebSocket" + spinner.start() system.run(`cd ./node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj && git apply ../../../../../../node_modules/ignite-ir-boilerplate-andross/lib/project-pbxproj.patch`) - + spinner.succeed() + // remove the __tests__ directory and App.js that come with React Native filesystem.remove('__tests__') filesystem.remove('App.js') From cd6741a737f0f49cde50e8f26b4a6ab513f5d3e7 Mon Sep 17 00:00:00 2001 From: Morgan Date: Tue, 6 Nov 2018 13:56:12 -0500 Subject: [PATCH 5/5] Use singlequote --- boilerplate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boilerplate.js b/boilerplate.js index bc6c0d9..e76736d 100644 --- a/boilerplate.js +++ b/boilerplate.js @@ -51,7 +51,7 @@ async function install (context) { }) if (rnInstall.exitCode > 0) process.exit(rnInstall.exitCode) - spinner.text = "Applying patch to RCTWebSocket" + spinner.text = 'Applying patch to RCTWebSocket' spinner.start() system.run(`cd ./node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj && git apply ../../../../../../node_modules/ignite-ir-boilerplate-andross/lib/project-pbxproj.patch`) spinner.succeed()