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

fix(deps): update dependency next to v14 #1177

Merged
merged 2 commits into from
Jan 20, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig.json');
const nextJest = require('next/jest');

/** @type {import('ts-jest').InitialOptionsTsJest} */
const createJestConfig = nextJest({
dir: './',
});

// Custom `moduleNameMapper` configuration
const paths = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
});

/** @type {import('ts-jest').JestConfigWithTsJest} */
const customJestConfig = {
collectCoverage: true,
coverageDirectory: 'coverage',
Expand All @@ -24,36 +33,12 @@ const customJestConfig = {
'!**/Header.tsx',
],
moduleDirectories: ['node_modules', '<rootDir>/'],
moduleNameMapper: {
...paths,
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['/cypress/'],
};

const createJestConfig = nextJest({
dir: './',
})(customJestConfig);

module.exports = async () => {
// Create Next.js jest configuration presets
const jestConfig = await createJestConfig();

// Custom `moduleNameMapper` configuration
const paths = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
});
const moduleNameMapper = {
...jestConfig.moduleNameMapper,
...paths,
};

// Custom `transformIgnorePatterns` configuration
const transformIgnorePatterns = [
// Transform ESM-only modules in `node_modules`.
'/node_modules/(?!next-mdx-remote|@mdx-js|@react-hook)',
...jestConfig.transformIgnorePatterns.filter(
pattern => pattern !== '/node_modules/'
),
];

return { ...jestConfig, moduleNameMapper, transformIgnorePatterns };
};
module.exports = createJestConfig(customJestConfig);
11 changes: 11 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ const nextConfig = {
},
reactStrictMode: true,
swcMinify: isProduction,
transpilePackages: [
// @see https://github.com/vercel/next.js/issues/40183
// @see https://github.com/vercel/next.js/issues/58817
'@ant-design',
'@mdx-js',
'@react-hook',
'next-mdx-remote',
'rc-pagination',
'rc-picker',
'rc-util',
],
};

module.exports = NextPwa(nextConfig);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"framer-motion": "^10.18.0",
"gray-matter": "^4.0.3",
"katex": "^0.16.9",
"next": "^13.5.6",
"next": "^14.1.0",
"next-mdx-remote": "^4.4.1",
"next-progress": "^2.3.1",
"next-pwa": "^5.6.0",
Expand Down
111 changes: 59 additions & 52 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,14 @@ __metadata:
languageName: node
linkType: hard

"@next/env@npm:13.5.6, @next/env@npm:^13.4.3":
"@next/env@npm:14.1.0":
version: 14.1.0
resolution: "@next/env@npm:14.1.0"
checksum: f45ce1e3dad87cdbddc58b06bd411f44a6d21dfc2c344d02a5e1b07f56fbc9a39e192c0b0917df9f2e9e4e2156306a8c78f173ca4b53932c2793e67797462a23
languageName: node
linkType: hard

"@next/env@npm:^13.4.3":
version: 13.5.6
resolution: "@next/env@npm:13.5.6"
checksum: b1fefa21b698397a2f922ee53a5ecb91ff858f042b2a198652b9de49c031fc5e00d79da92ba7d84ef205e95368d5afbb0f104abaf00e9dde7985d9eae63bb4fb
Expand All @@ -2670,65 +2677,65 @@ __metadata:
languageName: node
linkType: hard

"@next/swc-darwin-arm64@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-darwin-arm64@npm:13.5.6"
"@next/swc-darwin-arm64@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-darwin-arm64@npm:14.1.0"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@next/swc-darwin-x64@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-darwin-x64@npm:13.5.6"
"@next/swc-darwin-x64@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-darwin-x64@npm:14.1.0"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@next/swc-linux-arm64-gnu@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-linux-arm64-gnu@npm:13.5.6"
"@next/swc-linux-arm64-gnu@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-linux-arm64-gnu@npm:14.1.0"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-arm64-musl@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-linux-arm64-musl@npm:13.5.6"
"@next/swc-linux-arm64-musl@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-linux-arm64-musl@npm:14.1.0"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard

"@next/swc-linux-x64-gnu@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-linux-x64-gnu@npm:13.5.6"
"@next/swc-linux-x64-gnu@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-linux-x64-gnu@npm:14.1.0"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-x64-musl@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-linux-x64-musl@npm:13.5.6"
"@next/swc-linux-x64-musl@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-linux-x64-musl@npm:14.1.0"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard

"@next/swc-win32-arm64-msvc@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-win32-arm64-msvc@npm:13.5.6"
"@next/swc-win32-arm64-msvc@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-win32-arm64-msvc@npm:14.1.0"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@next/swc-win32-ia32-msvc@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-win32-ia32-msvc@npm:13.5.6"
"@next/swc-win32-ia32-msvc@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-win32-ia32-msvc@npm:14.1.0"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard

