Skip to content

Commit d68bfe3

Browse files
committed
Merge branch 'dev' into pr/5309
2 parents 2c40fe1 + 1eec1a8 commit d68bfe3

File tree

826 files changed

+87775
-17787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

826 files changed

+87775
-17787
lines changed

.all-contributorsrc

+368-4
Large diffs are not rendered by default.

.env.example

+9
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ ETHERSCAN_API_KEY=insertValue
88
GATSBY_ALGOLIA_APP_ID=insertValue
99
GATSBY_ALGOLIA_SEARCH_KEY=insertValue
1010
GATSBY_GITHUB_TOKEN_READ_ONLY=insertValue
11+
GATSBY_FUNCTIONS_PATH=insertValue
12+
13+
# Build pages only for the specified langs. Leave it empty to build all the langs
14+
# e.g. `en,fr` will only build english and french pages
15+
# Note: always include `en` as it is the default lang of the site
16+
GATSBY_BUILD_LANGS=
17+
18+
# Folders or files to ignore from the `src/content` folder
19+
IGNORE_CONTENT=**/docs,**/tutorials

README.md

+58-7
Large diffs are not rendered by default.

gatsby-config.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
const translations = require("./src/utils/translations")
21
require("dotenv").config()
32

4-
const supportedLanguages = translations.supportedLanguages
3+
const { supportedLanguages, allLanguages } = require("./src/utils/translations")
4+
55
const defaultLanguage = `en`
66
const siteUrl = `https://ethereum.org`
77

