-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(suite-native): enable development client builds on Testflight
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* This file is based on the work of Max Bäumle (@343max) | ||
* from the repository: https://github.com/343max/testflight-dev-deploy | ||
* | ||
* Many thanks to Max for sharing this code with the community! | ||
*/ | ||
const { withDangerousMod } = require('expo/config-plugins'); | ||
const fs = require('fs').promises; | ||
const path = require('path'); | ||
|
||
const podfilePatch = [ | ||
'', | ||
'key_command_path = File.join(__dir__, "../node_modules/react-native/React/Base/RCTKeyCommands.m")', | ||
'file_content = File.read(key_command_path)', | ||
'file_content.sub!(/#if RCT_DEV/, "#if 0")', | ||
'File.write(key_command_path, file_content)', | ||
'puts "Patched RCTKeyCommands.m to disable key commands in dev mode"', | ||
'', | ||
] | ||
.map(s => ` ${s}`) | ||
.join('\n'); | ||
|
||
// Allow development client on Testflight | ||
const withTestflightDevDeploy = (config, { enabled = false }) => { | ||
withDangerousMod(config, [ | ||
'ios', | ||
async config2 => { | ||
if (!enabled) { | ||
return config2; | ||
} | ||
|
||
const podfilePath = path.join(config2.modRequest.platformProjectRoot, 'Podfile'); | ||
|
||
const code = await fs.readFile(podfilePath, { encoding: 'utf-8' }); | ||
const patchedCode = code.replace( | ||
/^\s*post_install do \|installer\|/m, | ||
match => `${match}\n${podfilePatch}`, | ||
); | ||
await fs.writeFile(podfilePath, patchedCode); | ||
|
||
return config2; | ||
}, | ||
]); | ||
|
||
return config; | ||
}; | ||
|
||
module.exports = withTestflightDevDeploy; |