From deb1ce83a76ab0141640c7645932c5ff56ac3493 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 4 Oct 2024 10:51:24 +0200 Subject: [PATCH] Add better logging, and fix clean build --- package.json | 2 +- scripts/clean.sh | 7 ++++++- scripts/pod-install.sh | 7 +++++++ scripts/postInstall.sh | 5 ++++- scripts/preinstall.sh | 5 ++++- scripts/pull-old-dot.sh | 5 ++++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7051fb2f083f..3a1e3c24ec96 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "startAndroidEmulator": "./scripts/start-android.sh", "preinstall": "./scripts/preinstall.sh", "postinstall": "./scripts/postInstall.sh", - "clean": "npx react-native clean-project-auto", + "clean": "./scripts/clean.sh", "android": "./scripts/set-pusher-suffix.sh && scripts/run-build.sh --android", "ios": "./scripts/set-pusher-suffix.sh && scripts/run-build.sh --ios", "pod-install": "./scripts/pod-install.sh", diff --git a/scripts/clean.sh b/scripts/clean.sh index 4973f7bfad4a..e0b503224108 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -1,17 +1,22 @@ #!/bin/bash set -e +BLUE='\033[1;34m' +NC='\033[0m' + ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 # See if we're in the HybridApp repo IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app-repo.sh) -if [[ "$IS_HYBRID_APP_REPO" == "true" && "$1" != "--new-dot" ]]; then +if [[ "$IS_HYBRID_APP_REPO" != "true" && "$1" != "--new-dot" ]]; then + echo -e "${BLUE}Cleaning HybridApp project...${NC}" # Navigate to the OldDot repository, and clean cd .. npm run clean else # Clean NewDot + echo -e "${BLUE}Cleaning standalone NewDot project...${NC}" npx react-native clean-project-auto fi diff --git a/scripts/pod-install.sh b/scripts/pod-install.sh index ebb7c6ca8342..a436a547e98f 100755 --- a/scripts/pod-install.sh +++ b/scripts/pod-install.sh @@ -8,6 +8,9 @@ # Exit immediately if any command exits with a non-zero status set -e +BLUE='\033[1;34m' +NC='\033[0m' + # Go to NewDot project root START_DIR="$(pwd)" ROOT_DIR="$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)")" @@ -28,6 +31,7 @@ done if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then + echo -e "${BLUE}Executing npm run pod-install for HybridApp...${NC}" cd ../ios if [ "$SHOULD_CLEAN" == "true" ]; then bundle exec pod deintegrate @@ -37,6 +41,9 @@ if [[ "$IS_HYBRID_APP_REPO" == "true" && "$NEW_DOT_FLAG" == "false" ]]; then exit 0 fi +echo -e "${BLUE}Executing npm run pod-install for standalone NewDot...${NC}" + + # Cleanup and exit # param - status code function cleanupAndExit { diff --git a/scripts/postInstall.sh b/scripts/postInstall.sh index 818143199a12..ff8d00256711 100755 --- a/scripts/postInstall.sh +++ b/scripts/postInstall.sh @@ -3,6 +3,9 @@ # Exit immediately if any command exits with a non-zero status set -e +BLUE='\033[1;34m' +NC='\033[0m' + # Go to NewDot project root ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 @@ -13,7 +16,7 @@ scripts/applyPatches.sh IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app-repo.sh) if [[ "$IS_HYBRID_APP_REPO" == "true" ]]; then - echo "Applying patches to OldDot..." + echo -e "${BLUE}Applying patches to OldDot...${NC}" # Apply HybridApp-specific patches to NewDot npx patch-package --patch-dir '../patches/new-dot' diff --git a/scripts/preinstall.sh b/scripts/preinstall.sh index a9de3cb48124..2a5b220f5f61 100755 --- a/scripts/preinstall.sh +++ b/scripts/preinstall.sh @@ -1,6 +1,9 @@ #!/bin/bash set -e +BLUE='\033[1;34m' +NC='\033[0m' + # Go to NewDot project root ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 @@ -9,7 +12,7 @@ cd "$ROOT_DIR" || exit 1 IS_HYBRID_APP_REPO=$(scripts/is-hybrid-app-repo.sh) if [[ "$IS_HYBRID_APP_REPO" == "true" ]]; then - echo "We're in HybridApp. Executing npm install." + echo "${BLUE}We're in HybridApp. Executing npm install for OldDot.${NC}" # Navigate to the OldDot repository cd .. diff --git a/scripts/pull-old-dot.sh b/scripts/pull-old-dot.sh index c24e2793f72f..286dec2c8969 100755 --- a/scripts/pull-old-dot.sh +++ b/scripts/pull-old-dot.sh @@ -1,6 +1,9 @@ #!/bin/bash set -e +YELLOW='\033[1;33m' +NC='\033[0m' + # Go to NewDot project root ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)") cd "$ROOT_DIR" || exit 1 @@ -18,5 +21,5 @@ if [[ "$IS_HYBRID_APP_REPO" == "true" ]]; then git pull npm i else - echo "We're in standalone NewDot. Nothing to pull" + echo -e "${YELLOW}[WARNING] We're not in Mobile-Expensify repo, nothing to pull. Are you sure you should be here?${NC}" fi