feat(env): ENG-5744 app-env package #2760
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Summary
This library introduces a comprehensive runtime environment implementation for React Native applications. The solution includes features for managing and switching between multiple environments, providing a developer menu, and integrating with both Android and iOS platforms through native modules.
Key Features
Environment Management:
Developer Menu:
AsyncStorage
andSensitiveInfo
.Cross-Platform Native Integration:
FlagshipEnvModule
to manage environment variables and app information.FlagshipEnv
module with compatibility forInfo.plist
.Version Overlay:
Metro and Babel Support:
process.env.FLAGSHIP_APP_ENV
with the respective environment configuration during the build process.Utility Components and Contexts:
DevMenuList
,EnvSwitcher
, andVersionOverlay
.Usage
Setting up environments:
.flagshipappenvrc
and correspondingenv.<name>.ts
files.Developer Menu:
DevMenu
component to enable developer tools.Switching Environments:
EnvSwitcher
component in the developer menu to select an environment.Metro Configuration:
metro-bundler
to apply the configurations dynamically.Extending:
screens
prop inDevMenu
.Implementation Details
Performance Optimizations:
Error Handling:
Scalability:
Issue ticket number and link
Ticket
Type of change
Test Plan
yarn test
Checklist before requesting a review