8+
const ignoreContent = (process.env.IGNORE_CONTENT || "")
9+
.split(",")
10+
.filter(Boolean)
11+
12+
const ignoreTranslations = Object.keys(allLanguages)
13+
.filter((lang) => !supportedLanguages.includes(lang))
14+
.map((lang) => `**/translations\/${lang}`)
15+
816
module.exports = {
917
siteMetadata: {
1018
// `title` & `description` pulls from respective ${lang}.json files in PageMetadata.js
@@ -126,6 +134,10 @@ module.exports = {
126134
// The plugin must be listed top-level & in gatsbyRemarkPlugins
127135
// See: https://www.gatsbyjs.org/docs/mdx/plugins/
128136
gatsbyRemarkPlugins: [
137+
{
138+
// Local plugin to adjust the images urls of the translated md files
139+
resolve: require.resolve(`./plugins/gatsby-remark-image-urls`),
140+
},
129141
{
130142
resolve: `gatsby-remark-autolink-headers`,
131143
options: {
@@ -180,6 +192,7 @@ module.exports = {
180192
options: {
181193
name: `content`,
182194
path: `${__dirname}/src/content`,
195+
ignore: [...ignoreContent, ...ignoreTranslations],
183196
},
184197
},
185198
// Source data

gatsby-node.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
256256
slug.includes(`/cookie-policy/`) ||
257257
slug.includes(`/privacy-policy/`) ||
258258
slug.includes(`/terms-of-use/`) ||
259-
slug.includes(`/contributing/`)
259+
slug.includes(`/contributing/`) ||
260+
slug.includes(`/style-guide/`)
260261
const language = node.frontmatter.lang
261262
if (!language) {
262263
throw `Missing 'lang' frontmatter property. All markdown pages must have a lang property. Page slug: ${slug}`
@@ -282,6 +283,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
282283
context: {
283284
slug: langSlug,
284285
ignoreTranslationBanner: isLegal,
286+
isLegal: isLegal,
285287
isOutdated: false,
286288
isContentEnglish: true,
287289
relativePath: relativePath, // Use English path for template MDX query
@@ -413,6 +415,14 @@ exports.createSchemaCustomization = ({ actions }) => {
413415
location: String
414416
type: String
415417
link: String
418+
address: String
419+
skill: String
420+
published: String
421+
sourceUrl: String
422+
source: String
423+
author: String
424+
tags: [String]
425+
isOutdated: Boolean
416426
}
417427
type ConsensusBountyHuntersCsv implements Node {
418428
username: String,
@@ -421,6 +431,13 @@ exports.createSchemaCustomization = ({ actions }) => {
421431
}
422432
`
423433
createTypes(typeDefs)
434+
435+
// Optimization. Ref: https://www.gatsbyjs.com/docs/scaling-issues/#switch-off-type-inference-for-sitepagecontext
436+
createTypes(`
437+
type SitePage implements Node @dontInfer {
438+
path: String!
439+
}
440+
`)
424441
}
425442

426443
// Build lambda functions when the build is complete and the `/public` folder exists

netlify.toml

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@
1616
# Directory with the serverless Lambda functions to deploy to AWS.
1717
# netlify-lambda needs this netlify.toml file in order to build
1818
functions = "public/functions"
19+
20+
[[headers]]
21+
for = "/*"
22+
[headers.values]
23+
Access-Control-Allow-Origin = "https://esp.ethereum.foundation"

package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethereum-org-website",
3-
"version": "3.11.0",
3+
"version": "3.16.0",
44
"description": "Website of ethereum.org",
55
"main": "index.js",
66
"repository": "[email protected]:ethereum/ethereum-org-website.git",
@@ -21,7 +21,7 @@
2121
"dotenv": "^8.2.0",
2222
"ethereum-blockies-base64": "^1.0.2",
2323
"framer-motion": "^4.1.3",
24-
"gatsby": "^4.0.0",
24+
"gatsby": "^4.6.0",
2525
"gatsby-plugin-gatsby-cloud": "^4.3.0",
2626
"gatsby-plugin-image": "^2.0.0",
2727
"gatsby-plugin-intl": "^0.3.3",
@@ -43,12 +43,13 @@
4343
"gatsby-transformer-gitinfo": "^1.1.0",
4444
"gatsby-transformer-remark": "^3.0.0",
4545
"gatsby-transformer-sharp": "^4.0.0",
46+
"is-relative-url": "^3.0.0",
4647
"lodash": "^4.17.21",
4748
"luxon": "^1.24.1",
4849
"netlify-lambda": "^2.0.3",
4950
"polished": "^4.1.4",
5051
"prism-react-renderer": "^1.1.1",
51-
"prismjs": "^1.25.0",
52+
"prismjs": "^1.27.0",
5253
"react": "17.0.2",
5354
"react-countdown": "^2.3.2",
5455
"react-dom": "17.0.2",
@@ -59,7 +60,8 @@
5960
"react-select": "^4.3.0",
6061
"recharts": "1.8.5",
6162
"styled-components": "^5.1.1",
62-
"styled-system": "^5.1.5"
63+
"styled-system": "^5.1.5",
64+
"unist-util-visit-parents": "^2.1.2"
6365
},
6466
"devDependencies": {
6567
"babel-jest": "^26.6.3",
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require("path")
2+
const visitWithParents = require("unist-util-visit-parents")
3+
const isRelativeUrl = require("is-relative-url")
4+
5+
/**
6+
* Modify the images urls on translated md files to point to the source ones.
7+
*
8+
* E.g.
9+
* Before
10+
* - Source file: ./image.png
11+
* - Translated file: ./image.png
12+
*
13+
* After
14+
* - Source file: ./image.png
15+
* - Translated file: ../path/to/source/image.png
16+
*/
17+
module.exports = ({ markdownNode, markdownAST }) => {
18+
const fileAbsoluteDir = path.dirname(markdownNode.fileAbsolutePath)
19+
const sourceAbsoluteDir = fileAbsoluteDir.replace(
20+
/translations\/\w{2}(-\w{2})?\//,
21+
""
22+
)
23+
const relativePath = path.relative(fileAbsoluteDir, sourceAbsoluteDir)
24+
25+
// if it is not a translated file, skip it
26+
if (!fileAbsoluteDir.includes("/translations")) {
27+
return markdownAST
28+
}
29+
30+
// loop for each image node in the mdx file
31+
visitWithParents(markdownAST, ["image"], (node) => {
32+
const isRelativeToMdFile = isRelativeUrl(node.url)
33+
if (isRelativeToMdFile) {
34+
const fileName = path.basename(node.url)
35+
node.url = `${relativePath}/${fileName}`
36+
}
37+
})
38+
39+
return markdownAST
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "gatsby-remark-image-urls",
3+
"version": "1.0.0",
4+
"description": "Set correct images urls in translated md files",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build": "echo \"No build script setup\""
9+
},
10+
"keywords": [
11+
"gatsby",
12+
"gatsby-plugin",
13+
"image",
14+
"markdown",
15+
"remark"
16+
]
17+
}

redirects.json

+8
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@
307307
"fromPath": "/*/developers/docs/layer-2-scaling",
308308
"toPath": "/:splat/developers/docs/scaling"
309309
},
310+
{
311+
"fromPath": "/*/developers/docs/scaling/layer-2-rollups",
312+
"toPath": "/:splat/developers/docs/scaling"
313+
},
310314
{
311315
"fromPath": "/*/about/web-developer",
312316
"toPath": "/:splat/about/#open-jobs"
@@ -315,6 +319,10 @@
315319
"fromPath": "/*/about/community-lead",
316320
"toPath": "/:splat/about/#open-jobs"
317321
},
322+
{
323+
"fromPath": "/*/about/product-designer",
324+
"toPath": "/:splat/about/#open-jobs"
325+
},
318326
{
319327
"fromPath": "/*/use",
320328
"toPath": "/:splat/dapps/"

src/api/coinmetrics.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { lambda } from "../lambda/coinmetrics"
2+
3+
async function handler(__req, res) {
4+
const { statusCode, body } = await lambda()
5+
res.status(statusCode).send(body)
6+
}
7+
8+
export default handler

src/api/defipulse.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/defipulse"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.DEFI_PULSE_API_KEY)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler

src/api/etherscan.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/etherscan"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.ETHERSCAN_API_KEY)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler

src/api/etherscanBlock.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/etherscanBlock"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.ETHERSCAN_API_KEY)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler

src/api/roadmap.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/roadmap"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.GITHUB_TOKEN)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler

src/api/translations.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/translations"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.CROWDIN_API_KEY)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler

src/api/txs.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lambda } from "../lambda/txs"
2+
3+
async function handler(__req, res) {
4+
// passing env vars as arguments due to a bug on GC functions where env vars
5+
// can not be accessed by imported functions
6+
const { statusCode, body } = await lambda(process.env.ETHERSCAN_API_KEY)
7+
res.status(statusCode).send(body)
8+
}
9+
10+
export default handler
228 KB
Loading
+30
Loading

src/assets/dev-tools/hardhat.png

1.18 MB
Loading

src/assets/wallets/ledger.png

4.31 KB
Loading

src/components/AssetDownload.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react"
22
import styled from "styled-components"
3-
import { GatsbyImage, getImage } from "gatsby-plugin-image"
3+
import { GatsbyImage, getImage, getSrc } from "gatsby-plugin-image"
44
import Emoji from "./Emoji"
55

66
import Translation from "../components/Translation"
@@ -67,9 +67,10 @@ const AssetDownload = ({
6767
src,
6868
shouldHide = false,
6969
title,
70+
isSvg = false,
7071
}) => {
7172
const baseUrl = `https://ethereum.org`
72-
const downloadUri = src ? src : getImage(image)?.images.fallback.src
73+
const downloadUri = src ? src : getSrc(image)
7374
const downloadUrl = `${baseUrl}${downloadUri}`
7475

7576
return (
@@ -79,7 +80,11 @@ const AssetDownload = ({
7980
{children && <ImageContainer>{children}</ImageContainer>}
8081
{!children && (
8182
<ImageContainer>
82-
<Image image={getImage(image)} alt={alt} />
83+
{isSvg ? (
84+
<img src={image} alt={alt} />
85+
) : (
86+
<Image image={getImage(image)} alt={alt} />
87+
)}
8388
</ImageContainer>
8489
)}
8590
{artistName && (
@@ -94,9 +99,11 @@ const AssetDownload = ({
9499
)}
95100
</div>
96101
<ButtonContainer>
97-
<ButtonLink to={downloadUrl}>
98-
<Translation id="page-assets-download-download" />
99-
</ButtonLink>
102+
{!isSvg && (
103+
<ButtonLink to={downloadUrl}>
104+
<Translation id="page-assets-download-download" />
105+
</ButtonLink>
106+
)}
100107
</ButtonContainer>
101108
</Container>
102109
)

0 commit comments

Comments
 (0)