Skip to content

Commit

Permalink
fix: tweak the upgrade script for usage in workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Jan 8, 2024
1 parent 9cca980 commit a518120
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions upgrade-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
if [ "$1" == "" ] || [ "$1" == "--help" ]; then
echo "Available flags:"
echo "--help"
echo "--run-expo-upgrade - run yarn to add latest Expo and npx expo install --fix upgrade to update to latest SDK on all examples"
echo "--run-fix-dependencies - run npx expo install --fix on all repos"
echo "--upgrade-expo - run yarn to add latest Expo and npx expo install --fix upgrade to update to latest SDK on all examples"
echo "--fix-dependencies - run npx expo install --fix on all repos"
exit 0
fi

if [ "$1" == "--run-expo-upgrade" ]; then
if [ "$1" == "--upgrade-expo" ]; then
echo "Upgrading all projects to the latest SDK..."
echo "For each example, this will run `yarn` to add latest Expo and then run `npx expo install --fix`, accepting all defaults."
echo "Upgrade logs will be written to .sdk-upgrade-logs."
Expand All @@ -18,16 +18,16 @@ if [ "$1" == "--run-expo-upgrade" ]; then
DIRNAME=${d%/}
echo "Upgrading $DIRNAME..."
echo "• Run yarn"
(cd $DIRNAME && yarn --silent) # If yarn fails spectacularly, we'll see evidence in the logs for expo upgrade
(cd $DIRNAME && yarn install --silent) # If yarn fails spectacularly, we'll see evidence in the logs for expo upgrade
echo "• Run expo upgrade"
(cd $DIRNAME && yarn add expo@latest && npx expo install --fix > ../.sdk-upgrade-logs/$DIRNAME.txt)
(cd $DIRNAME && yarn add expo@latest && npx expo install --fix &> ../.sdk-upgrade-logs/$DIRNAME.txt)
done

# yarn workspaces has example(s) inside of app folder
echo "• Run expo upgrade on apps inside with-yarn-workspaces"
mkdir ./.sdk-upgrade-logs/with-yarn-workspaces
for d in with-yarn-workspaces/apps/*/ ; do
(cd $DIRNAME && yarn add expo@latest && npx expo install --fix > ../.sdk-upgrade-logs/with-yarn-workspaces/$DIRNAME.txt)
(cd $DIRNAME && yarn add expo@latest && npx expo install --fix &> ../.sdk-upgrade-logs/with-yarn-workspaces/$DIRNAME.txt)
done

echo "Upgrades complete! Check .sdk-upgrade-logs for results. Be sure to correct any errors or warnings."
Expand All @@ -37,24 +37,31 @@ if [ "$1" == "--run-expo-upgrade" ]; then
exit 0
fi

if [ "$1" == "--run-fix-dependencies" ]; then
if [ "$1" == "--fix-dependencies" ]; then
echo "Fixing dependencies on all examples..."

mkdir ./.sdk-upgrade-logs
for d in */ ; do
DIRNAME=${d%/}
echo "Fixing dependencies on $DIRNAME..."
(cd $DIRNAME && npx expo install --fix)
echo "• Run yarn"
(cd $DIRNAME && yarn install --silent) # If yarn fails spectacularly, we'll see evidence in the logs for expo upgrade
echo "• Run fix"
(cd $DIRNAME && npx expo install --fix &> ../.sdk-fix-logs/$DIRNAME.txt)
done

echo "Fixing dependencies on apps inside with-yarn-workspaces..."
mkdir ./.sdk-upgrade-logs/with-yarn-workspaces
for d in with-yarn-workspaces/apps/*/ ; do
(cd $DIRNAME && npx expo install --fix)
echo "• Fixing dependencies on apps inside with-yarn-workspaces"
echo "• Run yarn"
(cd $DIRNAME && yarn install --silent) # If yarn fails spectacularly, we'll see evidence in the logs for expo upgrade
echo "• Run fix"
(cd $DIRNAME && npx expo install --fix &> ../.sdk-fix-logs/with-yarn-workspaces/$DIRNAME.txt)
done

echo "Dependency fixes complete!"
exit 0
fi

echo "Error: flag not recognized"
echo "Error: flag not recognized"

0 comments on commit a518120

Please sign in to comment.