Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Gatsby 5 (dev) #84

Open
wants to merge 67 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0115951
Merge pull request #1 from eyalroth/dev
eyalroth Jun 16, 2019
0d3e207
Merge pull request #26 from eyalroth/dev
eyalroth Jun 19, 2019
5b5f532
Merge pull request #31 from eyalroth/dev
eyalroth Jun 24, 2019
410d568
Merge pull request #36 from eyalroth/dev
eyalroth Jul 3, 2019
2bffd57
Merge pull request #42 from eyalroth/dev
eyalroth Jul 16, 2019
162cce9
Merge pull request #44 from eyalroth/dev
eyalroth Jul 21, 2019
331f096
Merge pull request #45 from eyalroth/dev
eyalroth Jul 22, 2019
3d81763
Merge pull request #47 from eyalroth/dev
eyalroth Jul 28, 2019
e9c8b10
Merge pull request #48 from eyalroth/dev
eyalroth Jul 28, 2019
4fcebd0
Merge pull request #49 from eyalroth/dev
eyalroth Jul 29, 2019
46b3d3b
Merge pull request #51 from eyalroth/dev
eyalroth Jul 31, 2019
a9bc29d
Merge pull request #52 from eyalroth/dev
eyalroth Aug 1, 2019
4430cba
Merge pull request #54 from eyalroth/dev
eyalroth Aug 7, 2019
65822f2
Merge pull request #55 from eyalroth/dev
eyalroth Aug 7, 2019
66fa759
Merge pull request #56 from eyalroth/dev
eyalroth Aug 8, 2019
cc41c13
Merge pull request #57 from eyalroth/dev
eyalroth Aug 11, 2019
97965eb
Merge pull request #59 from eyalroth/dev
eyalroth Aug 12, 2019
29c7b0d
Merge pull request #60 from eyalroth/dev
eyalroth Aug 12, 2019
f3814fc
Merge pull request #62 from eyalroth/dev
eyalroth Aug 13, 2019
68ba688
Merge pull request #63 from eyalroth/dev
eyalroth Aug 13, 2019
41173a9
Merge pull request #64 from eyalroth/dev
eyalroth Aug 13, 2019
3df6052
Merge pull request #65 from eyalroth/dev
eyalroth Aug 14, 2019
c4a0de5
Merge pull request #66 from eyalroth/dev
eyalroth Aug 14, 2019
9c8ec7f
Merge pull request #67 from eyalroth/dev
eyalroth Aug 14, 2019
54ead99
Merge pull request #68 from eyalroth/dev
eyalroth Aug 14, 2019
a7bcf37
Merge pull request #69 from eyalroth/dev
eyalroth Aug 14, 2019
0ee8df6
Create bug report issue template on Github
eyalroth Aug 14, 2019
c56b47c
Merge pull request #70 from eyalroth/dev
eyalroth Aug 14, 2019
27187b3
Merge pull request #71 from eyalroth/dev
eyalroth Aug 14, 2019
55c32bf
Merge pull request #72 from eyalroth/dev
eyalroth Aug 14, 2019
4cf78fd
Merge pull request #74 from eyalroth/dev
eyalroth Aug 15, 2019
09f9b20
Merge pull request #75 from eyalroth/dev
eyalroth Aug 18, 2019
7ec7488
Merge pull request #76 from eyalroth/dev
eyalroth Aug 26, 2019
70430a5
Upgrade npm packages to match gatsby 5
eyalroth Mar 31, 2023
4c15642
Fix 'gatsby build' errors
eyalroth Mar 31, 2023
ac09b25
Fix 'gatsby develop' errors + loading of the blog in the browser
eyalroth Mar 31, 2023
883d038
Fix SCSS deprecation warnings
eyalroth Mar 31, 2023
f50ad35
Fix graphql deprecation warnings
eyalroth Mar 31, 2023
c7c2a06
Move deprecated gatsby-image and move to gatsby-plugin-image
eyalroth Mar 31, 2023
508e3dd
Fix more deprecation warnings
eyalroth Mar 31, 2023
1b0be91
Fix gatsby-plugin-image deprecation warnings
eyalroth Mar 31, 2023
177f036
npm update
eyalroth Mar 31, 2023
3cde4e1
Fix more deprecation warnings
eyalroth Mar 31, 2023
0a1cae6
Add ESLint
eyalroth Apr 1, 2023
aefc1f1
Add CI (github workflow)
eyalroth Apr 1, 2023
0e27e34
Convert 'ProfileImg' to a function component to utilize 'useStaticQue…
eyalroth Apr 1, 2023
0fa6797
Convert 'PostSeriesBox' to a function component to utilize 'useStatic…
eyalroth Apr 5, 2023
de88d16
Replace deprecated 'gatsby-plugin-react-helmet' with builtin gatsby h…
eyalroth Apr 5, 2023
a2e72d6
Fix reading time feature
eyalroth Apr 7, 2023
2763eea
Set ESLint execution in build to fail on warnings as well
eyalroth Apr 7, 2023
e30d249
Remove unsupported '::-webkit-scrollbar' feature
eyalroth Apr 7, 2023
72bffe7
Fix rss feed
eyalroth Apr 7, 2023
1115c9c
Fix google fonts
eyalroth Apr 7, 2023
730ec9f
Add npm scripts to build and serve locally
eyalroth Apr 7, 2023
546e1a5
Merge pull request #83 from eyalroth/gatsby-5
eyalroth Apr 7, 2023
d8d3969
Merge remote-tracking branch 'origin/master' into dev-gatsby-5
eyalroth Apr 8, 2023
787b1c9
Fix ESLint warnings
eyalroth Apr 8, 2023
832a393
Replace StaticQuery with useStaticQuery in CategoryMenu
eyalroth Apr 8, 2023
4b319ba
Reapply changes to ProfileImg from dev branch with gatsby 5 compatibi…
eyalroth Apr 8, 2023
867884c
Make ProfileImg navigate to the home page only on simple click (no dr…
eyalroth Apr 8, 2023
fd342d1
Disable horizontal scrolling to prevent being able to "drag" the cont…
eyalroth Apr 8, 2023
c519638
Fix littlefoot
eyalroth Apr 8, 2023
1b84df0
Remove littlefont from server side rendering as it's not supported an…
eyalroth Apr 8, 2023
b439b99
Change the design of blackquote in posts
eyalroth Apr 14, 2023
0d7bc3e
Add all the relevant font variables of the Google fonts
eyalroth Apr 15, 2023
10a3ce1
Fix theme button in sidebar cropped in Safari
eyalroth Apr 15, 2023
65ddb2f
Display share button instead of share panel only on mobile (+tablets)…
eyalroth Apr 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public
.idea

13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
globals: {
__PATH_PREFIX__: true,
},
extends: 'react-app',
plugins: [
'react-hooks',
],
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
}
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug, user reported
assignees: eyalroth

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]

