Skip to content

Commit

Permalink
initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Feb 27, 2024
1 parent 117dbb1 commit 4a1d50c
Show file tree
Hide file tree
Showing 880 changed files with 90,341 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version = 1

[[analyzers]]
name = "secrets"

[[analyzers]]
name = "test-coverage"

[[analyzers]]
name = "javascript"

[analyzers.meta]
plugins = ["react"]
environment = [
"nodejs",
"browser",
"jest"
]

[[transformers]]
name = "prettier"
2 changes: 2 additions & 0 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignores: ["eslint", "babel-*", "turbo"]
skip-missing: true
5 changes: 5 additions & 0 deletions .earthlyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Generated by @zondax/cli
#
node_modules
.next
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.{md,patch}]
trim_trailing_whitespace = false
25 changes: 25 additions & 0 deletions .env.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY="0x4AAAAAAABQfy0zavr33S8R"

# DO NOT ENABLE BECAUSE IT WILL AFFECT OUR METRICS
# NEXT_PUBLIC_GA_TRACKING_ID='G-QV8K7F489E'

# Turnstile Special Tokens
# https://developers.cloudflare.com/turnstile/frequently-asked-questions/

# Mostly configuration related
NEXT_PUBLIC_NAT_SERVER="wss://stream.zondax.ch"
GHOST_API_URL="https://zondax.mymidnight.blog"

# Not sensitive
NEXT_PUBLIC_NAT_SERVER_CREDENTIAL="LS0tLS1CRUdJTiBOQVRTIFVTRVIgSldULS0tLS0KZXlKMGVYQWlPaUpLVj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VWWjUyUVBJSDdNSFlCUVk2REI2NUJHSzZEWFpFNVBQNVEKLS0tLS0tRU5EIFVTRVIgTktFWSBTRUVELS0tLS0tCgoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCg"
NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY="3x00000000000000000000FF"

# Sensitive - Must fill in
NEXT_PUBLIC_MUI_GRID_LICENSE=""
GHOST_API_KEY=""
## Special secret key to pass all verifications
CLOUDFLARE_TURNSTILE_SECRET_KEY="1x0000000000000000000000000000000AA"

# Local dev
## Must get you API token on https://docs.zondax.ch/beryx-api
BERYX_API_TOKEN=""
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
node_modules
public

55 changes: 55 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["next/core-web-vitals", "prettier", "turbo"],
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["unused-imports", "@typescript-eslint", "eslint-plugin-tsdoc", "react", "promise"],
"rules": {
"tsdoc/syntax": "off",
"no-restricted-imports": [
"warn",
{
"patterns": [
{
"group": ["@mui/(?!material/styles/createTypography)\\w+/\\w+/\\w+"],
"message": "Importing from subdirectories is restricted. Use top-level exports where available."
}
],
"paths": [
{
"name": "@reduxjs/toolkit",
"message": "Please do not use Redux Toolkit, migrate to zustand."
},
{
"name": "react-transition-group",
"message": "Migrate to MUI or similar. This package is not well maintained."
}
]
}
],
"curly": "error",
"prefer-const": "error",
"no-else-return": "error",
"complexity": ["error", 40],
"no-unneeded-ternary": "error",
"no-alert": "error",
"no-empty": "error",
"no-useless-catch": "error",
"require-await": "error",
"no-continue": "error",
"react/no-unescaped-entities": "error",
"promise/prefer-await-to-then": "error",
"react-hooks/exhaustive-deps": "error",
///
"no-console": "error",
"unused-imports/no-unused-imports": "error",
// "@typescript-eslint/naming-convention": "warn",
"no-magic-numbers": "off"
}
}
27 changes: 27 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Common .gitattributes file courtesy of
# https://github.com/alexkaratarakis/gitattributes/blob/master/Common.gitattributes

# Auto detect text files and perform LF normalization
* text=auto eol=lf

# The above will handle all files NOT found below

# Documents
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text

# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default.
#*.svg binary
*.svg text
*.eps binary
52 changes: 52 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Audit Checks'
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
cancel-in-progress: true

