react-native-ultimate-config
Config that works
![npm](https://img.shields.io/npm/dw/react-native-ultimate-config?color=green)
Project generated with https://github.com/brodybits/create-react-native-module
Suport of gradle
react-native-ultimate-config | gradle |
---|
^3 | <=6 |
>4 | 7 |
TL;DR usage
- install
npm | yarn |
---|
npm install react-native-ultimate-config | yarn add react-native-ultimate-config |
- one-off setup for native projects
- initialize env
npm | yarn |
---|
npm run rnuc <env file> | yarn rnuc <env file> |
- build!
react-native run-{ios,android}
☝❗Approach to versioning and breaking changes
This library is using semver and heavily relying on codegeneration. Many new features and/or bugfixes will require these files to be regenerated. Changes to codegenerated files will not be considered breaking
unless they affect behavior of API or CLI.
Therefore every time this library is updated all files MUST be regenerated using rnuc
command.
Table of contents
- Features 🎆
- Mission 🥾
- Quickstart Guide 🏃
- API 🧰
- Changelog 📓
- Cookbook 🥦
- Troubleshooting 🎱
- Contributor notes
- Alternatives
Features
- Simple one-off setup for native projects
- No need to mess with xcode schemes or android flavors
- Access from javascript
- Access from native code: java and objective-c
- Access in build tools: xcode, gradle and AndroidManifest.xml
- Web support (works with React Native for Web)
- Hooks
- Monorepo support (yarn workspaces or lerna)
- Unit tested with jest
- E2E tested with detox
- Provides typescript typings
- Supports dotenv and yaml
- Fully typed values available when using yaml config
- Configure values per platform in one file
Mission
React-Native brings together 3 platforms: ios, android, javascript each of
which have different conventions and approaches how to manage environment
settings.
A typical app is usually operating in some environment defined by server urls
various api keys or feature flags. When dealing with react-native such things
often need to exist in 3 places: ios, android and js code. Even managing things
as simple as application name or bundle id needs to be done in 2 places:
Info.plist
and AndroidManifest.xml
react-native-ultimate-config
tries to reduce friction in managing these things
by abstracting away from nuances of native projects.
With react-native-ultimate-config
it is possible to consume variables in
every place of a typical react-native app:
- javascript
- native code
- native build configuration
- ios
- android
- build config
- string resources
- project.ext
|-------------------------------------------------------|
| |
| javascript |
| |
|-------------------------------------------------------|
| | |
| objective-c | java |
| | |
|-------------------------------------------------------|
| | |
| build settings | AndroidManifest.xml |
| infoplist | build.gradle |
| | |
|-------------------------------------------------------|