-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scripts to build app in release mode
- Loading branch information
1 parent
635320d
commit 810d8a9
Showing
2 changed files
with
37 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,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); | ||
} |