diff --git a/packages/TesterApp/package.json b/packages/TesterApp/package.json index 306db4a8e..f57c70942 100644 --- a/packages/TesterApp/package.json +++ b/packages/TesterApp/package.json @@ -6,7 +6,7 @@ "android": "react-native run-android", "android:release": "node ./scripts/release.js android", "ios": "react-native run-ios", - "ios:release": "node ./scripts/release.js android", + "ios:release": "node ./scripts/release.js ios", "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 index ad1a8414a..329b46786 100644 --- a/packages/TesterApp/scripts/release.js +++ b/packages/TesterApp/scripts/release.js @@ -1,4 +1,5 @@ const { execSync } = require('child_process'); +const { rm, existsSync } = require('fs'); function runCommand(command) { try { @@ -17,13 +18,23 @@ function buildIOS() { } function buildAndroid() { - console.log('Building Android...'); runCommand('pnpm bundle:android'); runCommand( 'npx react-native run-android --tasks assembleRelease,installRelease' ); } +const buildDir = 'build/generated'; + +if (existsSync(buildDir)) { + rm(buildDir, { recursive: true }, (err) => { + if (err) { + console.error('Error removing build directory:', err); + process.exit(1); + } + }); +} + const platform = process.argv[2] || ''; if (platform === 'ios') { buildIOS();