Skip to content

Commit

Permalink
Merge pull request #2170 from City-of-Helsinki/hl-730-nextjs-12-v2
Browse files Browse the repository at this point in the history
HL-730 | Upgrade to NextJS v12
  • Loading branch information
sirtawast authored Aug 22, 2023
2 parents 0d46053 + 5e6c39b commit aa11ac6
Show file tree
Hide file tree
Showing 39 changed files with 1,093 additions and 1,601 deletions.
11 changes: 0 additions & 11 deletions frontend/babel.config.js

This file was deleted.

17 changes: 11 additions & 6 deletions frontend/benefit/applicant/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const sharedConfig = require('../../jest.config.js');
module.exports = {
const nextJest = require('next/jest');

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

const config = {
...sharedConfig,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.jest.json',
},
},
moduleNameMapper: {
[`^shared\/(.*)$`]: '<rootDir>/../../shared/src/$1',
[`^benefit-shared\/(.*)$`]: '<rootDir>../shared/src/$1',
Expand All @@ -20,4 +21,8 @@ module.exports = {
'<rootDir>/../../shared/src/server/next-server.js',
'<rootDir>/../../shared/src/test/',
],
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
};

module.exports = createJestConfig(config);
1 change: 0 additions & 1 deletion frontend/benefit/applicant/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
1 change: 0 additions & 1 deletion frontend/benefit/applicant/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ const { parsed: env } = require('dotenv').config({
module.exports = nextConfig({
i18n,
env,
poweredByHeader: false,
});
12 changes: 6 additions & 6 deletions frontend/benefit/applicant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test": "jest --passWithNoTests",
"test:staged": "yarn test --watchAll=false --findRelatedTests",
"test:coverage": "yarn test --verbose --coverage",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/newApplication/company.testcafe.ts",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/newApplication/company.testcafe.ts"
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/newApplication/company.testcafe.ts --experimental-proxyless",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/newApplication/company.testcafe.ts --experimental-proxyless"
},
"dependencies": {
"@frontend/shared": "*",
Expand All @@ -21,19 +21,19 @@
"@sentry/browser": "^7.16.0",
"@sentry/nextjs": "^7.16.0",
"axios": "^0.27.2",
"babel-plugin-import": "^1.13.3",
"babel-plugin-import": "^1.13.6",
"camelcase-keys": "^7.0.2",
"date-fns": "^2.24.0",
"dotenv": "^16.0.0",
"finnish-ssn": "^2.0.4",
"formik": "^2.2.9",
"hds-react": "^2.10.0",
"lodash": "^4.17.21",
"next": "^11.1.4",
"next": "^12.3.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^10.5.0",
"next-i18next": "^13.0.3",
"next-plugin-custom-babel-config": "^1.0.5",
"next-transpile-modules": "^9.0.0",
"next-transpile-modules": "^9.1.0",
"pdfjs-dist": "3.6.172",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/applicant/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
import { setAppLoaded } from 'benefit-shared/utils/common';
import { AppProps } from 'next/app';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { QueryClient, QueryClientProvider } from 'react-query';
import BackendAPIProvider from 'shared/backend-api/BackendAPIProvider';
import BaseApp from 'shared/components/app/BaseApp';
Expand Down
15 changes: 9 additions & 6 deletions frontend/benefit/handler/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const sharedConfig = require('../../jest.config.js');
module.exports = {
const nextJest = require('next/jest');

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

const config = {
...sharedConfig,
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.jest.json',
},
},
moduleNameMapper: {
[`^shared\/(.*)$`]: '<rootDir>/../../shared/src/$1',
[`^benefit-shared\/(.*)$`]: '<rootDir>../shared/src/$1',
Expand All @@ -21,3 +22,5 @@ module.exports = {
'<rootDir>/../../shared/src/test/',
],
};

module.exports = createJestConfig(config);
1 change: 0 additions & 1 deletion frontend/benefit/handler/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
12 changes: 6 additions & 6 deletions frontend/benefit/handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"test": "jest --passWithNoTests",
"test:staged": "yarn test --watchAll=false --findRelatedTests",
"test:coverage": "yarn test --verbose --coverage",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --disable-web-security --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/pages/",
"browser-test:ci": "testcafe 'chrome:headless --allow-insecure-localhost --disable-web-security --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/pages/"
"browser-test": "testcafe 'chrome --allow-insecure-localhost --disable-web-security --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/pages/ --experimental-proxyless",
"browser-test:ci": "testcafe 'chrome:headless --allow-insecure-localhost --disable-web-security --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/pages/ --experimental-proxyless"
},
"dependencies": {
"@frontend/benefit-shared": "*",
"@frontend/shared": "*",
"@sentry/browser": "^7.16.0",
"axios": "^0.27.2",
"babel-plugin-import": "^1.13.3",
"babel-plugin-import": "^1.13.6",
"camelcase-keys": "^7.0.2",
"date-fns": "^2.24.0",
"dotenv": "^16.0.0",
Expand All @@ -29,11 +29,11 @@
"fuse.js": "^6.6.2",
"hds-react": "^2.10.0",
"lodash": "^4.17.21",
"next": "^11.1.4",
"next": "^12.3.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^10.5.0",
"next-i18next": "^13.0.3",
"next-plugin-custom-babel-config": "^1.0.5",
"next-transpile-modules": "^9.0.0",
"next-transpile-modules": "^9.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-input-mask": "^2.0.4",
Expand Down
2 changes: 1 addition & 1 deletion frontend/benefit/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@frontend/shared": "*",
"camelcase-keys": "^7.0.1",
"hds-react": "^2.10.0",
"next": "^11.1.4",
"next": "^12.3.4",
"react": "^18.0.0",
"styled-components": "^5.3.3"
},
Expand Down
1 change: 0 additions & 1 deletion frontend/kesaseteli/employer/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
9 changes: 4 additions & 5 deletions frontend/kesaseteli/employer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"test:debug-dom": "cross-env DEBUG_PRINT_LIMIT=1000000 yarn test",
"test:staged": "yarn test --watchAll=false --findRelatedTests",
"test:coverage": "yarn test --verbose --coverage",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/",
"browser-test:wsl2win": "testcafe 'path:`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe` --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --live --dev browser-tests/"
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/ --experimental-proxyless",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/ --experimental-proxyless"
},
"dependencies": {
"@frontend/kesaseteli-shared": "*",
Expand All @@ -28,9 +27,9 @@
"hds-react": "^2.10.0",
"ibantools": "^4.1.5",
"lodash": "^4.17.21",
"next": "^11.1.4",
"next": "^12.3.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^10.5.0",
"next-i18next": "^13.0.3",
"next-plugin-custom-babel-config": "^1.0.5",
"next-transpile-modules": "^9.0.0",
"react": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion frontend/kesaseteli/handler/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
10 changes: 5 additions & 5 deletions frontend/kesaseteli/handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"test:debug-dom": "cross-env DEBUG_PRINT_LIMIT=1000000 yarn test",
"test:staged": "yarn test --watchAll=false --findRelatedTests",
"test:coverage": "yarn test:debug-dom --verbose --coverage",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/"
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/ --experimental-proxyless",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/ --experimental-proxyless"
},
"dependencies": {
"@frontend/kesaseteli-shared": "*",
Expand All @@ -27,11 +27,11 @@
"finnish-ssn": "^2.0.4",
"hds-react": "^2.10.0",
"lodash": "^4.17.21",
"next": "^11.1.4",
"next": "^12.3.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^10.5.0",
"next-i18next": "^13.0.3",
"next-plugin-custom-babel-config": "^1.0.5",
"next-transpile-modules": "^9.0.0",
"next-transpile-modules": "^9.1.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-hook-form": "^7.30.0",
Expand Down
1 change: 0 additions & 1 deletion frontend/kesaseteli/youth/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
8 changes: 4 additions & 4 deletions frontend/kesaseteli/youth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"test:debug-dom": "cross-env DEBUG_PRINT_LIMIT=1000000 yarn test",
"test:staged": "yarn test --watchAll=false --findRelatedTests",
"test:coverage": "yarn test:debug-dom --verbose --coverage",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/",
"browser-test": "testcafe 'chrome --allow-insecure-localhost --ignore-certificate-errors --ignore-urlfetcher-cert-requests --window-size=\"1249,720\"' browser-tests/ --experimental-proxyless",
"browser-test:ci": "testcafe 'chrome:headless --disable-gpu --window-size=\"1249,720\" --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/ --experimental-proxyless",
"browser-test:wsl2win": "testcafe 'path:`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe` --ignore-certificate-errors-spki-list=\"8sg/cl7YabrOFqSqH+Bu0e+P27Av33gWgi8Lq28DW1I=,gJt+wt/T3afCRkxtMMSjXcl/99sgzWc2kk1c1PC9tG0=,zrQI2/1q8i2SRPmMZ1sMntIkG+lMW0legPFokDo3nrY=\"' --live --dev --screenshots path=report --video report --reporter spec,custom,html:report/index.html browser-tests/"
},
"dependencies": {
Expand All @@ -28,9 +28,9 @@
"finnish-ssn": "^2.0.4",
"hds-react": "^2.10.0",
"lodash": "^4.17.21",
"next": "^11.1.4",
"next": "^12.3.4",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^10.5.0",
"next-i18next": "^13.0.3",
"next-plugin-custom-babel-config": "^1.0.5",
"next-transpile-modules": "^9.0.0",
"react": "^18.0.0",
Expand Down
Loading

0 comments on commit aa11ac6

Please sign in to comment.