Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
krzkaczor committed Apr 24, 2024
0 parents commit 7572669
Show file tree
Hide file tree
Showing 895 changed files with 72,827 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
63 changes: 63 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['typestrict', 'plugin:react/recommended', 'plugin:react-hooks/recommended', 'plugin:react/jsx-runtime'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh', 'simple-import-sort', 'unused-imports', 'import'],
rules: {
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
'no-throw-literal': 'error',
'func-style': ['error', 'declaration'],
'react-refresh/only-export-components': ['error', { allowConstantExport: true }],
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true, allowDirectConstAssertionInArrowFunctions: true },
],
'@typescript-eslint/no-useless-constructor': 'error',
// this rule can't find automatically mistakes and needs to be guided
// 'import/no-internal-modules': ['error', { forbid: ['**/utils/*'] }],
'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
'no-console': 'error',
'no-debugger': 'error',
'no-duplicate-imports': 'error',
'no-with': 'error',
'one-var': ['error', { initialized: 'never' }],
'prefer-const': ['error', { destructuring: 'all' }],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'unused-imports/no-unused-imports-ts': 'error',
'no-restricted-imports': ['error', {
'patterns': [{
'group': ['../../../**/*'],
'message': 'consider using @ instead of going too many folders up.'
}]
}],
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
},
overrides: [
{
// react components don't have to have explicit return type
files: ['*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
// react components don't have to have explicit return type
files: ['*.stories.tsx'],
rules: {
'react-refresh/only-export-components': ['off'],
},
},
],
}
141 changes: 141 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: CI

on:
pull_request:
push:
branches:
- main

# when new commit is pushed to a branch, cancel previous runs
# https://stackoverflow.com/a/67939898/580181
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
node: ['20']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install

- run: pnpm build

- uses: krzkaczor/size-limit-action@master
if: github.ref != 'refs/heads/main'
with:
skip_step: build # already built
directory: packages/app
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: pnpm

test:
strategy:
matrix:
node: ['20']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install

- run: pnpm lint
- run: pnpm format
- run: pnpm run test --coverage
- run: pnpm typecheck

storybook-visual-regression:
strategy:
matrix:
node: ['20']
os: [ubicloud-standard-4]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install

- name: Publish to Chromatic
uses: chromaui/action@latest
with:
workingDir: packages/app
buildScriptName: storybook:build
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: main

test-e2e:
strategy:
fail-fast: false
matrix:
node: ['20']
os: [ubicloud-standard-16]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install

- name: TMP fix MS repos
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
- run: pnpm exec playwright install --with-deps chromium
working-directory: ./packages/app
- run: pnpm run test-e2e
working-directory: ./packages/app
env:
TENDERLY_API_KEY: '${{ secrets.TENDERLY_API_KEY }}'
TENDERLY_ACCOUNT: phoenixlabs
TENDERLY_PROJECT: sparklend
PLAYWRIGHT_TRACE: 1
- name: Upload report to GitHub Actions Artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-e2e-report
path: packages/app/playwright-report
retention-days: 3

- uses: krzkaczor/reg-actions@action-v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
image-directory-path: './packages/app/__screenshots-e2e__'
collection-name: 'e2e'
threshold-pixel: 5
matching-threshold: 0.09
48 changes: 48 additions & 0 deletions .github/workflows/flaky-e2e-detector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Flaky E2E tests detector

on:
pull_request:
paths:
- '**/*.test-e2e.*'

# when new commit is pushed to a branch, cancel previous runs
# https://stackoverflow.com/a/67939898/580181
concurrency:
group: flaky-e2e-detector-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test-e2e:
strategy:
matrix:
node: ['20']
os: [ubicloud-standard-16]
runs-on: ${{ matrix.os }}
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm exec playwright install --with-deps chromium
working-directory: ./packages/app
- run: pnpm run test-e2e --repeat-each 4 --retries 2
working-directory: ./packages/app
env:
TENDERLY_API_KEY: '${{ secrets.TENDERLY_API_KEY }}'
TENDERLY_ACCOUNT: phoenixlabs
TENDERLY_PROJECT: sparklend
PLAYWRIGHT_TRACE: 1

- name: Upload report to GitHub Actions Artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: flaky-test-e2e-report
path: packages/app/playwright-report
retention-days: 3
40 changes: 40 additions & 0 deletions .github/workflows/ipfs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Manually triggered IPFS release workflow
name: IPFS Release

on: workflow_dispatch

jobs:
ipfs-release:
strategy:
matrix:
node: ['20']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
# a safe guard to ensure that the workflow is only triggered on the main branch
if: github.ref == 'refs/heads/main'
outputs:
pinata_hash: '${{ steps.pinata.outputs.hash }}'

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8.5.0
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm build

- uses: phoenixlabsresearch/pinata-action@a3409e26f4cb859a2d9984109317caac53db5f68
name: pinata
id: pinata
with:
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }}
PIN_ALIAS: 'app-beta-spark-${{ github.head_ref || github.ref }}'
BUILD_LOCATION: 'packages/app/dist'
CID_VERSION: 1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
.vite
.env
packages/app/.swc
build-storybook.log
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.vscode
package.json
**/dist/**
.vite
packages/app/storybook-static
packages/app/__screenshots__
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 120,
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "always",
"plugins": ["prettier-plugin-tailwindcss"],
"tailwindFunctions": ["cva"]
}
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright 2024 Mars Foundation, a Cayman Islands exempted foundation company

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 7572669

Please sign in to comment.