From c3b9ac5dd36e6bfc50d12abc1aed2dd0825e465c Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Wed, 26 Feb 2025 16:07:23 +0100 Subject: [PATCH 1/9] Remove set -e from the script --- scripts/is-hybrid-app.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index 32ca190ac8323..a624e6225d8bf 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -e if [[ ! -d Mobile-Expensify ]]; then echo false From 3e0c6cf39bac58b68b4d15ef5be3af57f2b00558 Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 12:32:47 +0100 Subject: [PATCH 2/9] Add jq check --- scripts/is-hybrid-app.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index a624e6225d8bf..1567379180829 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Check if jq is installed +if ! jq --version > /dev/null 2>&1; then + error 'jq is not installed. Please install jq and try again' + cleanupAndExit 1 +fi + if [[ ! -d Mobile-Expensify ]]; then echo false exit 0 From 706e890fdfda768feab72e7a588db808c4b23035 Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 13:45:52 +0100 Subject: [PATCH 3/9] Remove reference to function that is not defined --- scripts/is-hybrid-app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index 1567379180829..e67c087913037 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -3,7 +3,7 @@ # Check if jq is installed if ! jq --version > /dev/null 2>&1; then error 'jq is not installed. Please install jq and try again' - cleanupAndExit 1 + exit 1 fi if [[ ! -d Mobile-Expensify ]]; then From 300ebde5fc45203efbf5dab8dce697bad231ca81 Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:07:46 +0100 Subject: [PATCH 4/9] Handle incorrect package name explicitly --- scripts/is-hybrid-app.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index e67c087913037..83f09865ca544 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -22,6 +22,10 @@ if [[ -f package.json ]]; then if [[ "$package_name" == "mobile-expensify" ]]; then echo true exit 0 + else + echo "The package name is incorrect. It should be 'mobile-expensify'. Script will assume the standalone NewDot app." + echo false + exit 0 fi else echo "package.json not found in Mobile-Expensify" From 76eae08120e86a599b31ed8671863ee6981ac0e8 Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:16:50 +0100 Subject: [PATCH 5/9] Fix lint issues --- scripts/is-hybrid-app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index 83f09865ca544..b58c43a9e4c0b 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -10,7 +10,7 @@ if [[ ! -d Mobile-Expensify ]]; then echo false exit 0 else - cd Mobile-Expensify + cd Mobile-Expensify || exit 1 fi # Check if 'package.json' exists From cdca36f5e3f32c3e529579d7a102fd63e0ac318b Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:32:58 +0100 Subject: [PATCH 6/9] Change error to echo --- scripts/is-hybrid-app.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index b58c43a9e4c0b..161cb91685d96 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -1,8 +1,9 @@ #!/bin/bash + # Check if jq is installed -if ! jq --version > /dev/null 2>&1; then - error 'jq is not installed. Please install jq and try again' +if [[ -d Mobile-Expensify ]]; then + echo 'jq is not installed. Please install jq and try again' exit 1 fi From b6b2da702e493ff68808a481a700b5629872551a Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:38:12 +0100 Subject: [PATCH 7/9] Use Expensify shell utils --- scripts/is-hybrid-app.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index 161cb91685d96..db6d9908d9351 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -1,9 +1,10 @@ #!/bin/bash +source scripts/shellUtils.sh # Check if jq is installed if [[ -d Mobile-Expensify ]]; then - echo 'jq is not installed. Please install jq and try again' + error 'jq is not installed. Please install jq and try again' exit 1 fi From d74f7f3f9b5b82802144f4688c475ecffc828c0f Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:40:54 +0100 Subject: [PATCH 8/9] Fix typo --- scripts/is-hybrid-app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index db6d9908d9351..e9258c5a47cfe 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -3,7 +3,7 @@ source scripts/shellUtils.sh # Check if jq is installed -if [[ -d Mobile-Expensify ]]; then +if ! jq --version > /dev/null 2>&1; then error 'jq is not installed. Please install jq and try again' exit 1 fi From d704f7a8a45dd85e7b7280cb477f0ca2f60aa48f Mon Sep 17 00:00:00 2001 From: Mateusz Rajski Date: Thu, 27 Feb 2025 14:56:11 +0100 Subject: [PATCH 9/9] Redirect to stderr to make script more verbose in case of error --- scripts/is-hybrid-app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/is-hybrid-app.sh b/scripts/is-hybrid-app.sh index e9258c5a47cfe..0894a3aeaff90 100755 --- a/scripts/is-hybrid-app.sh +++ b/scripts/is-hybrid-app.sh @@ -4,7 +4,7 @@ source scripts/shellUtils.sh # Check if jq is installed if ! jq --version > /dev/null 2>&1; then - error 'jq is not installed. Please install jq and try again' + error 'jq is not installed. Please install jq and try again' >&2 exit 1 fi