Skip to content

Commit ca08c16

Browse files
authored
feat: upgrade to gatsby v4 (#149)
1 parent 692499e commit ca08c16

24 files changed

Lines changed: 5717 additions & 8574 deletions

File tree

.eslintrc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
module.exports = {
2-
parser: `babel-eslint`,
2+
parser: `@babel/eslint-parser`,
33
extends: [
44
`google`,
55
`eslint:recommended`,
6-
`plugin:flowtype/recommended`,
76
`plugin:react/recommended`,
87
`prettier`,
98
],
10-
plugins: [`flowtype`, `prettier`, `react`, `filenames`],
9+
plugins: [`prettier`, `react`, `filenames`],
1110
parserOptions: {
1211
ecmaVersion: 2016,
1312
sourceType: `module`,
1413
ecmaFeatures: {
1514
jsx: true,
1615
},
16+
babelOptions: {
17+
presets: [`@babel/preset-react`],
18+
},
19+
requireConfigFile: false,
1720
},
1821
env: {
1922
browser: true,

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: End-to-end tests
22
on: [push]
33
jobs:
44
cypress-run:
5-
runs-on: ubuntu-16.04
5+
runs-on: ubuntu-latest
66
steps:
77
- name: Checkout
88
uses: actions/checkout@v2

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged

package.json

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@
1616
"ssat:gatsby-starter-theme:dev": "start-server-and-test gatsby-starter-theme:cy:dev http://localhost:8000 cy:open",
1717
"ssat:gatsby-starter-theme:serve": "start-server-and-test gatsby-starter-theme:serve http://localhost:9000 cy:run",
1818
"e2e:dev": "concurrently --kill-others 'yarn ssat:gatsby-starter-theme:dev'",
19-
"e2e:ci": "yarn gatsby-starter-theme:cy:build && yarn ssat:gatsby-starter-theme:serve"
20-
},
21-
"husky": {
22-
"hooks": {
23-
"pre-commit": "lint-staged"
24-
}
19+
"e2e:ci": "yarn gatsby-starter-theme:cy:build && yarn ssat:gatsby-starter-theme:serve",
20+
"prepare": "husky install"
2521
},
2622
"lint-staged": {
2723
"*.{js,jsx}": [
@@ -40,24 +36,26 @@
4036
"starters/*"
4137
],
4238
"devDependencies": {
43-
"babel-eslint": "^10.1.0",
44-
"@testing-library/cypress": "^6.0.0",
45-
"concurrently": "^5.2.0",
46-
"cross-env": "^7.0.2",
47-
"cypress": "^7.0.1",
48-
"eslint": "^7.23.0",
39+
"@babel/eslint-parser": "^7.16.3",
40+
"@testing-library/cypress": "^8.0.2",
41+
"concurrently": "^6.4.0",
42+
"cross-env": "^7.0.3",
43+
"cypress": "^9.1.0",
44+
"eslint": "^7.0.0",
4945
"eslint-config-google": "^0.14.0",
50-
"eslint-config-prettier": "^8.1.0",
51-
"eslint-plugin-cypress": "^2.11.2",
46+
"eslint-config-prettier": "^7.0.0",
47+
"eslint-plugin-cypress": "^2.12.1",
5248
"eslint-plugin-filenames": "^1.3.2",
53-
"eslint-plugin-flowtype": "^5.6.0",
54-
"eslint-plugin-prettier": "^3.3.1",
55-
"eslint-plugin-react": "^7.23.2",
56-
"gatsby-cypress": "^1.2.0",
57-
"husky": "^4.2.5",
58-
"lerna": "^3.22.1",
59-
"lint-staged": "^10.5.4",
60-
"prettier": "^2.2.1",
61-
"start-server-and-test": "^1.12.1"
49+
"eslint-plugin-prettier": "^4.0.0",
50+
"eslint-plugin-react": "^7.27.1",
51+
"gatsby-cypress": "^2.3.0",
52+
"husky": "^7.0.4",
53+
"lerna": "^4.0.0",
54+
"lint-staged": "^12.1.2",
55+
"prettier": "^2.5.0",
56+
"start-server-and-test": "^1.14.0"
57+
},
58+
"dependencies": {
59+
"@babel/preset-react": "^7.16.0"
6260
}
6361
}

packages/gatsby-theme-blog-core/gatsby-node.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,18 @@ exports.onPreBootstrap = ({ store }, themeOptions) => {
2929
})
3030
}
3131

