Skip to content

Commit e44bc63

Browse files
authored
ref(nextjs): Clarify instructions for testing an SDK branch on Vercel (#3645)
1 parent c0089b5 commit e44bc63

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed
+24-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
### To prepare branch for deploying on Vercel:
1+
# Testing an SDK Branch on Vercel
2+
3+
Follow the instructions below to test a branch of the SDK against a test app deployed to Vercel. This assumes you
4+
already have such an app set up, and modifies both it and the SDK branch such that the dependency installation process
5+
run on Vercel includes cloning the repo, building the current branch of the SDK, and setting the test app's
6+
`@sentry/next` dependency to point to the newly-built local version.
7+
8+
(The clone-build-link step is necessary because you can't point a `package.json` dependency to a sub-folder of a git
9+
repo, only a full repo itself. Since we run a monorepo, this won't work in our case.)
10+
11+
### To prepare your SDK branch for deploying on Vercel
212

313
From `packages/nextjs`, run
414

@@ -7,7 +17,7 @@ From `packages/nextjs`, run
717
This will delete unneeded packages (angular, vue, etc) in order to speed up deployment. It will then commit that change.
818
When your branch is ready to PR, just rebase and drop that commit.
919

10-
### To prepare test app for using current branch:
20+
### To prepare your test app for using current SDK branch
1121

1222
First, make sure the branch you want to test is checked out in your `sentry-javascript` repo, and that all changes you
1323
want to test are pushed to GitHub.
@@ -16,9 +26,10 @@ From `packages/nextjs`, run
1626

1727
`yarn vercel:project <path/to/testapp>`.
1828

19-
This will copy a script into a `.sentry` folder at the root level of your test app,and create a second one. (The first
20-
script is the one you'll run on Vercel. The second is a helper to the first, so that it knows which branch to use.) It
21-
will then commit (but not push) this change.
29+
This will copy the `install-sentry-from-branch.sh` script into a `.sentry` folder at the root level of your test app,
30+
and create a `set-branch-name.sh` script in the same location. (The first script is the one you'll run on Vercel. The
31+
second is called by the first, and just sets an environment variable with the current (SDK) branch name.) It will then
32+
commit (but not push) this change.
2233

2334
Go into your project settings on Vercel and change the install command to
2435

@@ -30,9 +41,12 @@ If you're using bundle analyzer, change the build command to
3041

3142
The bundle visualizations will be available on your deployed site at `/client.html` and `/server.html`.
3243

33-
### To test the SDK:
44+
NOTE: You don't need to change the `@sentry/nextjs` dependency in your project's `package.json` file. That will happen
45+
on the fly each time your app is deployed.
46+
47+
### To test the SDK
3448

35-
Once you have pushed the changes made by `yarn vercel:project` to GitHub, just make changes and push, and Vercel will
36-
always use the latest version of both the SDK and your test app. Pushing changes to your test app will trigger a new
37-
build in Vercel; for changes to the SDK, you'll need to manually redeploy, either by kicking off a new build or simply
38-
choosing 'Redeploy' on your most recent existing build.
49+
Once you have pushed the changes made by `yarn vercel:project` to GitHub, just make changes (either to the SDK or your
50+
test app) and push them. Vercel will always use the latest version of both the SDK and your test app each time it
51+
deploys. Pushing changes to your test app will trigger a new build in Vercel; for changes to the SDK, you'll need to
52+
manually redeploy, either by kicking off a new build or simply choosing 'Redeploy' on your most recent existing build.

packages/nextjs/vercel/make-project-use-current-branch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ yarn vercel:branch
1919

2020
cd $PROJECT_DIR
2121

22-
# make sure we're dealing with a clean repo
22+
# make sure we're dealing with a clean test app repo
2323
STASHED_CHANGES=$(git status --porcelain)
2424
if [ -n "${STASHED_CHANGES}" ]; then
2525
echo "Found uncommitted changes in your project. Stashing them."

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ NEXTJS_SDK_DIR=$(pwd)
99
# this puts us in the repo root
1010
cd ../..
1111

12-
# make sure we're dealing with a clean repo
12+
# make sure we're dealing with a clean SDK repo
1313
STASHED_CHANGES=$(git status --porcelain)
1414
if [ -n "${STASHED_CHANGES}" ]; then
1515
echo "Found uncommitted changes. Stashing them."

0 commit comments

Comments
 (0)