"@next/swc-win32-x64-msvc@npm:13.5.6":
version: 13.5.6
resolution: "@next/swc-win32-x64-msvc@npm:13.5.6"
"@next/swc-win32-x64-msvc@npm:14.1.0":
version: 14.1.0
resolution: "@next/swc-win32-x64-msvc@npm:14.1.0"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand Down Expand Up @@ -3137,7 +3144,7 @@ __metadata:
jest-axe: "npm:^8.0.0"
jest-environment-jsdom: "npm:^29.7.0"
katex: "npm:^0.16.9"
next: "npm:^13.5.6"
next: "npm:^14.1.0"
next-mdx-remote: "npm:^4.4.1"
next-progress: "npm:^2.3.1"
next-pwa: "npm:^5.6.0"
Expand Down Expand Up @@ -4991,10 +4998,10 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001406, caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001565":
version: 1.0.30001571
resolution: "caniuse-lite@npm:1.0.30001571"
checksum: 632f476e39febbfb5dc91c236981f3d518dc0cf55c42cc2bba431a6b6f4cceae3f9cd74d26312f30e9de65a3cc92ccf80d964ba8de061e25f37b7f0518303dad
"caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001565, caniuse-lite@npm:^1.0.30001579":
version: 1.0.30001579
resolution: "caniuse-lite@npm:1.0.30001579"
checksum: 4003970f8d01a5fa314e39f4a21751dc750a530f3d19aed225e18e8e02892b590b8b0debfa0961eae9bc0e49b77bfb17cf30d2469540e428a8305e3cc9164fb8
languageName: node
linkType: hard

Expand Down Expand Up @@ -7985,7 +7992,7 @@ __metadata:
languageName: node
linkType: hard

"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
version: 4.2.11
resolution: "graceful-fs@npm:4.2.11"
checksum: 386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2
Expand Down Expand Up @@ -11576,26 +11583,26 @@ __metadata:
languageName: node
linkType: hard

"next@npm:^13.5.6":
version: 13.5.6
resolution: "next@npm:13.5.6"
dependencies:
"@next/env": "npm:13.5.6"
"@next/swc-darwin-arm64": "npm:13.5.6"
"@next/swc-darwin-x64": "npm:13.5.6"
"@next/swc-linux-arm64-gnu": "npm:13.5.6"
"@next/swc-linux-arm64-musl": "npm:13.5.6"
"@next/swc-linux-x64-gnu": "npm:13.5.6"
"@next/swc-linux-x64-musl": "npm:13.5.6"
"@next/swc-win32-arm64-msvc": "npm:13.5.6"
"@next/swc-win32-ia32-msvc": "npm:13.5.6"
"@next/swc-win32-x64-msvc": "npm:13.5.6"
"next@npm:^14.1.0":
version: 14.1.0
resolution: "next@npm:14.1.0"
dependencies:
"@next/env": "npm:14.1.0"
"@next/swc-darwin-arm64": "npm:14.1.0"
"@next/swc-darwin-x64": "npm:14.1.0"
"@next/swc-linux-arm64-gnu": "npm:14.1.0"
"@next/swc-linux-arm64-musl": "npm:14.1.0"
"@next/swc-linux-x64-gnu": "npm:14.1.0"
"@next/swc-linux-x64-musl": "npm:14.1.0"
"@next/swc-win32-arm64-msvc": "npm:14.1.0"
"@next/swc-win32-ia32-msvc": "npm:14.1.0"
"@next/swc-win32-x64-msvc": "npm:14.1.0"
"@swc/helpers": "npm:0.5.2"
busboy: "npm:1.6.0"
caniuse-lite: "npm:^1.0.30001406"
caniuse-lite: "npm:^1.0.30001579"
graceful-fs: "npm:^4.2.11"
postcss: "npm:8.4.31"
styled-jsx: "npm:5.1.1"
watchpack: "npm:2.4.0"
peerDependencies:
"@opentelemetry/api": ^1.1.0
react: ^18.2.0
Expand Down Expand Up @@ -11627,7 +11634,7 @@ __metadata:
optional: true
bin:
next: dist/bin/next
checksum: ef141d7708a432aff8bf080d285c466a83b0c1d008d1c66bbd49652a598f9ac15ef2e69a045f21ba44a5543b595cb945468b5f33e25deae2cc48b4d32be5bcec
checksum: dbb1ef8d22eec29a9127d28ed46eb34f14e3f7f7b4e4b91dc96027feb4d9ead554a804275484d9a54026e6e55d632d3997561e598c1fb8e8956e77614f39765f
languageName: node
linkType: hard

Expand Down Expand Up @@ -16429,7 +16436,7 @@ __metadata:
languageName: node
linkType: hard

"watchpack@npm:2.4.0, watchpack@npm:^2.4.0":
"watchpack@npm:^2.4.0":
version: 2.4.0
resolution: "watchpack@npm:2.4.0"
dependencies:
Expand Down