Skip to content

Commit 48e8be7

Browse files
committed
feat: upgrade to gatsby 3
1 parent 6b9b5b6 commit 48e8be7

File tree

7 files changed

+15686
-7403
lines changed

7 files changed

+15686
-7403
lines changed

.eslintrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"rules": {
2121
"react/prop-types": "off",
2222
"template-tag-spacing": "off",
23-
"no-unexpected-multiline": "off"
23+
"no-unexpected-multiline": "off",
24+
"react/display-name": "off",
25+
"no-unused-vars": "warn",
26+
"no-multiple-empty-lines": "warn"
2427
},
2528
"settings": {
2629
"react": {

gatsby-config.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,23 @@ require('dotenv').config()
22
const queries = require('./src/utils/algolia')
33
const config = require('./config')
44
const plugins = [
5-
'gatsby-plugin-eslint',
6-
'gatsby-plugin-sass',
5+
{
6+
resolve: 'gatsby-plugin-eslint',
7+
options: {
8+
stages: ['develop'],
9+
extensions: ['js', 'jsx'],
10+
exclude: ['node_modules', '.cache', 'public']
11+
}
12+
},
13+
{
14+
resolve: 'gatsby-plugin-sass',
15+
options: {
16+
postCssPlugins: [
17+
require('tailwindcss'),
18+
require('./tailwind.config.js')
19+
]
20+
}
21+
},
722
'gatsby-plugin-netlify',
823
'gatsby-plugin-sitemap',
924
'gatsby-plugin-sharp',

gatsby-node.js

+31-19
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,41 @@ exports.createPages = ({ graphql, actions }) => {
9898
})
9999
}
100100

101-
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
102-
const config = {
103-
resolve: {
104-
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
105-
alias: {
106-
$components: path.resolve(__dirname, 'src/components'),
107-
buble: '@philpl/buble' // to reduce bundle size
108-
}
109-
}
110-
}
101+
exports.onCreateWebpackConfig = ({ stage, loaders, actions, getConfig }) => {
102+
const config = getConfig()
103+
104+
config.resolve.modules = [path.resolve(__dirname, 'src'), 'node_modules']
105+
config.resolve.alias.$components = path.resolve(__dirname, 'src/components')
106+
config.resolve.alias.buble = '@philpl/buble'
111107

112108
if (stage === 'build-html' || stage === 'develop-html') {
113-
config.module = {
114-
rules: [
115-
{
116-
test: /mapbox-gl/,
117-
use: loaders.null()
118-
}
119-
]
120-
}
109+
config.module.rules.push({
110+
test: /mapbox-gl/,
111+
use: loaders.null()
112+
})
113+
}
114+
115+
// required for using redoc after the upgrade to gatsby v3
116+
config.resolve.fallback = {
117+
buffer: require.resolve('buffer/'),
118+
events: require.resolve('events/'),
119+
fs: require.resolve('browserify-fs'),
120+
http: require.resolve('http-browserify'),
121+
path: require.resolve('path-browserify'),
122+
stream: require.resolve('stream-browserify'),
123+
util: require.resolve('util/')
121124
}
122125

123-
actions.setWebpackConfig(config)
126+
// this is needed for redoc, which uses a different version of core-js from gatsby
127+
// see https://github.com/gatsbyjs/gatsby/issues/17136#issuecomment-568036690
128+
const coreJs2config = config.resolve.alias['core-js']
129+
delete config.resolve.alias['core-js']
130+
config.resolve.alias['core-js/modules'] = `${coreJs2config}/modules`
131+
try {
132+
config.resolve.alias['core-js/es'] = path.dirname(require.resolve('core-js/es'))
133+
} catch (err) { console.error(err) }
134+
135+
actions.replaceWebpackConfig(config)
124136
}
125137

126138
exports.onCreateBabelConfig = ({ actions }) => {

package.json

+27-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"dependencies": {
66
"@babel/plugin-proposal-export-default-from": "7.7.4",
77
"@emotion/core": "10.0.22",
8-
"@emotion/styled": "10.0.23",
8+
"@emotion/react": "11.4.0",
9+
"@emotion/styled": "11.3.0",
910
"@emotion/styled-base": "10.0.24",
1011
"@fortawesome/fontawesome-svg-core": "1.2.26",
1112
"@fortawesome/free-brands-svg-icons": "5.12.0",
@@ -19,48 +20,56 @@
1920
"@playlyfe/gql": "2.6.2",
2021
"@turf/turf": "5.1.6",
2122
"algoliasearch": "3.35.1",
23+
"autoprefixer": "10.3.1",
24+
"babel-eslint": "10.1.0",
2225
"bootstrap": "4.4.1",
26+
"browserify-fs": "1.0.0",
27+
"core-js": "3.6.5",
2328
"d3": "5.15.0",
2429
"dotenv": "8.2.0",
2530
"emotion": "10.0.23",
2631
"emotion-server": "10.0.17",
2732
"emotion-theming": "10.0.19",
28-
"gatsby": "2.18.18",
33+
"eslint-webpack-plugin": "2.5.4",
34+
"gatsby": "3.9.1",
2935
"gatsby-cli": "2.8.26",
3036
"gatsby-link": "2.2.27",
3137
"gatsby-plugin-algolia": "0.5.0",
32-
"gatsby-plugin-catch-links": "2.1.21",
33-
"gatsby-plugin-emotion": "4.1.18",
34-
"gatsby-plugin-eslint": "2.0.8",
38+
"gatsby-plugin-catch-links": "3.9.0",
39+
"gatsby-plugin-emotion": "6.9.0",
40+
"gatsby-plugin-eslint": "3.0.0",
3541
"gatsby-plugin-gtag": "1.0.12",
3642
"gatsby-plugin-layout": "1.1.18",
3743
"gatsby-plugin-manifest": "2.2.33",
3844
"gatsby-plugin-mdx": "1.0.61",
39-
"gatsby-plugin-netlify": "2.1.31",
45+
"gatsby-plugin-netlify": "3.9.0",
4046
"gatsby-plugin-offline": "3.0.29",
41-
"gatsby-plugin-react-helmet": "3.1.18",
47+
"gatsby-plugin-react-helmet": "4.9.0",
4248
"gatsby-plugin-remove-serviceworker": "1.0.0",
43-
"gatsby-plugin-sass": "2.1.27",
49+
"gatsby-plugin-sass": "4.9.0",
4450
"gatsby-plugin-segment-analytics": "0.2.1",
4551
"gatsby-plugin-sharp": "2.3.7",
46-
"gatsby-plugin-sitemap": "2.2.24",
52+
"gatsby-plugin-sitemap": "4.5.0",
4753
"gatsby-remark-autolink-headers": "2.1.22",
4854
"gatsby-remark-copy-linked-files": "2.1.33",
4955
"gatsby-remark-images": "3.1.37",
50-
"gatsby-source-filesystem": "2.1.42",
56+
"gatsby-source-filesystem": "3.9.0",
5157
"gatsby-transformer-remark": "2.6.42",
5258
"graphql": "14.5.8",
59+
"http-browserify": "1.7.0",
5360
"is-absolute-url": "3.0.3",
5461
"lodash.flatten": "4.4.0",
5562
"lodash.startcase": "4.4.0",
5663
"mapbox-gl": "1.7.0",
64+
"mobx": "4.2.0",
5765
"moment": "2.24.0",
5866
"node-sass": "4.13.1",
5967
"numeral": "2.0.6",
6068
"papaparse": "5.2.0",
69+
"path-browserify": "1.0.1",
6170
"react": "16.12.0",
6271
"react-bootstrap": "1.0.0-beta.16",
63-
"react-dom": "16.12.0",
72+
"react-dom": "16.13.1",
6473
"react-feather": "2.0.3",
6574
"react-github-btn": "1.1.1",
6675
"react-helmet": "5.2.1",
@@ -69,8 +78,11 @@
6978
"react-instantsearch-dom": "6.0.0",
7079
"react-live": "2.2.2",
7180
"react-loadable": "5.5.0",
72-
"styled-components": "4.4.1",
73-
"styled-icons": "9.0.1"
81+
"redoc": "2.0.0-rc.55",
82+
"styled-components": "5.2.0",
83+
"styled-icons": "9.0.1",
84+
"tailwindcss": "2.2.4",
85+
"yaml": "1.10.2"
7486
},
7587
"license": "MIT",
7688
"main": "n/a",
@@ -79,12 +91,13 @@
7991
"build": "gatsby build --prefix-paths"
8092
},
8193
"devDependencies": {
94+
"eslint": "7.31.0",
8295
"eslint-config-standard": "14.1.0",
8396
"eslint-plugin-import": "2.19.1",
8497
"eslint-plugin-node": "11.0.0",
8598
"eslint-plugin-promise": "4.2.1",
8699
"eslint-plugin-standard": "4.0.1",
87-
"gatsby-plugin-remove-trailing-slashes": "2.1.17",
100+
"gatsby-plugin-remove-trailing-slashes": "3.9.0",
88101
"prism-react-renderer": "1.0.2"
89102
}
90103
}

src/pages/jobs/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
2-
import { StaticQuery } from 'gatsby'
3-
2+
import { StaticQuery, graphql } from 'gatsby'
43
import JobRow from '../../components/JobRow'
54
import Head from '../../components/Head'
65
import ExternalLink from '../../components/ExternalLink'

0 commit comments

Comments
 (0)