Skip to content

Commit

Permalink
chore: apply reviewers review
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak committed Jun 11, 2024
1 parent d2f7f38 commit 400213d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/TesterApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 12 additions & 1 deletion packages/TesterApp/scripts/release.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { execSync } = require('child_process');
const { rm, existsSync } = require('fs');

function runCommand(command) {
try {
Expand All @@ -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();
Expand Down

0 comments on commit 400213d

Please sign in to comment.