Skip to content

Commit 09d1b39

Browse files
committed
feat: upgrade nextjs to v15
LIIKUNTA-768. Upgrade using NextJS v15 with React 18 (by using codemod tools). It should be noted that this is not a well supported or adviced combination by NextJS. There is no clear statement for supporting it -- only opposite. See more: 1. A blog post that suggests that there should be no issues: https://nextjs.org/blog/next-15#pages-router-on-react-18. 2. An official documentation and migration guide, that clearly states that React v19 should be used: https://nextjs.org/docs/15/app/guides/upgrading/version-15#react-19. 3. 3rd party blog that says it's okay to use React v18 with Pages router: https://www.wisp.blog/blog/can-nextjs-15-app-router-be-used-with-react-18. 4. Yet another page in docs that states that it's okay to use React v18, even with NextJS v16: https://nextjs.org/docs/messages/react-version. NOTE: The codemod fails when it was ran. No matter what is chosen for React v18, it is still upgraded. Similar experiments here: https://www.reddit.com/r/nextjs/comments/1gpb104/comment/lxw60lj/. ---- Step 1: Upgrade the NextJS framework by using a codemod tool `npx @next/codemod@canary upgrade 15.5.5`. Requested codemod wizard to use Turbopack configuration and to keep React v18. Also requested the suggested ESLint upgrade. Ran all the suggested codemods. Ran the same codemod tool in project root, in app roots and in the packages/components. NOTE: There seems to be a bug in the codemod wizard, since when it asks about upgrading the React, it updates the package version anyway, no matter what is chosen. So, those changes needed to be manually reverted. ---- Step 2: Remove changes added by codemod since they are not working Start supporting Turbopack in configuration level. There seems to be still some issues e.g. in stylesheet imports that makes the turbopack not usable. Also, we should separate the server side functiosn from clietn side functiosn much more stricter, which would be a huge job at this point. However, since it's preferred, the configuration is now added for future testing, but it's just not set as default.
1 parent fdccd2d commit 09d1b39

22 files changed

Lines changed: 557 additions & 204 deletions

File tree

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,4 @@ USER default
260260

261261
ENV PROJECT ${PROJECT}
262262

263-
CMD ["sh", "-c", "/app/run_node.sh"]
264-
263+
CMD ["sh", "-c", "/app/run_node.sh"]

apps/events-helsinki/eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default [
3636
'@next/next/no-img-element': 'off',
3737
'jsx-a11y/anchor-is-valid': 'off',
3838
'@typescript-eslint/naming-convention': 'off',
39+
'@typescript-eslint/triple-slash-reference': 'off',
3940
'vitest/no-commented-out-tests': 'off',
4041
'vitest/no-disabled-tests': 'off',
4142
'no-console': 'error',

apps/events-helsinki/next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

apps/events-helsinki/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"get-translations": "node ./scripts/get-translations.js",
2525
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/events-helsinki.eslintcache",
2626
"lint-fix": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
27-
"pre-commit": "next lint --fix",
27+
"pre-commit": "eslint --fix .",
2828
"prepare": "husky",
2929
"share-static-hardlink": "rimraf ./public/shared-assets && syncdir ../../static/assets ./public/shared-assets --copy",
3030
"share-static-symlink": "rimraf ./public/shared-assets && symlink-dir ../../static/assets ./public/shared-assets",
@@ -70,7 +70,7 @@
7070
"ics": "^3.8.1",
7171
"lodash": "4.17.21",
7272
"msw": "^2.10.4",
73-
"next": "14.2.33",
73+
"next": "15.5.5",
7474
"next-i18next": "15.4.2",
7575
"postcss": "^8.5.6",
7676
"query-string": "^9.2.2",
@@ -98,8 +98,8 @@
9898
"@graphql-codegen/typescript-operations": "4.6.1",
9999
"@graphql-codegen/typescript-react-apollo": "4.3.3",
100100
"@graphql-codegen/typescript-resolvers": "^4.5.1",
101-
"@next/env": "15.4.1",
102-
"@next/eslint-plugin-next": "15.4.1",
101+
"@next/env": "15.5.5",
102+
"@next/eslint-plugin-next": "15.5.5",
103103
"@size-limit/file": "11.2.0",
104104
"@testing-library/dom": "^10.4.0",
105105
"@testing-library/jest-dom": "^6.6.3",
@@ -125,7 +125,7 @@
125125
"es-check": "9.1.4",
126126
"esbuild": "0.25.6",
127127
"eslint": "9.31.0",
128-
"eslint-config-next": "15.4.1",
128+
"eslint-config-next": "15.5.5",
129129
"eslint-config-prettier": "^10.1.5",
130130
"eslint-import-resolver-typescript": "^4.4.4",
131131
"eslint-plugin-import": "^2.32.0",

apps/events-helsinki/src/domain/search/eventSearch/advancedSearch/search.module.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ $buttonWidth: 180px;
7878
}
7979

