Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes done required for ios build #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
.idea

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,20 @@ 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
### and run pod install after that
pre_install do |installer|
target 'housing' do
#system("cp ../.env /tmp/envfile &&
#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
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`
Expand Down
4 changes: 2 additions & 2 deletions ios/ReactNativeConfig/BuildDotenvConfig.ruby
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ dotenv = begin
dotenv_pattern = /^(?:export\s+|)(?<key>[[:alnum:]_]+)=((?<quote>["'])?(?<val>.*?[^\\])\k<quote>?|)$/

# 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)

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-config",
"version": "0.10.0",
"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"],
"homepage": "https://github.com/luggg/react-native-config",
Expand Down