Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit a0ac639

Browse files
committed
update to next 10
1 parent 1816397 commit a0ac639

File tree

7 files changed

+1774
-1413
lines changed

7 files changed

+1774
-1413
lines changed

next.config.js

+21-41
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,24 @@
11
const withPlugins = require('next-compose-plugins')
2-
const withMdxEnhanced = require('next-mdx-enhanced')
3-
const checkEnv = require('@47ng/check-env').default
4-
const nodePath = require('path')
5-
const readingTime = require('reading-time')
2+
const withMDX = require('@next/mdx')()
63

7-
checkEnv({
8-
required: ['NEXT_PUBLIC_DEPLOYMENT_URL'],
9-
})
4+
const nextConfig = {
5+
reactStrictMode: true,
6+
async redirects() {
7+
return []
8+
},
9+
}
1010

11-
const useURL = (path) =>
12-
`${process.env.NEXT_PUBLIC_DEPLOYMENT_URL}${path || ''}`
13-
14-
module.exports = withPlugins([
15-
withMdxEnhanced({
16-
layoutPath: 'src/layouts',
17-
defaultLayout: true,
18-
fileExtensions: ['mdx'],
19-
remarkPlugins: [
20-
require('remark-slug'),
21-
require('remark-footnotes'),
22-
require('remark-code-titles'),
23-
//require('@fec/remark-a11y-emoji')
24-
],
25-
rehypePlugins: [require('mdx-prism')],
26-
extendFrontMatter: {
27-
process: (mdxContent, frontMatter) => {
28-
const pagesDir = nodePath.resolve(__dirname, 'src/pages')
29-
// Somehow the __resourcePath does not start with a /:
30-
const path = ('/' + frontMatter.__resourcePath)
31-
.replace(pagesDir, '')
32-
.replace('.mdx', '')
33-
.replace('.tsx', '')
34-
.replace(/^\/index$/, '/')
35-
.replace(/\/index$/, '')
36-
return {
37-
path,
38-
url: useURL(path),
39-
readingTime: readingTime(mdxContent),
40-
}
41-
},
42-
},
43-
}),
44-
])
11+
module.exports = withPlugins(
12+
[
13+
withMDX({
14+
pageExtensions: ['ts', 'tsx', 'mdx'],
15+
remarkPlugins: [
16+
require('remark-slug'),
17+
require('remark-footnotes'),
18+
require('remark-code-titles'),
19+
],
20+
rehypePlugins: [require('mdx-prism')],
21+
}),
22+
],
23+
nextConfig,
24+
)

package.json

+18-19
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,38 @@
1010
"test": "jest --watch"
1111
},
1212
"dependencies": {
13-
"@47ng/check-env": "^2.0.1",
13+
"@next/mdx": "^10.0.1",
1414
"dotenv-flow": "^3.2.0",
1515
"husky": "^4.3.0",
16-
"lint-staged": "^10.4.0",
16+
"lint-staged": "^10.5.1",
1717
"mdx-prism": "^0.3.1",
18-
"next": "9.5.3",
18+
"next": "10.0.1",
1919
"next-mdx-enhanced": "^4.0.0",
20-
"next-seo": "^4.11.0",
21-
"next-sitemap": "^1.2.4",
20+
"next-seo": "^4.15.1",
21+
"next-sitemap": "^1.2.26",
2222
"prettier": "^2.1.2",
23-
"react": "16.13.1",
24-
"react-dom": "16.13.1",
25-
"reading-time": "^1.2.0",
23+
"react": "17.0.1",
24+
"react-dom": "17.0.1",
2625
"rehype": "^11.0.0",
2726
"remark-code-titles": "^0.1.1",
2827
"remark-footnotes": "^3.0.0",
2928
"remark-slug": "^6.0.0"
3029
},
3130
"devDependencies": {
32-
"@babel/plugin-transform-react-jsx": "^7.10.4",
31+
"@babel/plugin-transform-react-jsx": "^7.12.5",
3332
"@tailwindcss/typography": "^0.2.0",
34-
"@testing-library/jest-dom": "^5.11.4",
35-
"@testing-library/react": "^11.0.4",
36-
"@types/node": "^14.11.5",
37-
"@types/react": "^16.9.51",
38-
"babel-jest": "^26.5.2",
39-
"jest": "^26.5.2",
40-
"next-compose-plugins": "^2.2.0",
33+
"@testing-library/jest-dom": "^5.11.5",
34+
"@testing-library/react": "^11.11.1",
35+
"@types/node": "^14.14.7",
36+
"@types/react": "^16.9.56",
37+
"babel-jest": "^26.6.3",
38+
"jest": "^26.6.3",
39+
"next-compose-plugins": "^2.2.1",
4140
"postcss-nested": "^5.0.1",
4241
"postcss-preset-env": "^6.7.0",
43-
"react-test-renderer": "^16.13.1",
44-
"tailwindcss": "^1.8.11",
45-
"typescript": "^4.0.3"
42+
"react-test-renderer": "^17.0.1",
43+
"tailwindcss": "^1.9.6",
44+
"typescript": "^4.0.5"
4645
},
4746
"husky": {
4847
"hooks": {

public/robots.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
User-agent: *
22
Allow: /
3-
Host: https://example.com
4-
Sitemap: https://example.com/sitemap.xml
3+
Host: undefined
4+
Sitemap: undefined/sitemap.xml

public/sitemap.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
3-
<url><loc>https://example.com/</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2020-10-06T21:50:24.593Z</lastmod></url>
4-
<url><loc>https://example.com/hi</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2020-10-06T21:50:24.593Z</lastmod></url>
3+
<url><loc>undefined/</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2020-11-10T19:00:12.092Z</lastmod></url>
4+
<url><loc>undefined/hi</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2020-11-10T19:00:12.092Z</lastmod></url>
55
</urlset>

src/layouts/index.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ const DefaultLayout: FunctionComponent<LayoutProps> = ({
99
children,
1010
frontMatter,
1111
}) => {
12-
const {
13-
title,
14-
description,
15-
titleAppendSiteName = false,
16-
url,
17-
ogImage,
18-
} = frontMatter
12+
const {title, description, titleAppendSiteName = false, url, ogImage} =
13+
frontMatter || {}
1914
return (
2015
<>
2116
<NextSeo
@@ -30,8 +25,8 @@ const DefaultLayout: FunctionComponent<LayoutProps> = ({
3025
}}
3126
canonical={url}
3227
/>
33-
<div className="prose max-w-none">
34-
<h1>{title}</h1>
28+
<div className="prose md:prose-xl max-w-screen-md mt-0 mx-auto leading-6">
29+
{title && <h1 className="text-xl leading-tight">{title}</h1>}
3530
{children}
3631
</div>
3732
</>

src/pages/hi.mdx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
export const meta = {
2+
title: 'this is the page title!',
3+
}
4+
15
# Hi There
26

3-
THis is some MDX!
7+
This is some MDX!
8+
9+
import DefaultLayout from '../layouts/index'
10+
11+
export default DefaultLayou
12+
13+
t

0 commit comments

Comments
 (0)