Skip to content

Commit

Permalink
feat(nextjs): Add Next 13 to peer dependencies and integration tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed Oct 27, 2022
1 parent b2948e8 commit 8880fa1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
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
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

0 comments on commit 8880fa1

Please sign in to comment.