8080
& > :first-child {
81+
padding: var(--spacing-xs);
82+
8183
@include breakpoints.respond-above(s) {
8284
grid-column: 1 / 5;
8385
}
84-
padding: var(--spacing-xs);
8586

8687
svg {
8788
margin-right: var(--spacing-xs);

apps/hobbies-helsinki/eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default [
3636
'@next/next/no-img-element': 'off',
3737
'jsx-a11y/anchor-is-valid': 'off',
3838
'@typescript-eslint/naming-convention': 'off',
39+
'@typescript-eslint/triple-slash-reference': 'off',
3940
'vitest/no-commented-out-tests': 'off',
4041
'vitest/no-disabled-tests': 'off',
4142
'no-console': 'error',
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

apps/hobbies-helsinki/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"get-translations": "node ./scripts/get-translations.js",
2525
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/hobbies-helsinki.eslintcache",
2626
"lint-fix": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
27-
"pre-commit": "next lint --fix",
27+
"pre-commit": "eslint --fix .",
2828
"prepare": "husky",
2929
"share-static-hardlink": "rimraf ./public/shared-assets && syncdir ../../static/assets ./public/shared-assets --copy",
3030
"share-static-symlink": "rimraf ./public/shared-assets && symlink-dir ../../static/assets ./public/shared-assets",
@@ -70,7 +70,7 @@
7070
"ics": "^3.8.1",
7171
"lodash": "4.17.21",
7272
"msw": "^2.10.4",
73-
"next": "14.2.33",
73+
"next": "15.5.5",
7474
"next-i18next": "15.4.2",
7575
"postcss": "^8.5.6",
7676
"query-string": "^9.2.2",
@@ -98,8 +98,8 @@
9898
"@graphql-codegen/typescript-operations": "4.6.1",
9999
"@graphql-codegen/typescript-react-apollo": "4.3.3",
100100
"@graphql-codegen/typescript-resolvers": "^4.5.1",
101-
"@next/env": "15.4.1",
102-
"@next/eslint-plugin-next": "15.4.1",
101+
"@next/env": "15.5.5",
102+
"@next/eslint-plugin-next": "15.5.5",
103103
"@size-limit/file": "11.2.0",
104104
"@testing-library/dom": "^10.4.0",
105105
"@testing-library/jest-dom": "^6.6.3",
@@ -125,7 +125,7 @@
125125
"es-check": "9.1.4",
126126
"esbuild": "0.25.6",
127127
"eslint": "9.31.0",
128-
"eslint-config-next": "15.4.1",
128+
"eslint-config-next": "15.5.5",
129129
"eslint-config-prettier": "^10.1.5",
130130
"eslint-import-resolver-typescript": "^4.4.4",
131131
"eslint-plugin-import": "^2.32.0",

apps/hobbies-helsinki/src/domain/search/eventSearch/advancedSearch/search.module.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ $buttonWidth: 180px;
7878
}
7979

8080
& > :first-child {
81+
padding: var(--spacing-xs);
82+
8183
@include breakpoints.respond-above(s) {
8284
grid-column: 1 / 5;
8385
}
84-
padding: var(--spacing-xs);
8586

8687
svg {
8788
margin-right: var(--spacing-xs);

apps/sports-helsinki/eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default [
3636
'@next/next/no-img-element': 'off',
3737
'jsx-a11y/anchor-is-valid': 'off',
3838
'@typescript-eslint/naming-convention': 'off',
39+
'@typescript-eslint/triple-slash-reference': 'off',
3940
'vitest/no-commented-out-tests': 'off',
4041
'vitest/no-disabled-tests': 'off',
4142
'no-console': 'error',

0 commit comments

Comments
 (0)