Skip to content

Commit e4e7cfb

Browse files
authored
Merge pull request #12266 from TylerAPfledderer/build/next-14-netlify-workaround
build(deps): bump Next to v14 with Netlify build Workaround
2 parents ffdbd8a + c6095b5 commit e4e7cfb

File tree

4 files changed

+181
-164
lines changed

4 files changed

+181
-164
lines changed

netlify.toml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,21 @@
3939
path = "en/developers/tutorials/creating-a-wagmi-ui-for-your-contract/"
4040

4141
[functions]
42-
included_files = [
43-
"./src/intl/**/*",
44-
"!./public/**/*",
45-
"!./node_modules/@swc/core-linux-x64-musl/**/*",
46-
"!./node_modules/@swc/core-linux-x64-gnu/**/*",
47-
]
42+
43+
[functions.___netlify-odb-handler]
44+
included_files = [
45+
"./src/intl/**/*",
46+
"!./public/**/*",
47+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context*",
48+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context*",
49+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context*",
50+
]
51+
52+
[functions.___netlify-handler]
53+
included_files = [
54+
"./src/intl/**/*",
55+
"!./public/**/*",
56+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context*",
57+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context*",
58+
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context*",
59+
]

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"lodash.merge": "^4.6.2",
4242
"lodash.shuffle": "^4.2.0",
4343
"lodash.union": "^4.6.0",
44-
"next": "13.4.8",
44+
"next": "^14.2.3",
4545
"next-i18next": "^14.0.3",
4646
"next-mdx-remote": "^3.0.8",
4747
"next-sitemap": "^4.2.3",
@@ -73,12 +73,12 @@
7373
"@types/decompress": "^4.2.7",
7474
"@types/hast": "^3.0.0",
7575
"@types/node": "^20.4.2",
76-
"@types/react": "^18.2.15",
77-
"@types/react-dom": "^18.2.7",
76+
"@types/react": "18.2.57",
77+
"@types/react-dom": "18.2.19",
7878
"chromatic": "^10.5.0",
7979
"decompress": "^4.2.1",
8080
"eslint": "^8.45.0",
81-
"eslint-config-next": "^13.0.0",
81+
"eslint-config-next": "^14.2.2",
8282
"eslint-config-prettier": "^9.0.0",
8383
"eslint-plugin-simple-import-sort": "^10.0.0",
8484
"eslint-plugin-storybook": "^0.6.15",

src/lib/utils/md.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ import { toPosixPath } from "./relativePath"
1818

1919
import { ITutorial } from "@/pages/developers/tutorials"
2020

21-
const CURRENT_CONTENT_DIR = join(process.cwd(), CONTENT_DIR)
21+
function getCurrentDir() {
22+
return join(process.cwd(), CONTENT_DIR)
23+
}
2224

2325
const getPostSlugs = (dir: string, files: string[] = []) => {
24-
const contentDir = join(CURRENT_CONTENT_DIR, dir)
26+
const currentDir = getCurrentDir()
27+
const contentDir = join(currentDir, dir)
2528
// Temporal list of content pages allowed to be compiled
2629
// When a content page is migrated (and he components being used), should be added to this list
2730
const temporalAllowedPages = [
@@ -290,14 +293,12 @@ const getPostSlugs = (dir: string, files: string[] = []) => {
290293
if (fileExtension === ".md") {
291294
// If it is a .md file (allowed content page), push the path to the files array
292295
for (const page of temporalAllowedPages) {
293-
const fullPagePath = join(CURRENT_CONTENT_DIR, page)
296+
const fullPagePath = join(currentDir, page)
294297

295298
if (name.includes(fullPagePath)) {
296299
files.push(
297300
toPosixPath(
298-
fullPagePath
299-
.replace(CURRENT_CONTENT_DIR, "")
300-
.replace("/index.md", "")
301+
fullPagePath.replace(currentDir, "").replace("/index.md", "")
301302
)
302303
)
303304
}
@@ -320,7 +321,8 @@ export const getContentBySlug = (slug: string) => {
320321
}
321322
}
322323

323-
let fullPath = toPosixPath(join(CURRENT_CONTENT_DIR, realSlug))
324+
const currentDir = getCurrentDir()
325+
let fullPath = toPosixPath(join(currentDir, realSlug))
324326
let contentNotTranslated = false
325327

326328
// If content is not translated, use english content fallback
@@ -350,8 +352,9 @@ export const getContent = (dir: string) => {
350352
}
351353

352354
export const getTutorialsData = (locale: string): ITutorial[] => {
355+
const currentDir = getCurrentDir()
353356
const fullPath = join(
354-
CURRENT_CONTENT_DIR,
357+
currentDir,
355358
locale !== "en" ? `translations/${locale!}` : "",
356359
"developers/tutorials"
357360
)
@@ -362,7 +365,7 @@ export const getTutorialsData = (locale: string): ITutorial[] => {
362365

363366
tutorialData = languageTutorialFiles.map((dir) => {
364367
const filePath = join(
365-
CURRENT_CONTENT_DIR,
368+
currentDir,
366369
locale !== "en" ? `translations/${locale!}` : "",
367370
"developers/tutorials",
368371
dir,

0 commit comments

Comments
 (0)