Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nextjs): Add Next 13 to peer dependencies and integration tests #6042

Merged
merged 3 commits into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nextjs/package.json
Expand Up @@ -37,7 +37,7 @@
"next": "10.1.3"
},
"peerDependencies": {
"next": "^10.0.8 || ^11.0 || ^12.0",
"next": "^10.0.8 || ^11.0 || ^12.0 || ^13.0",
"react": "15.x || 16.x || 17.x || 18.x",
"webpack": ">= 4.0.0"
},
Expand Down
21 changes: 16 additions & 5 deletions packages/nextjs/test/run-integration-tests.sh
Expand Up @@ -30,7 +30,7 @@ echo "Running integration tests on Node $NODE_VERSION"
# make a backup of our config file so we can restore it when we're done
mv next.config.js next.config.js.bak

for NEXTJS_VERSION in 10 11 12; do
for NEXTJS_VERSION in 10 11 12 13; do

# export this to the env so that we can behave differently depending on which version of next we're testing, without
# having to pass this value from function to function to function to the one spot, deep in some callstack, where we
Expand All @@ -44,8 +44,14 @@ for NEXTJS_VERSION in 10 11 12; do
fi

# Next.js v11 requires at least Node v12
if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -eq "11" ]; then
echo "[nextjs$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR"
if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -ge "11" ]; then
echo "[nextjs@$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR"
exit 0
fi

# Next.js v13 requires at least Node v14
if [ "$NODE_MAJOR" -lt "14" ] && [ "$NEXTJS_VERSION" -ge "13" ]; then
echo "[nextjs@$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR"
exit 0
fi

Expand All @@ -61,6 +67,11 @@ for NEXTJS_VERSION in 10 11 12; do
else
sed -i /"next.*latest"/s/latest/"${NEXTJS_VERSION}.x"/ package.json
fi

# Next.js v13 requires React 18.2.0
if [ "$NEXTJS_VERSION" -eq "13" ]; then
npm i --save react@18.2.0 react-dom@18.2.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this maybe use yarn instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I tried running the full test suite with react 18.2.0 and it works fine, even for Next 10, so rather than doing it here, let's just change package.json and use that version for everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured that you want to make sure it also still works with older versions of react, hence the package update. If you think that's not necessary I'll update the default version to 18.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO let's stick with the older versions, especially to get this in so we can release. We can re-evaluate bumping the overall version later on.

fi
# We have to use `--ignore-engines` because sucrase claims to need Node 12, even though tests pass just fine on Node
# 10
yarn --no-lockfile --ignore-engines --silent >/dev/null 2>&1
Expand All @@ -84,11 +95,11 @@ for NEXTJS_VERSION in 10 11 12; do
# https://github.com/webpack/webpack/issues/14532#issuecomment-947513562
# Context: https://github.com/vercel/next.js/issues/30078#issuecomment-947338268
if [ "$NODE_MAJOR" -gt "17" ] && [ "$WEBPACK_VERSION" -eq "4" ]; then
echo "[nextjs$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION"
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION"
exit 0
fi
if [ "$NODE_MAJOR" -gt "17" ] && [ "$NEXTJS_VERSION" -eq "10" ]; then
echo "[nextjs$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION"
echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION"
exit 0
fi

Expand Down