Skip to content

Commit

Permalink
Add standalone installation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuuszzzzz committed Dec 16, 2024
1 parent 31adaa8 commit 959db50
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@
"license": "MIT",
"private": true,
"scripts": {
"i-standalone": "STANDALONE_NEW_DOT=true npm i",
"install-standalone": "STANDALONE_NEW_DOT=true npm install",
"configure-mapbox": "./scripts/setup-mapbox-sdk-walkthrough.sh",
"setupNewDotWebForEmulators": "./scripts/setup-newdot-web-emulators.sh",
"startAndroidEmulator": "./scripts/start-android.sh",
"postinstall": "./scripts/postInstall.sh",
"clean": "./scripts/clean.sh",
"clean-standalone": "./scripts/clean.sh --new-dot",
"clean-standalone": "STANDALONE_NEW_DOT=true ./scripts/clean.sh",
"android": "./scripts/set-pusher-suffix.sh && ./scripts/run-build.sh --android",
"android-standalone": "./scripts/set-pusher-suffix.sh && ./scripts/run-build.sh --android --new-dot",
"android-standalone": "./scripts/set-pusher-suffix.sh && STANDALONE_NEW_DOT=true ./scripts/run-build.sh --android",
"ios": "./scripts/set-pusher-suffix.sh && ./scripts/run-build.sh --ios",
"ios-standalone": "./scripts/set-pusher-suffix.sh && ./scripts/run-build.sh --ios --new-dot",
"ios-standalone": "./scripts/set-pusher-suffix.sh && STANDALONE_NEW_DOT=true ./scripts/run-build.sh --ios",
"pod-install": "./scripts/pod-install.sh",
"pod-install-standalone": "./scripts/pod-install.sh --new-dot",
"pod-install-standalone": "STANDALONE_NEW_DOT=true ./scripts/pod-install.sh",
"ipad": "concurrently \"./scripts/run-build.sh --ipad\"",
"ipad-standalone": "concurrently \"./scripts/run-build.sh --ipad --new-dot\"",
"ipad-standalone": "concurrently \"STANDALONE_NEW_DOT=true ./scripts/run-build.sh --ipad\"",
"ipad-sm": "concurrently \"./scripts/run-build.sh --ipad-sm\"",
"ipad-sm-standalone": "concurrently \"./scripts/run-build.sh --ipad-sm --new-dot\"",
"ipad-sm-standalone": "concurrently \"STANDALONE_NEW_DOT=true ./scripts/run-build.sh --ipad-sm\"",
"start": "npx react-native start",
"web": "./scripts/set-pusher-suffix.sh && concurrently npm:web-proxy npm:web-server",
"web-proxy": "ts-node web/proxy.ts",
Expand Down
4 changes: 3 additions & 1 deletion scripts/applyPatches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ source "$SCRIPTS_DIR/shellUtils.sh"
function patchPackage {
# See if we're in the HybridApp repo
IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app.sh)
NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"

OS="$(uname)"
if [[ "$OS" == "Darwin" || "$OS" == "Linux" ]]; then
npx patch-package --error-on-fail --color=always
if [[ "$IS_HYBRID_APP_REPO" == "true" ]]; then
if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then
echo -e "\n${GREEN}Applying HybridApp patches!${NC}"
npx patch-package --patch-dir 'Mobile-Expensify/patches' --error-on-fail --color=always
fi
else
Expand Down
5 changes: 4 additions & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ NC='\033[0m'
# See if we're in the HybridApp repo
IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app.sh)

if [[ "$IS_HYBRID_APP_REPO" == "true" && "$1" != "--new-dot" ]]; then
# See if we should force standalone NewDot build
NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"

if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then
echo -e "${BLUE}Cleaning HybridApp project...${NC}"
# Navigate to Mobile-Expensify repository, and clean
cd Mobile-Expensify
Expand Down
6 changes: 2 additions & 4 deletions scripts/pod-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ fi

# See if we're in the HybridApp repo
IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app.sh)
NEW_DOT_FLAG="false"

if [ "$1" == "--new-dot" ]; then
NEW_DOT_FLAG="true"
fi
# See if we should force standalone NewDot build
NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"

if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then
echo -e "${BLUE}Executing npm run pod-install for HybridApp...${NC}"
Expand Down
6 changes: 5 additions & 1 deletion scripts/postInstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ cd "$ROOT_DIR" || exit 1
# See if we're in the HybridApp repo
IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app.sh)

if [[ "$IS_HYBRID_APP_REPO" == "true" ]]; then
# See if we should force standalone NewDot build
NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"

if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then
echo -e "\n${GREEN}Installing node modules in Mobile-Expensify submodule!${NC}"
cd Mobile-Expensify || exit 1
npm i

Expand Down
23 changes: 7 additions & 16 deletions scripts/run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ set -e

export PROJECT_ROOT_PATH

BUILD="$1"
NEW_DOT_FLAG="false"
IOS_MODE="DebugDevelopment"
ANDROID_MODE="developmentDebug"
SCHEME="New Expensify Dev"
Expand All @@ -20,26 +18,19 @@ function print_error_and_exit {
exit 1
}

# Assign the arguments to variables
if [ "$#" -eq 1 ]; then
BUILD="$1"
elif [ "$#" -eq 2 ]; then
if [ "$1" == "--new-dot" ]; then
BUILD="$2"
NEW_DOT_FLAG="true"
elif [ "$2" == "--new-dot" ]; then
BUILD="$1"
NEW_DOT_FLAG="true"
else
print_error_and_exit
fi
else
# Assign the arguments to variables if arguments are correct
if [ "$#" -ne 1 ] || [[ "$1" != "--ios" && "$1" != "--ipad" && "$1" != "--ipad-sm" && "$1" != "--android" ]]; then
print_error_and_exit
fi

BUILD="$1"

# See if we're in the HybridApp repo
IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app.sh)

# See if we should force standalone NewDot build
NEW_DOT_FLAG="${STANDALONE_NEW_DOT:-false}"

if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then
# Set HybridApp-specific arguments
IOS_MODE="Debug"
Expand Down

0 comments on commit 959db50

Please sign in to comment.