Skip to content

Commit

Permalink
Add better logging, and fix clean build
Browse files Browse the repository at this point in the history
  • Loading branch information
staszekscp committed Oct 4, 2024
1 parent daa0ad6 commit deb1ce8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions scripts/pod-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")"
Expand All @@ -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
Expand All @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion scripts/postInstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion scripts/preinstall.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ..
Expand Down
5 changes: 4 additions & 1 deletion scripts/pull-old-dot.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit deb1ce8

Please sign in to comment.