From 7ccc77b2e68dd8e1488aa301f01e154d9067337d Mon Sep 17 00:00:00 2001 From: Addy Pathania Date: Thu, 21 Sep 2023 13:07:24 -0400 Subject: [PATCH 1/2] upgrade nextjs --- .../src/templates/nextjs/package.json | 2 +- packages/sitecore-jss-nextjs/package.json | 4 +- yarn.lock | 195 ++++++++---------- 3 files changed, 92 insertions(+), 109 deletions(-) diff --git a/packages/create-sitecore-jss/src/templates/nextjs/package.json b/packages/create-sitecore-jss/src/templates/nextjs/package.json index 218672994f..7bb1c501cf 100644 --- a/packages/create-sitecore-jss/src/templates/nextjs/package.json +++ b/packages/create-sitecore-jss/src/templates/nextjs/package.json @@ -33,7 +33,7 @@ "@sitecore-jss/sitecore-jss-nextjs": "~21.4.0-canary", "graphql": "~15.8.0", "graphql-tag": "^2.12.6", - "next": "^13.1.6", + "next": "^13.4.16", "next-localization": "^0.12.0", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/sitecore-jss-nextjs/package.json b/packages/sitecore-jss-nextjs/package.json index 761ff787e7..284efa5f1e 100644 --- a/packages/sitecore-jss-nextjs/package.json +++ b/packages/sitecore-jss-nextjs/package.json @@ -54,7 +54,7 @@ "eslint-plugin-react": "^7.32.1", "jsdom": "^21.1.0", "mocha": "^10.2.0", - "next": "^13.1.6", + "next": "^13.4.16", "nock": "^13.3.0", "nyc": "^15.1.0", "react": "^18.2.0", @@ -65,7 +65,7 @@ "typescript": "~4.9.4" }, "peerDependencies": { - "next": "^13.1.6", + "next": "^13.4.16", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/yarn.lock b/yarn.lock index 8d1187f936..22d7431a50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5432,100 +5432,72 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:13.1.6": - version: 13.1.6 - resolution: "@next/env@npm:13.1.6" - checksum: 0f911a18f0b3372007632fffa87f5d7f802c00d07b3bf757d2d09574735ae43f60000ecdf64b6f06e195971c508c2bcee82dd1e3aab27a08a4300eb0317652bb +"@next/env@npm:13.5.2": + version: 13.5.2 + resolution: "@next/env@npm:13.5.2" + checksum: f6ef14b7643049dafc2d53b5091e3f74eed0af14743cfd61f1db7782a99e69b5bef63f36ba700034b23656a264c7ec498aac8fa4f9377dad01e544ffa507388f languageName: node linkType: hard -"@next/swc-android-arm-eabi@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-android-arm-eabi@npm:13.1.6" - conditions: os=android & cpu=arm - languageName: node - linkType: hard - -"@next/swc-android-arm64@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-android-arm64@npm:13.1.6" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - -"@next/swc-darwin-arm64@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-darwin-arm64@npm:13.1.6" +"@next/swc-darwin-arm64@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-darwin-arm64@npm:13.5.2" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-darwin-x64@npm:13.1.6" +"@next/swc-darwin-x64@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-darwin-x64@npm:13.5.2" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-freebsd-x64@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-freebsd-x64@npm:13.1.6" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - -"@next/swc-linux-arm-gnueabihf@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-linux-arm-gnueabihf@npm:13.1.6" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - -"@next/swc-linux-arm64-gnu@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-linux-arm64-gnu@npm:13.1.6" +"@next/swc-linux-arm64-gnu@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-linux-arm64-gnu@npm:13.5.2" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-linux-arm64-musl@npm:13.1.6" +"@next/swc-linux-arm64-musl@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-linux-arm64-musl@npm:13.5.2" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-linux-x64-gnu@npm:13.1.6" +"@next/swc-linux-x64-gnu@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-linux-x64-gnu@npm:13.5.2" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-linux-x64-musl@npm:13.1.6" +"@next/swc-linux-x64-musl@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-linux-x64-musl@npm:13.5.2" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-win32-arm64-msvc@npm:13.1.6" +"@next/swc-win32-arm64-msvc@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-win32-arm64-msvc@npm:13.5.2" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-win32-ia32-msvc@npm:13.1.6" +"@next/swc-win32-ia32-msvc@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-win32-ia32-msvc@npm:13.5.2" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:13.1.6": - version: 13.1.6 - resolution: "@next/swc-win32-x64-msvc@npm:13.1.6" +"@next/swc-win32-x64-msvc@npm:13.5.2": + version: 13.5.2 + resolution: "@next/swc-win32-x64-msvc@npm:13.5.2" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -6659,7 +6631,7 @@ __metadata: eslint-plugin-react: ^7.32.1 jsdom: ^21.1.0 mocha: ^10.2.0 - next: ^13.1.6 + next: ^13.4.16 nock: ^13.3.0 node-html-parser: ^6.1.4 nyc: ^15.1.0 @@ -6673,7 +6645,7 @@ __metadata: ts-node: ^10.9.1 typescript: ~4.9.4 peerDependencies: - next: ^13.1.6 + next: ^13.4.16 react: ^18.2.0 react-dom: ^18.2.0 languageName: unknown @@ -6920,12 +6892,12 @@ __metadata: languageName: node linkType: hard -"@swc/helpers@npm:0.4.14": - version: 0.4.14 - resolution: "@swc/helpers@npm:0.4.14" +"@swc/helpers@npm:0.5.2": + version: 0.5.2 + resolution: "@swc/helpers@npm:0.5.2" dependencies: tslib: ^2.4.0 - checksum: 273fd3f3fc461a92f3790cc551ea054745c6d6959afbe1232e6d7aa1c722bbc114d308aab96bef5c78fc0303c85c7b472ef00e2253251cc89737f3b1af56e5a5 + checksum: 51d7e3d8bd56818c49d6bfbd715f0dbeedc13cf723af41166e45c03e37f109336bbcb57a1f2020f4015957721aeb21e1a7fff281233d797ff7d3dd1f447fa258 languageName: node linkType: hard @@ -11121,6 +11093,15 @@ __metadata: languageName: node linkType: hard +"busboy@npm:1.6.0": + version: 1.6.0 + resolution: "busboy@npm:1.6.0" + dependencies: + streamsearch: ^1.1.0 + checksum: 32801e2c0164e12106bf236291a00795c3c4e4b709ae02132883fe8478ba2ae23743b11c5735a0aae8afe65ac4b6ca4568b91f0d9fed1fdbc32ede824a73746e + languageName: node + linkType: hard + "byte-size@npm:^7.0.0": version: 7.0.1 resolution: "byte-size@npm:7.0.1" @@ -21479,47 +21460,37 @@ __metadata: languageName: node linkType: hard -"next@npm:^13.1.6": - version: 13.1.6 - resolution: "next@npm:13.1.6" - dependencies: - "@next/env": 13.1.6 - "@next/swc-android-arm-eabi": 13.1.6 - "@next/swc-android-arm64": 13.1.6 - "@next/swc-darwin-arm64": 13.1.6 - "@next/swc-darwin-x64": 13.1.6 - "@next/swc-freebsd-x64": 13.1.6 - "@next/swc-linux-arm-gnueabihf": 13.1.6 - "@next/swc-linux-arm64-gnu": 13.1.6 - "@next/swc-linux-arm64-musl": 13.1.6 - "@next/swc-linux-x64-gnu": 13.1.6 - "@next/swc-linux-x64-musl": 13.1.6 - "@next/swc-win32-arm64-msvc": 13.1.6 - "@next/swc-win32-ia32-msvc": 13.1.6 - "@next/swc-win32-x64-msvc": 13.1.6 - "@swc/helpers": 0.4.14 +"next@npm:^13.4.16": + version: 13.5.2 + resolution: "next@npm:13.5.2" + dependencies: + "@next/env": 13.5.2 + "@next/swc-darwin-arm64": 13.5.2 + "@next/swc-darwin-x64": 13.5.2 + "@next/swc-linux-arm64-gnu": 13.5.2 + "@next/swc-linux-arm64-musl": 13.5.2 + "@next/swc-linux-x64-gnu": 13.5.2 + "@next/swc-linux-x64-musl": 13.5.2 + "@next/swc-win32-arm64-msvc": 13.5.2 + "@next/swc-win32-ia32-msvc": 13.5.2 + "@next/swc-win32-x64-msvc": 13.5.2 + "@swc/helpers": 0.5.2 + busboy: 1.6.0 caniuse-lite: ^1.0.30001406 postcss: 8.4.14 styled-jsx: 5.1.1 + watchpack: 2.4.0 + zod: 3.21.4 peerDependencies: - fibers: ">= 3.1.0" - node-sass: ^6.0.0 || ^7.0.0 + "@opentelemetry/api": ^1.1.0 react: ^18.2.0 react-dom: ^18.2.0 sass: ^1.3.0 dependenciesMeta: - "@next/swc-android-arm-eabi": - optional: true - "@next/swc-android-arm64": - optional: true "@next/swc-darwin-arm64": optional: true "@next/swc-darwin-x64": optional: true - "@next/swc-freebsd-x64": - optional: true - "@next/swc-linux-arm-gnueabihf": - optional: true "@next/swc-linux-arm64-gnu": optional: true "@next/swc-linux-arm64-musl": @@ -21535,15 +21506,13 @@ __metadata: "@next/swc-win32-x64-msvc": optional: true peerDependenciesMeta: - fibers: - optional: true - node-sass: + "@opentelemetry/api": optional: true sass: optional: true bin: next: dist/bin/next - checksum: 584977e382bd826c21e7fc5f67bca50e4d95741a854b1686394d45331404479c7266569671227421975fc18e5cf70769a4ad7edede7450d4497213205bba77c8 + checksum: cc0635ad5aaab9fc1f4315b9506361b1abf1a12146542d6054b9434e2e892e967f19fbabd3f3763ba5e227306aa91627c1d73af089e9b853b84c74e20bb0be00 languageName: node linkType: hard @@ -26388,6 +26357,13 @@ __metadata: languageName: node linkType: hard +"streamsearch@npm:^1.1.0": + version: 1.1.0 + resolution: "streamsearch@npm:1.1.0" + checksum: 1cce16cea8405d7a233d32ca5e00a00169cc0e19fbc02aa839959985f267335d435c07f96e5e0edd0eadc6d39c98d5435fb5bbbdefc62c41834eadc5622ad942 + languageName: node + linkType: hard + "string-length@npm:^2.0.0": version: 2.0.0 resolution: "string-length@npm:2.0.0" @@ -28171,23 +28147,23 @@ __metadata: languageName: node linkType: hard -"watchpack@npm:^2.2.0": - version: 2.2.0 - resolution: "watchpack@npm:2.2.0" +"watchpack@npm:2.4.0, watchpack@npm:^2.4.0": + version: 2.4.0 + resolution: "watchpack@npm:2.4.0" dependencies: glob-to-regexp: ^0.4.1 graceful-fs: ^4.1.2 - checksum: e275f48fae29edee3195c51a8312b609581b9be5ce323d3102ffd082cb124f48d7a393ce05e4110239e4354379e04d78a97ceb26ae367746e7e218bf258135c8 + checksum: 23d4bc58634dbe13b86093e01c6a68d8096028b664ab7139d58f0c37d962d549a940e98f2f201cecdabd6f9c340338dc73ef8bf094a2249ef582f35183d1a131 languageName: node linkType: hard -"watchpack@npm:^2.4.0": - version: 2.4.0 - resolution: "watchpack@npm:2.4.0" +"watchpack@npm:^2.2.0": + version: 2.2.0 + resolution: "watchpack@npm:2.2.0" dependencies: glob-to-regexp: ^0.4.1 graceful-fs: ^4.1.2 - checksum: 23d4bc58634dbe13b86093e01c6a68d8096028b664ab7139d58f0c37d962d549a940e98f2f201cecdabd6f9c340338dc73ef8bf094a2249ef582f35183d1a131 + checksum: e275f48fae29edee3195c51a8312b609581b9be5ce323d3102ffd082cb124f48d7a393ce05e4110239e4354379e04d78a97ceb26ae367746e7e218bf258135c8 languageName: node linkType: hard @@ -29169,6 +29145,13 @@ __metadata: languageName: node linkType: hard +"zod@npm:3.21.4": + version: 3.21.4 + resolution: "zod@npm:3.21.4" + checksum: f185ba87342ff16f7a06686767c2b2a7af41110c7edf7c1974095d8db7a73792696bcb4a00853de0d2edeb34a5b2ea6a55871bc864227dace682a0a28de33e1f + languageName: node + linkType: hard + "zone.js@npm:~0.10.3": version: 0.10.3 resolution: "zone.js@npm:0.10.3" From d9724cdc9983dc91ee756c038f0565407efe5dcd Mon Sep 17 00:00:00 2001 From: Addy Pathania Date: Thu, 21 Sep 2023 14:10:19 -0400 Subject: [PATCH 2/2] fix test: update router-context import --- CHANGELOG.md | 1 + packages/sitecore-jss-nextjs/src/components/Link.test.tsx | 2 +- packages/sitecore-jss-nextjs/src/components/RichText.test.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a68f836c5..3e3ecf2c1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Our versioning strategy is as follows: * `[sitecore-jss-dev-tools]` `[templates/nextjs]` `[templates/react]` Introduce "components" configuration for ComponentBuilder ([#1598](https://github.com/Sitecore/jss/pull/1598)) * `[sitecore-jss-react]` `[sitecore-jss-nextjs]` Component level data fetching(SSR/SSG) for BYOC ([#1610](https://github.com/Sitecore/jss/pull/1610)) * `[sitecore-jss-nextjs]` Reduce the amount of Edge API calls during fetch getStaticPaths ([#1612](https://github.com/Sitecore/jss/pull/1612)) +* `[templates/nextjs]` `[sitecore-jss-nextjs]` Upgrade Nextjs to 13.4.16([#1616](https://github.com/Sitecore/jss/pull/1616)) ### 🧹 Chores diff --git a/packages/sitecore-jss-nextjs/src/components/Link.test.tsx b/packages/sitecore-jss-nextjs/src/components/Link.test.tsx index 7e9b3617d1..6a4acea4f4 100644 --- a/packages/sitecore-jss-nextjs/src/components/Link.test.tsx +++ b/packages/sitecore-jss-nextjs/src/components/Link.test.tsx @@ -4,7 +4,7 @@ import NextLink from 'next/link'; import { Link as ReactLink, LinkField } from '@sitecore-jss/sitecore-jss-react'; import { expect } from 'chai'; import { mount } from 'enzyme'; -import { RouterContext } from 'next/dist/shared/lib/router-context'; +import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime'; import { Link } from './Link'; import { spy } from 'sinon'; diff --git a/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx b/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx index ddf82777e5..611d872534 100644 --- a/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx +++ b/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx @@ -4,7 +4,7 @@ import { use, expect } from 'chai'; import { RichText as ReactRichText } from '@sitecore-jss/sitecore-jss-react'; import { NextRouter } from 'next/router'; import { mount } from 'enzyme'; -import { RouterContext } from 'next/dist/shared/lib/router-context'; +import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime'; import { RichText } from './RichText'; import { spy } from 'sinon'; import sinonChai from 'sinon-chai';