Created
September 18, 2019 18:30
-
-
Save kkirby/b409545dc2b9e64ad617c1f75073a416 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clients from './clients'; | |
/** | |
* Start command: | |
* env REACT_NATIVE_APP_CLIENT=ge react-native start | |
* Bundle Command | |
* react-native bundle --reset-cache --bundle-output ./output.js --entry-file ./index.js | |
**/ | |
console.log( | |
clients( | |
PROCESS_ENV.REACT_NATIVE_APP_CLIENT | |
) | |
); | |
/** | |
* if REACT_NATIVE_APP_CLIENT == ge then console.log will output { clientName: 'ge' } | |
* if REACT_NATIVE_APP_CLIENT == visa then console.log will output { clientName: 'visa' } | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clients from './clientsdir/**/*'; | |
export default function(client){ | |
return clients[client]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
clientName: 'ge' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
clientName: 'visa' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the filename, underscores are actually directory separators.
This uses two bable plugins:
PROCESS_ENV
to environment variables that are passed to react-native, filtering out anything that doesn't start withREACT_NATIVE_APP
.