**Additional context**
Add any other context about the problem here (such as relevant site link).
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: URL=https://localhost GOOGLE_ANALYTICS=y UTTERANCES_REPO=z npm run build

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
51 changes: 46 additions & 5 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
require('./src/assets/fonts/fontello/css/fontello.css')
require("prismjs/themes/prism-okaidia.css")
require("prismjs/plugins/line-numbers/prism-line-numbers.css")
import './src/assets/fonts/fontello/css/fontello.css'
import littlefoot from 'littlefoot'
import './src/assets/scss/littlefoot.scss'

const React = require("react")
import '@fontsource/arimo/hebrew-400.css'
import '@fontsource/arimo/hebrew-500.css'
import '@fontsource/arimo/hebrew-700.css'
import '@fontsource/arimo/hebrew-400-italic.css'
import '@fontsource/arimo/hebrew-500-italic.css'
import '@fontsource/arimo/hebrew-700-italic.css'

import '@fontsource/lora/latin-400.css'
import '@fontsource/lora/latin-500.css'
import '@fontsource/lora/latin-700.css'
import '@fontsource/lora/latin-400-italic.css'
import '@fontsource/lora/latin-500-italic.css'
import '@fontsource/lora/latin-700-italic.css'

import '@fontsource/roboto/latin-400.css'
import '@fontsource/roboto/latin-500.css'
import '@fontsource/roboto/latin-700.css'
import '@fontsource/roboto/latin-400-italic.css'
import '@fontsource/roboto/latin-500-italic.css'
import '@fontsource/roboto/latin-700-italic.css'

require('prismjs/themes/prism-okaidia.css')
require('prismjs/plugins/line-numbers/prism-line-numbers.css')

const React = require('react')

// https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
const isInternetExplorer = /*@cc_on!@*/false || !!document.documentMode
Expand All @@ -14,4 +38,21 @@ export function wrapRootElement({ element }) {
)
}
return element
}
}