jobs:
audit:
name: Audit dependencies
runs-on: zondax-runners
container:
image: node:18-bookworm
env:
PROJECT: web-beryx
NAMESPACE: web-beryx
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HEAD_BRANCH_NAME: ${{ github.head_ref }}
GHOST_API_URL: ${{ secrets.GHOST_API_URL }}
GHOST_API_KEY: ${{ secrets.GHOST_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: zondax
NEXT_PUBLIC_NAT_SERVER_CREDENTIAL: ${{ secrets.NEXT_PUBLIC_NAT_SERVER_CREDENTIAL }}
NEXT_PUBLIC_NAT_SERVER: ${{ secrets.NEXT_PUBLIC_NAT_SERVER }}
NEXT_PUBLIC_MUI_GRID_LICENSE: ${{ secrets.NEXT_PUBLIC_MUI_GRID_LICENSE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # Perform a deep clone (fetch all history)
submodules: 'recursive' # Fetch Git submodules recursively

# Related to https://github.com/actions/runner/issues/2033
- name: Patch git clone
run: git config --system --add safe.directory '*'

- name: Install dependencies
run: yarn install

- name: Audit dependencies
run: yarn npm audit
80 changes: 80 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: 'Quality Checks'
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
cancel-in-progress: true

jobs:
checks:
name: Checks
runs-on: zondax-runners
container:
image: node:18-bookworm
env:
PROJECT: web-beryx
NAMESPACE: web-beryx
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HEAD_BRANCH_NAME: ${{ github.head_ref }}
GHOST_API_URL: ${{ secrets.GHOST_API_URL }}
GHOST_API_KEY: ${{ secrets.GHOST_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: zondax
NEXT_PUBLIC_NAT_SERVER_CREDENTIAL: ${{ secrets.NEXT_PUBLIC_NAT_SERVER_CREDENTIAL }}
NEXT_PUBLIC_NAT_SERVER: ${{ secrets.NEXT_PUBLIC_NAT_SERVER }}
NEXT_PUBLIC_MUI_GRID_LICENSE: ${{ secrets.NEXT_PUBLIC_MUI_GRID_LICENSE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # Perform a deep clone (fetch all history)
submodules: 'recursive' # Fetch Git submodules recursively

# Related to https://github.com/actions/runner/issues/2033
- name: Patch git clone
run: git config --system --add safe.directory '*'

- name: Install dependencies
run: yarn install

- name: Run formatter
run: npx turbo format:check

- name: Run linter
run: npx turbo lint

- name: Ensure we can generate docs
run: yarn docs

- name: Ensure we can generate ladle
run: yarn ladle build

- name: Run build
run: npx turbo build

- name: Run Tests
run: npx turbo test
env:
CLOUDFLARE_PROTECTED_API_CLIENT_ID: ${{ secrets.CLOUDFLARE_PROTECTED_API_CLIENT_ID }}
CLOUDFLARE_PROTECTED_API_CLIENT_SECRET: ${{ secrets.CLOUDFLARE_PROTECTED_API_CLIENT_SECRET }}

- name: Install deepsource
run: curl -L deepsource.io/cli | sh
# we need the -L because cloudflare may apply a redirect

- name: Send coverage to deepsource
run: ./bin/deepsource report --analyzer test-coverage --key javascript --value-file $(pwd)/coverage/cobertura-coverage.xml
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
56 changes: 56 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lighthouse
on:
push:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
cancel-in-progress: true

jobs:
lighthouseci:
name: Lighthouse metrics
runs-on: zondax-runners
container:
image: node:18-bookworm
env:
PROJECT: web-beryx
NAMESPACE: web-beryx
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HEAD_BRANCH_NAME: ${{ github.head_ref }}
GHOST_API_URL: ${{ secrets.GHOST_API_URL }}
GHOST_API_KEY: ${{ secrets.GHOST_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: zondax
NEXT_PUBLIC_NAT_SERVER_CREDENTIAL: ${{ secrets.NEXT_PUBLIC_NAT_SERVER_CREDENTIAL }}
NEXT_PUBLIC_NAT_SERVER: ${{ secrets.NEXT_PUBLIC_NAT_SERVER }}
NEXT_PUBLIC_MUI_GRID_LICENSE: ${{ secrets.NEXT_PUBLIC_MUI_GRID_LICENSE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # Perform a deep clone (fetch all history)
submodules: 'recursive' # Fetch Git submodules recursively

# Related to https://github.com/actions/runner/issues/2033
- name: Patch git clone
run: git config --system --add safe.directory '*'

- name: Install dependencies
run: yarn install

- name: Run build
run: npx turbo build

- name: Install Chrome Browser
run: npx playwright install chrome

- run: yarn lhci collect

- run: yarn lhci upload
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
Loading

0 comments on commit 4a1d50c

Please sign in to comment.