From 5d867ceccfa23f1cc8127cf8c490693acf117d6a Mon Sep 17 00:00:00 2001 From: Amandeep Singh Date: Fri, 17 Nov 2017 23:52:29 +0530 Subject: [PATCH 1/3] changes done required for ios build --- .gitignore | 1 + README.md | 14 ++++++++++++-- ios/ReactNativeConfig/BuildDotenvConfig.ruby | 4 ++-- package.json | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5ca0973f..08302ef7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store +.idea diff --git a/README.md b/README.md index 022313ea..8319ad77 100644 --- a/README.md +++ b/README.md @@ -157,9 +157,19 @@ Link the library: ``` $ react-native link react-native-config ``` - ### Extra step for iOS to support Info.plist - +### Should add this in your Podfile at the end +pre_install do |installer| + target 'housing' do + #system("cp ../.env /tmp/envfile && + #ruby ../node_modules/react-native-config/ios/ReactNativeConfig/BuildDotenvConfig.ruby") + system("cp ../.env /tmp/envfile && cd ../node_modules/react-native-config && + export SYMROOT=./ios/ReactNativeConfig && export BUILD_DIR=./ios/ReactNativeConfig && + ruby ./ios/ReactNativeConfig/BuildDotenvConfig.ruby") + end +end + +### The below mentioned steps should not be required after the changes * Go to your project -> Build Settings -> All * Search for "preprocess" * Set `Preprocess Info.plist File` to `Yes` diff --git a/ios/ReactNativeConfig/BuildDotenvConfig.ruby b/ios/ReactNativeConfig/BuildDotenvConfig.ruby index a447f7e3..51331cc7 100755 --- a/ios/ReactNativeConfig/BuildDotenvConfig.ruby +++ b/ios/ReactNativeConfig/BuildDotenvConfig.ruby @@ -22,10 +22,10 @@ dotenv = begin dotenv_pattern = /^(?:export\s+|)(?[[:alnum:]_]+)=((?["'])?(?.*?[^\\])\k?|)$/ # find that above node_modules/react-native-config/ios/ - path = File.join(Dir.pwd, "../../../#{file}") + path = File.join(Dir.pwd, "../../../#{defaultEnvFile}") if !File.exists?(path) # try as absolute path - path = file + path = defaultEnvFile end raw = File.read(path) diff --git a/package.json b/package.json index b4fd7bac..2104d507 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-config", - "version": "0.10.0", + "version": "1.0.0", "description": "Expose config variables to React Native apps", "keywords": ["env", "config", "config-var", "react-native", "android", "ios", "12factor"], "homepage": "https://github.com/luggg/react-native-config", From 2b4c0281f3d94676d87da686fef85ac731fe934b Mon Sep 17 00:00:00 2001 From: Amandeep Singh Date: Fri, 17 Nov 2017 23:57:24 +0530 Subject: [PATCH 2/3] changed the name in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2104d507..e300aeaf 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-config", + "name": "@housing/react-native-config", "version": "1.0.0", "description": "Expose config variables to React Native apps", "keywords": ["env", "config", "config-var", "react-native", "android", "ios", "12factor"], From ca485d828f7e7570cee79102b63431aadde6c2ae Mon Sep 17 00:00:00 2001 From: Amandeep Singh Date: Sat, 18 Nov 2017 00:29:02 +0530 Subject: [PATCH 3/3] some changes in the readme file --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8319ad77..7ac91121 100644 --- a/README.md +++ b/README.md @@ -159,11 +159,12 @@ $ react-native link react-native-config ``` ### Extra step for iOS to support Info.plist ### Should add this in your Podfile at the end +### and run pod install after that pre_install do |installer| target 'housing' do #system("cp ../.env /tmp/envfile && - #ruby ../node_modules/react-native-config/ios/ReactNativeConfig/BuildDotenvConfig.ruby") - system("cp ../.env /tmp/envfile && cd ../node_modules/react-native-config && + #ruby ../node_modules/@housing/react-native-config/ios/ReactNativeConfig/BuildDotenvConfig.ruby") + system("cp ../.env /tmp/envfile && cd ../node_modules/@housing/react-native-config && export SYMROOT=./ios/ReactNativeConfig && export BUILD_DIR=./ios/ReactNativeConfig && ruby ./ios/ReactNativeConfig/BuildDotenvConfig.ruby") end