export function onRouteUpdate() {
const bt = `
<button
aria-controls='fncontent:<%= id %>'
aria-expanded='false'
aria-label='Footnote <%= number %>'
class='littlefoot__button'
id='<%= reference %>'
rel='footnote'
title='See Footnote <%= number %>'
/>
<%= number %>
</button>
`
littlefoot({ buttonTemplate: bt })
}
62 changes: 20 additions & 42 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ const path = require(`path`)
const { Feeds } = require('./src/consts/rss')

function verifyEnvVar(variable) {
if (activeEnv == 'production' && !process.env[variable]) {
if (activeEnv === "production" && !process.env[variable]) {
throw new Error(`Missing environment variable ${variable}`)
}
}
verifyEnvVar('URL')
verifyEnvVar('GOOGLE_ANALYTICS')
verifyEnvVar('UTTERANCES_REPO')

const fontVariants = ['300', '300i', '400', '400i', '500', '700']
verifyEnvVar("URL")
verifyEnvVar("GOOGLE_ANALYTICS")
verifyEnvVar("UTTERANCES_REPO")

let deployUrl = process.env.DEPLOY_PRIME_URL
if (!deployUrl) {
deployUrl = process.env.URL
}

const demoMode = "true" == String(process.env.DEMO).trim().toLowerCase()
const demoMode = "true" === String(process.env.DEMO).trim().toLowerCase()
console.log(`Running in demo mode? ${demoMode}`)

module.exports = {
Expand Down Expand Up @@ -65,20 +63,20 @@ module.exports = {
{
resolve: 'gatsby-plugin-feed',
options: {
feeds: Object.values(Feeds).map(feed => feed.toPluginOptions(process.env.URL, demoMode)),
// see https://github.com/gatsbyjs/gatsby/issues/16177
setup: ({
query: {
site: { siteMetadata },
},
...rest
}) => {
return {
...siteMetadata,
...rest,
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
},
},
`,
feeds: Object.values(Feeds).map(feed => feed.toPluginOptions(process.env.URL, demoMode)),
}
},
'gatsby-remark-local-links',
{
Expand Down Expand Up @@ -124,34 +122,15 @@ module.exports = {
],
},
},
'gatsby-transformer-sharp',
'gatsby-plugin-image',
'gatsby-plugin-sharp',
'gatsby-transformer-sharp',
{
resolve: 'gatsby-plugin-google-analytics',
options: { trackingId: process.env.GOOGLE_ANALYTICS },
},
{
resolve: 'gatsby-plugin-prefetch-google-fonts',
options: {
fonts: [
{
family: 'Roboto',
variants: fontVariants,
},
{
family: 'Lora',
variants: fontVariants,
},
{
family: 'Arimo',
variants: fontVariants,
},
],
},
},
'gatsby-plugin-sitemap',
'gatsby-plugin-catch-links',
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-plugin-sass',
options: {
Expand Down Expand Up @@ -184,7 +163,6 @@ module.exports = {
minPixelValue: 0,
}),
],
precision: 8,
},
},
{
Expand Down
20 changes: 16 additions & 4 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const Promise = require('bluebird')
const readingTime = require("reading-time")

Expand All @@ -13,7 +12,7 @@ const createPageTemplate = require('./src/templates/PageTemplate/createPages')
const createPostTemplate = require('./src/templates/PostTemplate/createPages')
const createSeriesTemplate = require('./src/templates/PostSeriesTemplate/createPages')

exports.createPages = ({ graphql, actions }) => {
exports.createPages = async ({ graphql, actions }) => {
const { createPage, createRedirect } = actions

const redirects = new Promise((resolve, reject) => {
Expand All @@ -39,18 +38,20 @@ exports.createPages = ({ graphql, actions }) => {
toPath: `/${Languages.English.urlPart}/about`,
redirectInBrowser: true,
})


createRedirect({
fromPath: '/about/',
toPath: `/${Languages.English.urlPart}/about`,
redirectInBrowser: true,
})

createRedirect({
fromPath: '/rss.xml',
toPath: Feeds[Languages.English.id].outputPath,
redirectInBrowser: true,
})

resolve()
})

Expand Down Expand Up @@ -96,3 +97,14 @@ exports.onCreateNode = ({ node, actions }) => {
exports.onCreatePage = ({ page }) => {
page.context.isStaticPage = true
}

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
fallback: {
stream: require.resolve('stream-browserify'),
util: require.resolve('util/'),
},
},
})
}
Loading