Skip to content

Commit

Permalink
Merge pull request #11822 from ethereum/dev
Browse files Browse the repository at this point in the history
NextJS migration
  • Loading branch information
corwintines authored Jan 9, 2024
2 parents 3131a03 + 791cf2b commit b160811
Show file tree
Hide file tree
Showing 4,819 changed files with 135,070 additions and 233,288 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
41 changes: 26 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# rename this file to .env and supply the values listed below
# also make sure they are available to the build tool (e.g. Netlify)
# warning: variables prefixed with GATSBY_ will be made available to client-side code
# warning: variables prefixed with NEXT_PUBLIC_ will be made available to client-side code
# be careful not to expose sensitive data (e.g. your Algolia admin key)
ALGOLIA_ADMIN_KEY=insertValue
ETHERSCAN_API_KEY=insertValue
GATSBY_ALGOLIA_APP_ID=insertValue
GATSBY_ALGOLIA_SEARCH_KEY=insertValue
GATSBY_ALGOLIA_BASE_SEARCH_INDEX_NAME=insertValue
GATSBY_GITHUB_TOKEN_READ_ONLY=insertValue
GATSBY_FUNCTIONS_PATH=insertValue

# Build pages only for the specified langs. Leave it empty to build all the langs
# e.g. `en,fr` will only build english and french pages
# Note: always include `en` as it is the default lang of the site
GATSBY_BUILD_LANGS=
# Algolia environment (app ID, search key and base search index name required for search)
# NEXT_PUBLIC_ALGOLIA_APP_ID=insertValue
# NEXT_PUBLIC_ALGOLIA_SEARCH_KEY=insertValue
# NEXT_PUBLIC_ALGOLIA_BASE_SEARCH_INDEX_NAME=insertValue
# NEXT_PUBLIC_GITHUB_TOKEN_READ_ONLY=insertValue

# Etherscan API key (required for Etherscan API fetches)
# ETHERSCAN_API_KEY=insertValue

# Google API key and Calendar ID (required to fetch Calendar events)
# GOOGLE_API_KEY=
# GOOGLE_CALENDAR_ID=

# Folders or files to ignore from the `src/content` folder
IGNORE_CONTENT=**/docs,**/tutorials
# Matomo environment (URL and site ID required for analytics)
NEXT_PUBLIC_MATOMO_URL=
NEXT_PUBLIC_MATOMO_SITE_ID=

# Used to avoid loading Matomo in our preview deploys
IS_PREVIEW_DEPLOY=false
IS_PREVIEW_DEPLOY=false

# Build pages only for the specified langs. Leave it empty to build all the langs
# e.g. `en,fr` will only build English and French pages
# Note: always include `en` as it is the default lang of the site
BUILD_LOCALES=

# If resource constraints are being hit during builds, change LIMIT_CPUS to a
# fixed number of CPUs (e.g. 2) to limit the demand during build time
LIMIT_CPUS=
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# The content is used as a code example in /src/pages/index.js
src/data/CreateWallet.js
.next
dist
node_modules/
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"extends": ["next/core-web-vitals", "prettier", "plugin:storybook/recommended"],
"env": { "es6": true },
"plugins": ["simple-import-sort"],
"rules": {
"simple-import-sort/imports": [
"error",
{
"groups": [
// Node.js builtins.
[
"^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
],
// Packages. `react` related packages come first.
// Also, put `react-icons` in sorting order not with `react`
["^react(?!-.)$", "^\\w", "^@\\w"],
// The Chakra theme directory if imported to story file or other places
["^@/@chakra-ui"],
// From the `types` directory.
["^@/lib/types", "^@/lib/interfaces"],
// From the `components` directory.
["^@/components"],
// From the `utils` directory.
["^@/lib/utils"],
// From the `data` directory.
["^@/data"],
// From the `constants` directory.
["^@/lib/constants"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
["^.+\\.s?css$"],
// Side effect imports.
["^\\u0000"]
]
}
],
"simple-import-sort/exports": "error"
}
}
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* @wackerow @corwintines @pettinarip @minimalsm @nhsz

