Skip to content

Commit

Permalink
Upgrade to support latest Next.js version (#35)
Browse files Browse the repository at this point in the history
* Upgrade, support rendering images

* apply updates

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
jdetle and ijjk authored Jun 13, 2020
1 parent 63a6f09 commit 9385a8a
Show file tree
Hide file tree
Showing 7 changed files with 2,353 additions and 2,565 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ yarn-error.log*
.blog_index_data
.blog_index_data_previews

.now
.now
.vercel
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
},
"dependencies": {
"@zeit/react-jsx-parser": "^2.0.0",
"async-sema": "^3.1.0",
"github-slugger": "^1.2.1",
"next": "^9.3.2",
"next": "9.4.4",
"prismjs": "^1.17.1",
"react": "16.12.0",
"react-dom": "16.12.0"
"react-dom": "16.12.0",
"uuid": "^8.1.0"
},
"devDependencies": {
"@types/node": "^13.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/notion/createTable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// commonjs so it can be run without transpiling
const uuid = require('uuid/v4')
const { v4: uuid } = require('uuid')
const fetch = require('node-fetch')
const {
BLOG_INDEX_ID: pageId,
Expand Down
9 changes: 3 additions & 6 deletions src/pages/api/preview-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {

if (!post) {
console.log(`Failed to find post for slug: ${req.query.slug}`)
return {
props: {
redirect: '/blog',
},
revalidate: 5,
}
return res.status(404).json({
message: `no post found for ${req.query.slug}`,
})
}

const postData = await getPageData(post.id)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getStaticProps({ params: { slug }, preview }) {
redirect: '/blog',
preview: false,
},
revalidate: 5,
unstable_revalidate: 5,
}
}
const postData = await getPageData(post.id)
Expand Down Expand Up @@ -64,7 +64,7 @@ export async function getStaticProps({ params: { slug }, preview }) {
post,
preview: preview || false,
},
revalidate: 10,
unstable_revalidate: 10,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function getStaticProps({ preview }) {
preview: preview || false,
posts,
},
revalidate: 10,
unstable_revalidate: 10,
}
}

Expand Down
4,892 changes: 2,340 additions & 2,552 deletions yarn.lock

Large diffs are not rendered by default.

1 comment on commit 9385a8a

@vercel
Copy link

@vercel vercel bot commented on 9385a8a Jun 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.