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

Commit 99dff6c

Browse files
author
Colin McDonnell
committed
migrated to next@9.5
1 parent ba43505 commit 99dff6c

File tree

15 files changed

+1726
-2074
lines changed

15 files changed

+1726
-2074
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
<h1 align="center">Devii</h1>
33
</p>
44
<p align="center">
5-
A developer blog starter for 2020. <br/>Next.js + React + TypeScript + <br/>Markdown + syntax highlighting + SEO + <br/>RSS generation
5+
A developer blog starter for 2020. <br/>Next.js<br/>React<br/>TypeScript<br/>Markdown<br/>syntax highlighting<br/>SEO<br/>RSS generation
66
</p>
77
<p align="center">
88
if you're happy and you know it, star this repo
99
</p>
10-
<p align="center">created by <a href="https://twitter.com/vriad" target="_blank">@vriad</a>
1110
</p>
1211
<p align="center">
1312
<a href="https://opensource.org/licenses/MIT" rel="nofollow">

components/Author.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import React from 'react';
33
import { format } from 'fecha';
44

55
import { PostData } from '../loader';
6-
import { config } from '../globals';
6+
import { globals } from '../globals';
77

88
export const FollowButton = () => {
99
return (
1010
<a href="/newsletter">
1111
<div
1212
style={{
1313
display: 'inline-block',
14-
border: `1px solid ${config.accentColor}`,
14+
border: `1px solid ${globals.accentColor}`,
1515
borderRadius: '4px',
1616
padding: '2px 10px',
17-
color: config.accentColor,
17+
color: globals.accentColor,
1818
fontSize: '10pt',
1919
marginBottom: '2px',
2020
marginLeft: '4px',

components/Footer.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { config } from '../globals';
2+
import { globals } from '../globals';
33

44
export const Footer: React.FC = () => (
55
<div
@@ -11,20 +11,15 @@ export const Footer: React.FC = () => (
1111
flexDirection: 'row',
1212
alignItems: 'center',
1313
justifyContent: 'space-between',
14-
backgroundColor: config.accentColor,
14+
backgroundColor: globals.accentColor,
1515
color: 'white',
1616
padding: '30px',
1717
fontSize: '12pt',
1818
}}
1919
>
20-
<p>{${config.yourName} ${new Date().getFullYear()}`}</p>
20+
<p>{${globals.yourName} ${new Date().getFullYear()}`}</p>
2121
<a href="/rss.xml">
22-
<img
23-
src="/rss-white.svg"
24-
alt="RSS Feed"
25-
height="30"
26-
width="30"
27-
/>
22+
<img src="/rss-white.svg" alt="RSS Feed" height="30" width="30" />
2823
</a>
2924
</div>
3025
);

components/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { config } from '../globals';
2+
import { globals } from '../globals';
33

44
export const Header: React.FC = () => (
55
<div
@@ -11,13 +11,13 @@ export const Header: React.FC = () => (
1111
flexDirection: 'row',
1212
alignItems: 'center',
1313
justifyContent: 'space-between',
14-
backgroundColor: config.accentColor,
14+
backgroundColor: globals.accentColor,
1515
padding: '30px',
1616
fontSize: '12pt',
1717
}}
1818
>
1919
<a href="/" style={{ textDecoration: 'none' }}>
20-
<p style={{ color: 'white' }}>{config.siteName}</p>
20+
<p style={{ color: 'white' }}>{globals.siteName}</p>
2121
</a>
2222
<div style={{ flex: 1 }} />
2323
<a href="https://github.com/vriad/devii" style={{ textDecoration: 'none' }}>

components/Markdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react';
22
import ReactMarkdown from 'react-markdown/with-html';
33
import Code from './Code';
4-
import { config } from '../globals';
4+
import { globals } from '../globals';
55

66
export const Markdown: React.FC<{ source: string }> = (props) => {
7+
// console.log(props.source);
78
return (
89
<div style={{ width: '100%' }} className="devii-markdown">
910
<ReactMarkdown
@@ -120,7 +121,7 @@ export const Markdown: React.FC<{ source: string }> = (props) => {
120121
.devii-markdown blockquote {
121122
margin: 0px;
122123
padding-left: 1em;
123-
border-left: 4px solid ${config.accentColor};
124+
border-left: 4px solid ${globals.accentColor};
124125
}
125126
`}</style>
126127
</div>

components/Meta.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import NextHead from 'next/head';
3-
import { config } from '../globals';
3+
import { globals } from '../globals';
44

55
export const Meta: React.FC<{
66
meta: {
@@ -30,14 +30,14 @@ export const Meta: React.FC<{
3030
content={meta.desc}
3131
/>
3232
)}
33-
<meta property="og:site_name" content={config.siteName} />
33+
<meta property="og:site_name" content={globals.siteName} />
3434
{meta.link && <meta property="og:url" content={`${meta.link}`} />}
3535

3636
<meta name="twitter:card" content="summary" />
3737
<meta name="twitter:title" content={meta.title} />
3838
{meta.desc && <meta name="twitter:description" content={meta.desc} />}
39-
<meta name="twitter:site" content={config.twitterHandle} />
40-
<meta name="twitter:creator" content={config.twitterHandle} />
39+
<meta name="twitter:site" content={globals.twitterHandle} />
40+
<meta name="twitter:creator" content={globals.twitterHandle} />
4141
{meta.image && <meta name="twitter:image" content={meta.image} />}
4242
{meta.image && <meta property="og:image" content={`${meta.image}`} />}
4343
</NextHead>

globals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export namespace config {
1+
export namespace globals {
22
export const yourName = 'Alyssa P. Hacker';
33
export const siteName = `My Awesome Blog`;
44
export const siteDescription = "I write about code 'n stuff";

loader.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import matter from 'gray-matter';
22
import glob from 'glob';
3-
import { config } from './globals';
3+
import { globals } from './globals';
44
export type PostData = {
55
path: string;
66
title: string;
@@ -36,7 +36,7 @@ export const mdToPost = (file: RawFile): PostData => {
3636
datePublished: metadata.data.datePublished || null,
3737
tags: metadata.data.tags || null,
3838
description: metadata.data.description || null,
39-
canonicalUrl: metadata.data.canonicalUrl || `${config.url}/${path}`,
39+
canonicalUrl: metadata.data.canonicalUrl || `${globals.url}/${path}`,
4040
author: metadata.data.author || null,
4141
authorPhoto: metadata.data.authorPhoto || null,
4242
authorTwitter: metadata.data.authorTwitter || null,
@@ -47,7 +47,8 @@ export const mdToPost = (file: RawFile): PostData => {
4747

4848
if (!post.title) throw new Error(`Missing required field: title.`);
4949
if (!post.content) throw new Error(`Missing required field: content.`);
50-
if (!post.datePublished) throw new Error(`Missing required field: datePublished.`);
50+
if (!post.datePublished)
51+
throw new Error(`Missing required field: datePublished.`);
5152

5253
return post as PostData;
5354
};
@@ -69,7 +70,8 @@ export const loadPost = async (path: string): Promise<PostData> => {
6970
};
7071

7172
export const loadBlogPosts = async (): Promise<PostData[]> => {
72-
return await (await loadMarkdownFiles(`blog/*.md`)).map(mdToPost)
73+
return await (await loadMarkdownFiles(`blog/*.md`))
74+
.map(mdToPost)
7375
.filter((p) => p.published)
74-
.sort((a, b) => (b.datePublished || 0) - (a.datePublished || 0));;
76+
.sort((a, b) => (b.datePublished || 0) - (a.datePublished || 0));
7577
};

next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
exportTrailingSlash: true,
2+
trailingSlash: true,
33
webpack: function (config) {
44
config.module.rules.push({
55
test: /\.md$/,

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,10 @@
3333
"export": "next export"
3434
},
3535
"dependencies": {
36-
"@types/glob": "^7.1.1",
37-
"@types/react-syntax-highlighter": "^11.0.4",
38-
"@types/rss": "^0.0.28",
39-
"@types/showdown": "^1.9.3",
4036
"fecha": "^4.2.0",
4137
"glob": "^7.1.6",
4238
"gray-matter": "^4.0.2",
43-
"next": "9.3",
39+
"next": "9.5",
4440
"raw-loader": "^4.0.1",
4541
"react": "16.13.0",
4642
"react-dom": "16.13.0",
@@ -50,8 +46,12 @@
5046
"showdown": "^1.9.1"
5147
},
5248
"devDependencies": {
49+
"@types/glob": "^7.1.3",
5350
"@types/node": "14",
5451
"@types/react": "^16.9.35",
52+
"@types/react-syntax-highlighter": "^11.0.5",
53+
"@types/rss": "^0.0.28",
54+
"@types/showdown": "^1.9.3",
5555
"favicons": "^6.1.0",
5656
"typescript": "^3.8.3"
5757
}

0 commit comments

Comments
 (0)