# Owners of specific files
/src/data/consensus-bounty-hunters.csv @djrtwo @asanso @fredriksvantes
/src/data/consensus-bounty-hunters.json @djrtwo @asanso @fredriksvantes
26 changes: 17 additions & 9 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
"review needed :eyes:":
- src/**/*
- public/*

"documentation :book:":
- README.md

"tooling :wrench:":
- .github/**/*
- src/scripts/*
- netlify.toml
- src/lib/*
- src/hooks/*

"dependencies :package:":
- package.json
- yarn.lock

"internal :house:":
- gatsby-browser.js
- gatsby-config.js
- gatsby-node.js
- gatsby-ssr.js
- .all-contributorsrc
- i18n.config.json
- next.config.js
- next-i18next.config,js
- next-sitemap.config.js
- tsconfig.json
- .nvmrc
- .eslintignore
- .eslintrc.json
- .prettierignore
- .prettierrc
- netlify.toml

"translation :earth_africa:":
- src/content/translations/**/*
- src/intl/*
- src/utils/translations.js
- src/intl/**/*
- src/lib/utils/translations.ts

"content :fountain_pen:":
- src/pages/*
- src/pages-conditional/*
- src/content/**/*
- public/content/**/*

"event :date:":
- src/data/community-events.json
5 changes: 2 additions & 3 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ on:
# Only run on file changes in any of these paths
- "src/components/**/*"
- "src/pages/**/*"
- "src/pages-conditional/**/*"
- "src/templates/**/*"
- "src/@chakra-ui/gatsby-plugin/**/*"
- "src/layouts/**/*"
- "src/@chakra-ui/**/*"

# List of jobs
jobs:
Expand Down
109 changes: 33 additions & 76 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,91 +1,48 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript
# dependencies
/node_modules
/.pnp
.pnp.js

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# testing
/coverage

# Dependency directories
node_modules/
jspm_packages/
# next.js
/.next/
/out/

# Typescript v1 declaration files
typings/
# production
/build

# Optional npm cache directory
.npm
# misc
.DS_Store
*.pem

# Optional eslint cache
.eslintcache
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional REPL history
.node_repl_history
# local env files
.env*.local
.env

# Output of 'npm pack'
*.tgz
# vercel
.vercel

# dotenv environment variable files
.env
# typescript
*.tsbuildinfo
next-env.d.ts

# gatsby files
.cache/
public
# rss feeds
feed.xml

# Mac files
.DS_Store
# Sitemaps
sitemap*.xml

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
# Robots.txt
robots.txt

# Local Netlify folder
.netlify

# Custom build files
# This file is generated by `yarn copy-contributors` command
src/data/contributors.json
# These files are generated by `yarn merge-translations` command
src/intl/*.json
i18n/locales
i18n/merged
# Auto generated code when gatsby build the site
src/gatsby-types.d.ts

# Exported Crowdin files
.crowdin

# vscode workplace configuration
.vscode

# storybook static files
storybook-static/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
8 changes: 5 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.cache
package.json
.next
node_modules
yarn.lock
package-lock.json
public
public
build
18 changes: 0 additions & 18 deletions .storybook/babel-storybook-config.ts

This file was deleted.

19 changes: 10 additions & 9 deletions .storybook/i18next.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18n, { Resource } from "i18next"
import { initReactI18next } from "gatsby-plugin-react-i18next"
import { initReactI18next } from "react-i18next"

export const baseLocales = {
en: { title: "English", left: "En" },
Expand All @@ -21,30 +21,31 @@ const ns = [
const supportedLngs = Object.keys(baseLocales)

/**
* Taking the ns array and combining all the ids
* under a single ns per language, set to the default of "translation"
* Taking the ns array and generating those files for each language available.
*/
const resources: Resource = ns.reduce((acc, n) => {
supportedLngs.forEach((lng) => {
if (!acc[lng]) acc[lng] = {}

try {
acc[lng] = {
translation: {
...acc[lng].translation,

...acc[lng],
[n]: {
...acc[lng][n],
...require(`../src/intl/${lng}/${n}.json`),
},
}
} catch {
acc[lng] = {
translation: {
...acc[lng].translation,

...acc[lng],
[n]: {
...acc[lng][n],
...require(`../src/intl/en/${n}.json`),
},
}
}
})

return acc
}, {})

Expand Down
Loading

0 comments on commit b160811

Please sign in to comment.