diff --git a/packages/TesterApp/package.json b/packages/TesterApp/package.json index 4e394ae4c..306db4a8e 100644 --- a/packages/TesterApp/package.json +++ b/packages/TesterApp/package.json @@ -4,7 +4,9 @@ "private": true, "scripts": { "android": "react-native run-android", + "android:release": "node ./scripts/release.js android", "ios": "react-native run-ios", + "ios:release": "node ./scripts/release.js android", "start": "react-native webpack-start", "bundle:android": "react-native webpack-bundle --platform android --entry-file index.js --dev=false --bundle-output build/output/android/index.android.bundle --assets-dest build/output/android/res", "bundle:ios": "react-native webpack-bundle --platform ios --entry-file index.js --dev=false --bundle-output build/output/ios/main.jsbundle --assets-dest build/output/ios", diff --git a/packages/TesterApp/scripts/release.js b/packages/TesterApp/scripts/release.js new file mode 100644 index 000000000..04bf5bd1c --- /dev/null +++ b/packages/TesterApp/scripts/release.js @@ -0,0 +1,35 @@ +// script.js +const { execSync } = require('child_process'); + +function runCommand(command) { + try { + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(`Error executing command: ${command}`, error); + process.exit(1); + } +} + +function buildIOS() { + runCommand('pnpm bundle:ios'); + process.chdir('./ios'); + runCommand('bundle exec pod install'); + runCommand('npx react-native run-ios --mode "Release"'); +} + +function buildAndroid() { + console.log('Building Android...'); + runCommand('pnpm bundle:android'); + runCommand('npx react-native run-android --mode "Release"'); +} + +// Get argument +const platform = process.argv[2] || ''; +if (platform === 'ios') { + buildIOS(); +} else if (platform === 'android') { + buildAndroid(); +} else { + console.error('Please specify either "ios" or "android" as an argument.'); + process.exit(1); +}