Skip to content

Commit 48a374a

Browse files
authored
feat: upgrade to gatsby v5 (graphql#1293)
1 parent 703844f commit 48a374a

File tree

8 files changed

+823
-3381
lines changed

8 files changed

+823
-3381
lines changed

.github/workflows/CI.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v1
1010
- uses: actions/setup-node@v1
1111
with:
12-
node-version: '16.13.0'
12+
node-version: "18.12.1"
1313

1414
- run: yarn install
1515

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.13.0
1+
18.12.1

gatsby-config.js

+18-20
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,24 @@ module.exports = {
8787
author: byline,
8888
})
8989
),
90-
query: `
91-
{
92-
allMarkdownRemark(
93-
filter: {frontmatter: {layout: {eq: "blog"}}},
94-
sort: { order: DESC, fields: [frontmatter___date] }
95-
) {
96-
edges {
97-
node {
98-
excerpt
99-
frontmatter {
100-
title
101-
date
102-
permalink
103-
byline
104-
}
105-
}
106-
}
107-
}
108-
}
109-
`,
90+
query: `{
91+
allMarkdownRemark(
92+
filter: {frontmatter: {layout: {eq: "blog"}}}
93+
sort: {frontmatter: {date: DESC}}
94+
) {
95+
edges {
96+
node {
97+
excerpt
98+
frontmatter {
99+
title
100+
date
101+
permalink
102+
byline
103+
}
104+
}
105+
}
106+
}
107+
}`,
110108
output: "/blog/rss.xml",
111109
title: "Blog | GraphQL",
112110
feed_url: "http://graphql.org/blog/rss.xml",

gatsby-node.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ exports.onCreatePage = async ({ page, actions }) => {
204204
exports.createPages = async ({ graphql, actions }) => {
205205
const { createPage } = actions
206206

207-
const result = await graphql(/* GraphQL */ `
208-
query {
207+
const result = await graphql(`
208+
{
209209
allMarkdownRemark {
210210
edges {
211211
node {
@@ -231,7 +231,7 @@ exports.createPages = async ({ graphql, actions }) => {
231231
}
232232
}
233233
allBlogPost {
234-
group(field: tags) {
234+
group(field: { tags: SELECT }) {
235235
fieldValue
236236
}
237237
}

package.json

+18-19
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"version": "0.0.0",
55
"scripts": {
66
"build": "gatsby build",
7-
"develop": "GATSBY_GRAPHQL_IDE=playground gatsby develop",
7+
"develop": "gatsby develop",
88
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
99
"start": "npm run develop",
1010
"serve": "gatsby serve",
1111
"clean": "gatsby clean",
1212
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
1313
},
1414
"resolutions": {
15-
"graphql": "15.6.0"
15+
"graphql": "16.6.0"
1616
},
1717
"dependencies": {
1818
"@graphql-tools/schema": "8.3.1",
@@ -21,29 +21,28 @@
2121
"assert": "2.0.0",
2222
"codemirror": "5.65.1",
2323
"codemirror-graphql": "1.2.11",
24-
"gatsby": "4.24.8",
24+
"gatsby": "5.0.1",
2525
"gatsby-plugin-anchor-links": "1.2.1",
26-
"gatsby-plugin-feed": "4.7.0",
27-
"gatsby-plugin-google-analytics": "4.7.0",
28-
"gatsby-plugin-less": "6.7.0",
29-
"gatsby-plugin-typegen": "2.2.4",
30-
"gatsby-plugin-webfonts": "2.2.1",
31-
"gatsby-source-filesystem": "4.7.0",
32-
"gatsby-transformer-remark": "5.7.0",
26+
"gatsby-plugin-feed": "5.0.0",
27+
"gatsby-plugin-google-analytics": "5.0.0",
28+
"gatsby-plugin-less": "7.0.0",
29+
"gatsby-plugin-webfonts": "2.2.2",
30+
"gatsby-source-filesystem": "5.0.0",
31+
"gatsby-transformer-remark": "6.0.0",
3332
"globby": "11.0.4",
34-
"graphql": "15.6.0",
35-
"marked": "4.0.10",
36-
"numbro": "2.3.5",
33+
"graphql": "16.6.0",
34+
"marked": "4.2.2",
35+
"numbro": "2.3.6",
3736
"parser-front-matter": "1.6.4",
38-
"prism-react-renderer": "1.2.1",
39-
"prismjs": "1.25.0",
40-
"react": "17.0.2",
41-
"react-dom": "17.0.2",
37+
"prism-react-renderer": "1.3.5",
38+
"prismjs": "1.29.0",
39+
"react": "18.2.0",
40+
"react-dom": "18.2.0",
4241
"timeago.js": "4.0.2"
4342
},
4443
"devDependencies": {
4544
"@types/codemirror": "5.60.5",
46-
"@types/prismjs": "1.16.6",
47-
"prettier": "2.4.1"
45+
"@types/prismjs": "1.26.0",
46+
"prettier": "2.7.1"
4847
}
4948
}

src/components/BlogSidebar/index.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ const BlogSidebar: React.FC = () => {
66
const data = useStaticQuery<Queries.AllTagsStaticQuery>(graphql`
77
query AllTagsStatic {
88
allBlogPost {
9-
group(field: tags) {
9+
group(field: { tags: SELECT }) {
1010
fieldValue
1111
}
1212
}
13-
allRecentBlogPost: allBlogPost(
14-
limit: 30
15-
sort: { fields: [date], order: DESC }
16-
) {
13+
allRecentBlogPost: allBlogPost(limit: 30, sort: { date: DESC }) {
1714
nodes {
1815
title
1916
postId

src/pages/blog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Seo from "../components/Seo"
88

99
export const query = graphql`
1010
query BlogPostListPage {
11-
allBlogPost(sort: { fields: [date], order: DESC }) {
11+
allBlogPost(sort: { date: DESC }) {
1212
nodes {
1313
id
1414
...BlogPostPreview_post

0 commit comments

Comments
 (0)