{"id":26271372,"url":"https://github.com/marconett/react-native-variations","last_synced_at":"2025-03-14T06:44:44.804Z","repository":{"id":34740606,"uuid":"183194386","full_name":"marconett/react-native-variations","owner":"marconett","description":"Create variations of (whitelabel) apps and switch between variation-specific files and metadata using the command line.","archived":false,"fork":false,"pushed_at":"2022-06-02T00:05:40.000Z","size":370,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T14:49:48.686Z","etag":null,"topics":["react-native","whitelabel"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marconett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-24T09:23:16.000Z","updated_at":"2023-04-17T22:06:35.000Z","dependencies_parsed_at":"2022-09-14T19:11:14.020Z","dependency_job_id":null,"html_url":"https://github.com/marconett/react-native-variations","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marconett%2Freact-native-variations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marconett%2Freact-native-variations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marconett%2Freact-native-variations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marconett%2Freact-native-variations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marconett","download_url":"https://codeload.github.com/marconett/react-native-variations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243538112,"owners_count":20307101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-native","whitelabel"],"created_at":"2025-03-14T06:44:44.345Z","updated_at":"2025-03-14T06:44:44.796Z","avatar_url":"https://github.com/marconett.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-variations\n\nCreate variations of (whitelabel) apps and switch between variation-specific files and metadata using the command line.\n\n## Installation\n```\n# Using npm\nnpm i --save-dev react-native-variations\n\n# Using yarn\nyarn add --dev react-native-variations\n\n# Add the following to your package.json\n\"scripts\": {\n  \"variation\": \"node_modules/react-native-variations/index.js\"\n},\n```\n\n## Usage Example\n\n### 1. Adding variations\n\nUse the `add` command on the cli to add one or more variations, for example:\n`yarn variation add MyFirstVariation MySecondVariation`\n\nThis will create a `variations/apps.json` with example values and the default folder structure for each variation:\n\n```\n  variations/\n  ├── apps.json\n  ├── MyFirstVariation/\n  │   ├── android/\n  │   ├── ios/\n  │   │   └── main_target/\n  │   └── src/\n  ├── MySecondVariation/\n  │   ├── android/\n  │   ├── ios/\n  │   │   └── main_target/\n  │   └── src/\n```\n\n### 2. Application specific files\n\nYou can fill the android, ios and src folder with files that are specific to that variation. **If you do, beware that those files now live in those folders, as the original files now get overwritten on variation switch.**\n\nThe `ios/main_target/` folder is a bit special, as it resolves to the main Xcode buildtarget folder, i.e.:\n\n```\nios/\n├── ReactNativeExampleApp/ \u003c--- this one\n├── ReactNativeExampleApp-tvOS/\n├── ReactNativeExampleApp-tvOSTests/\n├── ReactNativeExampleApp.xcodeproj/\n├── ReactNativeExampleAppTests/\n```\n\nPlease note, that this library simply overwrites a folder recursively when switching to another variation, meaning that **it does not remove files belonging to other variations before applying the new variation**.\nIn other words: It does not support files that are supposed to exist in one variation, but not in the other.\n\n### 3. Editing apps.json\n\nAfter adding a variation, you need to edit `variations/apps.json` to enter the variation/platform specific BundleIdentifier/ApplicationID, Display Name and Xcode Team. All key/value pairs are mandatory with the exception of `ios.urlScheme`.\n\nDefining `ios.urlScheme` sets *Identifier* and *URL Schemes* of your first URL Type (see [Apple Docs](https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app#3020456)).\nTo do the same with Android, for now please just create a variation of `AndroidManifest.xml` (i.e. `variations/MyFirstVariation/android/app/src/main/AndroidManifest.xml`)\n\n### 4. Android App signing\n\nTo support switching between different signing key for Android, you need to manually add *signingConfigs* to your `android/app/build.gradle` (see [React Native Docs](https://facebook.github.io/react-native/docs/signed-apk-android#adding-signing-config-to-your-app-s-gradle-config)) for each variation. The signingConfig must have the name of the variation.\n\nFor example:\n\n```\nsigningConfigs {\n    MyFirstVariation {\n        keyAlias 'MyFirstVariation'\n        keyPassword 'password123'\n        storeFile file('./keystores/first.jks')\n        storePassword 'password123'\n    }\n    MySecondVariation {\n        keyAlias 'MySecondVariation'\n        keyPassword 'password234'\n        storeFile file('./keystores/second.jks')\n        storePassword 'password234'\n    }\n}\n```\n\n### 5. Switching between variations\n\nEverything should be setup now. From now on, you can use the `switch` command on the cli to switch between variations, for example:\n`yarn variation switch MySecondVariation`\n\n\n## Other libraries / motivation\n\nThere are other libraries with a similar goals out there:\n\n* [White Label App](https://github.com/hazmi/white-label-app)\n* [React Native White-label](https://github.com/welldsagl/create-white-label-app)\n* [MajoraJS](https://github.com/SperaHealth/majora)\n* [React Native continuous integration tools](https://github.com/najeeb-rifaat/react-native-ci-tools)\n\nHowever, I wanted leave my js code untouched. I usually maintain a `config.js` file with constants, texts, colors and feature toggles, which is the only file that is variation specific. The other libraries also don't focus on the release side of things like being able to switch between app logos, Application IDs and names.\n\n\n## Improvements, caveats, todos\n\n* Simply copying files seems a bit crude. Using symlinks might be the way to go.\n* This is currently not really optimized to keep a clean git repo.\n* IDs and display names are not validated for platform specific format requirements.\n* The react-native-rename dependency should be replaced.\n* AndroidManifest.xml should be managed in code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarconett%2Freact-native-variations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarconett%2Freact-native-variations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarconett%2Freact-native-variations/lists"}