Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA][HybridApp] Add standalone installation scripts to NewDot repo #54190

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ At this point, the default behavior of some `npm` scripts will change to target
- `npm run pod-install` - install pods for HybridApp
- `npm run clean` - clean native code of HybridApp

If for some reason, you need to target the standalone NewDot application, you can append `*-standalone` to each of these scripts (eg. `npm run ios-standalone` will build NewDot instead of HybridApp).
If for some reason, you need to target the standalone NewDot application, you can append `*-standalone` to each of these scripts (eg. `npm run ios-standalone` will build NewDot instead of HybridApp). The same concept applies to the installation of standalone NewDot node modules. To skip the installation of HybridApp-specific patches and node modules, use `npm run i-standalone` or `npm run install-standalone`.

## Working with HybridApp
Day-to-day work with HybridApp shouldn't differ much from the work on the standalone NewDot repo.
Expand Down
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
Loading