-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e3c4d51
Showing
130 changed files
with
12,681 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
*.css | ||
*.scss | ||
*.svg | ||
*.png | ||
*.json | ||
*.log | ||
*.lock | ||
*.md | ||
*.ico | ||
*.ttf | ||
*.xml | ||
*.txt | ||
*.html | ||
*.webmanifest | ||
*.tsconfig.json | ||
*.tsbuildinfo | ||
*.woff2 | ||
build | ||
dist | ||
LICENSE | ||
postcss.config.js | ||
public/lottie/player.js | ||
README.md | ||
vite.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:import/recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:mdx/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"arrowFunctions": true | ||
}, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": [ | ||
"react", | ||
"@typescript-eslint", | ||
"prefer-arrow-functions", | ||
"unused-imports" | ||
], | ||
"rules": { | ||
// NOTE: These rules are being reviewed and comments justifying their deactivation will be | ||
// added. | ||
"react/require-default-props": "off", | ||
"react/no-access-state-in-setstate": "off", | ||
"react/destructuring-assignment": "off", | ||
"react/function-component-definition": "off", | ||
"react/jsx-no-constructed-context-values": "off", | ||
"react/no-array-index-key": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"react/jsx-props-no-spreading": "off", | ||
"react/jsx-no-useless-fragment": "off", | ||
"react/static-property-placement": "off", | ||
"no-unused-vars": "off", | ||
"no-param-reassign": "off", | ||
"no-restricted-syntax": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"no-promise-executor-return": "off", | ||
"prefer-destructuring": "off", | ||
"no-nested-ternary": "off", | ||
// `continue` statements cut down on conditional nesting and improve readability where it is | ||
// used in this project. Conditionals would further bloat the code. | ||
"no-continue": "off", | ||
// Unary operators are not impacting code as semi-colons are currently enforced. | ||
"no-plusplus": "off", | ||
// Default imports cause naming inconsistencies to imports when component names are changed. | ||
"import/prefer-default-export": "off", | ||
|
||
"unused-imports/no-unused-imports": "error", | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"error", | ||
{ | ||
"prefer": "type-imports", | ||
"fixStyle": "separate-type-imports" | ||
} | ||
], | ||
"react/jsx-filename-extension": [ | ||
"warn", | ||
{ | ||
"extensions": [".tsx", ".mdx"] | ||
} | ||
], | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"@typescript-eslint/no-shadow": ["error"], | ||
"prefer-arrow-functions/prefer-arrow-functions": [ | ||
"warn", | ||
{ | ||
"classPropertiesAllowed": false, | ||
"disallowPrototype": false, | ||
"returnStyle": "unchanged", | ||
"singleReturnOnly": false | ||
} | ||
], | ||
"react/prop-types": "off" | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"typescript": {} | ||
} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.mdx"], | ||
"rules": { | ||
"no-undef": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
* @wirednkod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
check-license-lines: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Check License Lines | ||
uses: kt3k/[email protected] | ||
validate-locales: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
# TODO: Disable locale:validation for now | ||
# - run: yarn run locale:validate | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn lint | ||
- run: yarn test | ||
|
||
all: | ||
# This job ensures that all jobs above (now we have just build) are successful. | ||
needs: [check-license-lines, build, validate-locales] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo Success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
build | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"**/*.{js, ts, tsx}": [ | ||
"// Copyright 2023 @polkadot-blockchain-academy/alumni-hub authors & contributors", | ||
"// SPDX-License-Identifier: GPL-3.0-only" | ||
], | ||
"ignore": ["testdata", "npm", "public/", "Dockerfile"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
**/build | ||
**/dist | ||
**/node_modules | ||
**/package.json | ||
**/yarn.lock | ||
**/package-lock.json | ||
**/.eslintrc.js | ||
**/tsconfig.json | ||
**/tstsconfig.tsbuildinfo | ||
|
||
src/img/**/* | ||
public/lottie/player.js | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"arrowParens": "always", | ||
"semi": false, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2023 @polkadot-blockchain-academy/alumni-hub authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
const fs = require("fs") | ||
const path = require("path") | ||
const prettier = require("prettier") | ||
const { getDirectories, localeDir, orderJsonByKeys } = require("./utils.cjs") | ||
|
||
// Get all language paths to re-order. | ||
const languages = getDirectories(localeDir, []) | ||
|
||
// Gor each language path. | ||
for (const lng of languages) { | ||
const pathToLanguage = path.join(localeDir, `/${lng}`) | ||
|
||
fs.readdir(pathToLanguage, (error, files) => { | ||
if (error) return | ||
|
||
files.forEach(async (file) => { | ||
const pathToFile = path.join(pathToLanguage, file) | ||
const json = JSON.parse(fs.readFileSync(pathToFile).toString()) | ||
|
||
// order json object alphabetically. | ||
const orderedJson = orderJsonByKeys(json) | ||
|
||
// format json object. | ||
const formatted = await prettier.format(JSON.stringify(orderedJson), { | ||
parser: "json", | ||
}) | ||
|
||
fs.writeFile(pathToFile, formatted, (err) => { | ||
if (err) { | ||
console.err(err) | ||
} else { | ||
console.log( | ||
`----------Keys In ${pathToLanguage}/${file} Are Ordered Alphabetically-------------` | ||
) | ||
} | ||
}) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright 2023 @polkadot-blockchain-academy/alumni-hub authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
const fs = require("fs") | ||
const { join } = require("path") | ||
const { | ||
getDeepKeys, | ||
getDirectories, | ||
localeDir, | ||
orderJsonByKeys, | ||
} = require("./utils.cjs") | ||
|
||
// Missing key validation function. | ||
const validateMissingKeys = () => { | ||
const defaultPath = join(localeDir, "en") | ||
const languages = getDirectories(localeDir, ["en"]) | ||
|
||
fs.readdir(defaultPath, (error, files) => { | ||
if (error) console.log(error) | ||
|
||
files.forEach((file) => { | ||
const defaultJson = JSON.parse( | ||
fs.readFileSync(join(defaultPath, file)).toString() | ||
) | ||
|
||
for (const lng of languages) { | ||
const otherPath = join(localeDir, lng) | ||
const otherJson = JSON.parse( | ||
fs.readFileSync(join(otherPath, file)).toString() | ||
) | ||
|
||
const a = getDeepKeys(defaultJson) | ||
const b = getDeepKeys(otherJson) | ||
|
||
if (a.sort().length !== b.sort().length) { | ||
const missing = a.filter((item) => b.indexOf(item) < 0) | ||
if (missing.join("").trim().length > 0) { | ||
throw new Error( | ||
`Missing the following keys from locale "${lng}", file: "${file}":\n"${missing}".` | ||
) | ||
} | ||
} | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
// Key order validation function. | ||
const validateKeyOrder = () => { | ||
// get all language paths to re-order. | ||
const languages = getDirectories(localeDir, []) | ||
|
||
for (const lng of languages) { | ||
const pathToLanguage = join(localeDir, `/${lng}`) | ||
|
||
fs.readdir(pathToLanguage, (error, files) => { | ||
if (error) return | ||
|
||
files.forEach((file) => { | ||
const pathToFile = join(pathToLanguage, file) | ||
const json = JSON.parse(fs.readFileSync(pathToFile).toString()) | ||
|
||
// order json object alphabetically. | ||
const orderedJson = orderJsonByKeys(json) | ||
if (JSON.stringify(json) !== JSON.stringify(orderedJson)) { | ||
throw new Error( | ||
`Keys are in the incorrect order from locale "${lng}", file: "${file}".` | ||
) | ||
} | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
// validate missing keys | ||
validateMissingKeys() | ||
// validate key order | ||
validateKeyOrder() |
Oops, something went wrong.