32-
const mdxResolverPassthrough = (fieldName) => async (
33-
source,
34-
args,
35-
context,
36-
info
37-
) => {
38-
const type = info.schema.getType(`Mdx`)
39-
const mdxNode = context.nodeModel.getNodeById({
40-
id: source.parent,
41-
})
42-
const resolver = type.getFields()[fieldName].resolve
43-
const result = await resolver(mdxNode, args, context, {
44-
fieldName,
45-
})
46-
return result
47-
}
32+
const mdxResolverPassthrough =
33+
(fieldName) => async (source, args, context, info) => {
34+
const type = info.schema.getType(`Mdx`)
35+
const mdxNode = context.nodeModel.getNodeById({
36+
id: source.parent,
37+
})
38+
const resolver = type.getFields()[fieldName].resolve
39+
const result = await resolver(mdxNode, args, context, {
40+
fieldName,
41+
})
42+
return result
43+
}
4844

4945
exports.createSchemaCustomization = ({ actions, schema }, themeOptions) => {
5046
const { excerptLength } = withDefaults(themeOptions)
@@ -272,7 +268,7 @@ exports.createPages = async ({ graphql, actions, reporter }, themeOptions) => {
272268

273269
const result = await graphql(
274270
`
275-
query($limit: Int!, $filter: BlogPostFilterInput) {
271+
query ($limit: Int!, $filter: BlogPostFilterInput) {
276272
allBlogPost(
277273
sort: { fields: [date, title], order: DESC }
278274
filter: $filter

packages/gatsby-theme-blog-core/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
"homepage": "https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-blog-core#readme",
1414
"peerDependencies": {
1515
"@mdx-js/react": "^1.6.22",
16-
"gatsby": "^3.0.0",
16+
"gatsby": "^4.0.0",
1717
"react": "^17.0.0",
1818
"react-dom": "^17.0.0"
1919
},
2020
"dependencies": {
2121
"@mdx-js/mdx": "^1.6.22",
22-
"gatsby-core-utils": "^2.2.0",
23-
"gatsby-plugin-image": "^1.2.1",
24-
"gatsby-plugin-mdx": "^2.2.0",
25-
"gatsby-plugin-sharp": "^3.2.1",
26-
"gatsby-remark-copy-linked-files": "^3.2.0",
27-
"gatsby-remark-images": "^4.2.0",
28-
"gatsby-remark-smartypants": "^3.2.0",
29-
"gatsby-source-filesystem": "^3.2.0",
30-
"gatsby-transformer-sharp": "^3.2.0",
22+
"gatsby-core-utils": "^3.3.0",
23+
"gatsby-plugin-image": "^2.3.0",
24+
"gatsby-plugin-mdx": "^3.3.0",
25+
"gatsby-plugin-sharp": "^4.3.0",
26+
"gatsby-remark-copy-linked-files": "^5.3.0",
27+
"gatsby-remark-images": "^6.3.0",
28+
"gatsby-remark-smartypants": "^5.3.0",
29+
"gatsby-source-filesystem": "^4.3.0",
30+
"gatsby-transformer-sharp": "^4.3.0",
3131
"remark-slug": "^5.1.2"
3232
},
3333
"engines": {
34-
"node": ">=12.13.0"
34+
"node": ">=14.15.0"
3535
}
3636
}

packages/gatsby-theme-blog-darkmode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
},
1919
"homepage": "https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-blog-darkmode#readme",
2020
"dependencies": {
21-
"@reach/skip-nav": "^0.15.0",
21+
"@reach/skip-nav": "^0.16.0",
2222
"react-switch": "^6.0.0"
2323
},
2424
"peerDependencies": {
25-
"gatsby": "^3.0.0",
25+
"gatsby": "^4.0.0",
2626
"react": "^17.0.0",
2727
"react-dom": "^17.0.0"
2828
},
2929
"engines": {
30-
"node": ">=12.13.0"
30+
"node": ">=14.15.0"
3131
}
3232
}

packages/gatsby-theme-blog/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
},
1919
"homepage": "https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-blog#readme",
2020
"dependencies": {
21-
"@reach/skip-nav": "^0.15.0",
21+
"@reach/skip-nav": "^0.16.0",
2222
"@theme-ui/prism": "0.6.2",
23-
"gatsby-plugin-emotion": "^6.2.0",
24-
"gatsby-plugin-feed": "^3.2.0",
25-
"gatsby-plugin-react-helmet": "^4.2.0",
23+
"gatsby-plugin-emotion": "^7.3.0",
24+
"gatsby-plugin-feed": "^4.3.0",
25+
"gatsby-plugin-react-helmet": "^5.3.0",
2626
"gatsby-plugin-theme-ui": "0.7.0",
27-
"gatsby-plugin-twitter": "^3.2.0",
27+
"gatsby-plugin-twitter": "^4.3.0",
2828
"gatsby-theme-blog-core": "^3.0.0",
2929
"gatsby-theme-ui-preset": "^2.0.0",
3030
"mdx-utils": "0.2.0",
3131
"react-helmet": "^6.1.0",
3232
"theme-ui": "0.7.0"
3333
},
3434
"peerDependencies": {
35-
"gatsby": "^3.0.0",
35+
"gatsby": "^4.0.0",
3636
"react": "^17.0.0",
3737
"react-dom": "^17.0.0"
3838
},
3939
"engines": {
40-
"node": ">=12.13.0"
40+
"node": ">=14.15.0"
4141
}
4242
}

packages/gatsby-theme-blog/src/gatsby-plugin-theme-ui/components.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,34 @@ const LinkIcon = (props) => (
2020
</svg>
2121
)
2222

23-
const heading = (Tag) => (props) => (
24-
<Tag
25-
{...props}
26-
css={css({
27-
a: {
28-
visibility: `hidden`,
29-
},
30-
":hover a": {
31-
visibility: `visible`,
32-
},
33-
pointerEvents: `painted`,
34-
})}
35-
>
36-
<a
37-
href={`#${props.id}`}
23+
const heading = (Tag) => (props) =>
24+
(
25+
<Tag
26+
{...props}
3827
css={css({
39-
ml: `-20px`,
40-
pr: `4px`,
41-
color: `primary`,
28+
a: {
29+
visibility: `hidden`,
30+
},
31+
":hover a": {
32+
visibility: `visible`,
33+
},
34+
pointerEvents: `painted`,
4235
})}
43-
aria-label={props.children}
4436
>
45-
<LinkIcon />
46-
</a>
47-
{props.children}
48-
</Tag>
49-
)
37+
<a
38+
href={`#${props.id}`}
39+
css={css({
40+
ml: `-20px`,
41+
pr: `4px`,
42+
color: `primary`,
43+
})}
44+
aria-label={props.children}
45+
>
46+
<LinkIcon />
47+
</a>
48+
{props.children}
49+
</Tag>
50+
)
5051

5152
const headings = {
5253
h1: heading(`h1`),

packages/gatsby-theme-i18n-lingui/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"description": "A Gatsby theme for providing localization support via Lingui. This theme sets up Lingui's context provider so that you can access your translations on every page. Works best together with gatsby-theme-i18n.",
77
"license": "MIT",
88
"devDependencies": {
9-
"@lingui/core": "^3.8.9",
10-
"@lingui/react": "^3.8.9"
9+
"@lingui/core": "^3.13.0",
10+
"@lingui/react": "^3.13.0"
1111
},
1212
"peerDependencies": {
1313
"@lingui/core": "^3.8.9",
1414
"@lingui/react": "^3.8.9",
15-
"gatsby": "^3.0.0",
15+
"gatsby": "^4.0.0",
1616
"react": "^17.0.0",
1717
"react-dom": "^17.0.0"
1818
},
@@ -30,6 +30,6 @@
3030
},
3131
"homepage": "https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-i18n-lingui#readme",
3232
"engines": {
33-
"node": ">=12.13.0"
33+
"node": ">=14.15.0"
3434
}
3535
}

0 commit comments

Comments
 (0)