Skip to content

Commit 036e2a0

Browse files
authored
ref(nextjs): Update vercel testing script (#5738)
This is a small refactor to our `set-up-branch-for-test-app-use.sh` vercel script, which prepares the current branch to be tested on vercel by deleting packages unrelated to the nextjs SDK, thereby speeding up the vercel build. The only consequential change is a switch from specifying which packages should get deleted to specifying which packages shouldn't. (The list of deletion targets kept falling out of date, each time we added a new package. With this change, it should in theory be evergreen.)
1 parent a9e78b7 commit 036e2a0

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

packages/nextjs/vercel/set-up-branch-for-test-app-use.sh

+23-13
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,41 @@
44

55
echo " "
66

7-
NEXTJS_SDK_DIR=$(pwd)
7+
# This puts us in the packages directory
8+
cd ..
89

9-
# this puts us in the repo root
10-
cd ../..
11-
12-
# make sure we're dealing with a clean SDK repo
10+
# Make sure we're dealing with a clean SDK repo
1311
STASHED_CHANGES=$(git status --porcelain)
1412
if [ -n "${STASHED_CHANGES}" ]; then
1513
echo "Found uncommitted changes. Stashing them."
1614
git stash --quiet --include-untracked
1715
fi
1816

19-
# if this hasn't already been done, get rid of irrelevant packages to speed up deploy process
17+
# If this hasn't already been done, get rid of irrelevant packages to speed up deploy process
2018
PACKAGES_DELETED=false
21-
for package in "angular" "ember" "eslint-config-sdk" "eslint-plugin-sdk" "gatsby" "serverless" "vue" "wasm"; do
22-
if [ -d packages/${package} ]; then
19+
for package in *; do
20+
# Delete all packages which aren't either runtime or dev dependencies of the nextjs SDK
21+
case $package in
22+
# Runtime depependencies
23+
"nextjs" | "core" | "hub" | "browser" | "node" | "react" | "tracing" | "utils" | "integrations")
24+
continue
25+
;;
26+
# Dev dependencies
27+
"eslint-config-sdk" | "eslint-plugin-sdk" | "types" | "typescript")
28+
continue
29+
;;
30+
# Everything else
31+
*)
2332
echo "Deleting ${package}"
24-
rm -rf packages/${package}
33+
rm -rf ${package}
2534
PACKAGES_DELETED=true
26-
fi
35+
;;
36+
esac
2737
done
2838

2939
echo " "
3040

31-
# if we deleted anything, commit the result
41+
# If we deleted anything, commit the result
3242
if [ "$PACKAGES_DELETED" = true ]; then
3343
echo "Committing deletions. Don't forget to push this commit before you deploy."
3444
git add .
@@ -37,7 +47,7 @@ else
3747
echo "Branch already set up for vercel deployment"
3848
fi
3949

40-
# restore working directory, if necessary
50+
# Restore working directory, if necessary
4151
if [ -n "${STASHED_CHANGES}" ]; then
4252
echo " "
4353
echo "Restoring changes from earlier stash:"
@@ -46,4 +56,4 @@ if [ -n "${STASHED_CHANGES}" ]; then
4656
echo " "
4757
fi
4858

49-
cd $NEXTJS_SDK_DIR
59+
cd nextjs

0 commit comments

Comments
 (0)