Skip to content

Commit

Permalink
Feat: add start.sh
Browse files Browse the repository at this point in the history
## Test Plan

- Dev:
```bash
./start.sh -d
```

- Release:
```bash
./start.sh -r
```

- Usage:
```base
./start.sh -h
```
  • Loading branch information
JedBeom committed Jan 28, 2025
1 parent 3c43e4a commit d08994e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"web:build": "expo export --platform web",
"lint": "expo lint",
"test": "jest",
"format:write": "prettier . --write",
Expand Down
62 changes: 62 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

trap "trap - SIGTERM && kill 0" SIGINT SIGTERM EXIT

expo_build() {
cd frontend
pnpm web:build
cd ..
}

expo_start() {
cd frontend
pnpm start
cd ..
}

cargo_run_debug_proxy() {
cargo run -- --reverse-proxy
}

cargo_run_release() {
cargo run --release
}

usage() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -h, --help Display this help message."
echo " -d, --dev Run in development mode."
echo " -r, --release Run in release mode."
}

handle_options() {
while [ $# -gt 0 ]; do
case $1 in
-h | --help)
usage
exit 0
;;
-d | --dev)
cargo_run_debug_proxy &
expo_start
;;
-r | --release)
expo_build
cargo_run_release
;;
*)
echo "Invalid option: $1" >&2
usage
exit 1
;;
esac
shift 1
done
}
if [ "$#" -eq 0 ];
then
usage
else
handle_options "$@"
fi

0 comments on commit d08994e

Please sign in to comment.