Skip to content

Commit

Permalink
Include connect v1 and a common lib
Browse files Browse the repository at this point in the history
  • Loading branch information
yuli-ferna committed Sep 10, 2024
1 parent 4a50f27 commit 277deac
Show file tree
Hide file tree
Showing 123 changed files with 73,527 additions and 100 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,79 @@ jobs:
name: build-token-bridge
path: connect-loader/apps/connect/dist

token-bridge-v1:
name: "Token Bridge v1"
runs-on: "ubuntu-latest"
concurrency:
group: ${{ github.ref }}-${{inputs.name}}-token-bridge-v1
cancel-in-progress: true
environment: ${{inputs.environment}}
outputs:
pkg-version: ${{ steps.set-version.outputs._PKG_VERSION }}
steps:
- name: Set up Node environment
uses: actions/setup-node@v3
with:
node-version: v18.17.1
# - name: Checkout Wormhole Connect
# uses: actions/checkout@v3
# with:
# repository: wormhole-foundation/wormhole-connect
# ref: ${{inputs.connect-branch}}
# path: wormhole-connect
# - name: Build Wormhole Connect
# id: wormhole-connect
# run: |
# npm install -g husky
# pushd wormhole-connect
# npm ci --workspaces --if-present
# sed -i -e 's|vite build",|vite build --base=${{inputs.public-url}}/assets/wormhole-connect/",|g' wormhole-connect/package.json
# npm run build
# echo "_JS_SHA_384=$(shasum -b -a 384 wormhole-connect/dist/main.js | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}"
# echo "_CSS_SHA_384=$(shasum -b -a 384 wormhole-connect/dist/main.css | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}"
- name: Checkout Custom Wormhole Connect Loader
uses: actions/checkout@v3
with:
ref: ${{ inputs.project-branch }}
path: connect-loader
- name: Setup Git
run: |
pushd connect-loader
git config user.name "xLabs CI"
git config user.email "devops@xlabs.xyz"
- name: Set Portal Bridge Version
id: set-version
run: |
pushd connect-loader/apps/connect-v1
echo "_PKG_VERSION=$(node -p -e "require('./package.json').version")-${{inputs.separator}}$(echo ${{ github.sha }} | cut -c -10)" >> "${GITHUB_OUTPUT}"
- name: Build Custom Wormhole Connect Loader
env:
PUBLIC_URL: "${{ inputs.public-url }}"
VITE_PUBLIC_URL: ${{ inputs.public-url }}
VITE_APP_VERSION: ${{ steps.set-version.outputs._PKG_VERSION }}
VITE_APP_CLUSTER: ${{ vars.REACT_APP_CLUSTER }}
# VITE_APP_JS_WC_INTEGRITY_SHA_384: ${{ steps.wormhole-connect.outputs._JS_SHA_384 }}
# VITE_APP_CSS_WC_INTEGRITY_SHA_384: ${{ steps.wormhole-connect.outputs._CSS_SHA_384 }}
VITE_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }}
run: |
pushd connect-loader
npm ci
pushd connect-loader/apps/connect-v1
echo 'VITE_APP_VERSION=$npm_package_version' > .env
npm run build:token-bridge
- name: Upload Portal Bridge Artifact
uses: actions/upload-artifact@v3
with:
name: build-token-bridge-v1
path: connect-loader/apps/connect-v1/dist

publish:
name: "Publish"
needs:
- advanced-tools
- usdc-bridge
- token-bridge
- token-bridge-v1
- rewards-dashboard
- redirects
- docs
Expand All @@ -324,6 +391,11 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build-token-bridge
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: build-token-bridge-v1
path: tbtc-bridge
- name: Download Artifact
uses: actions/download-artifact@v3
with:
Expand Down
24 changes: 24 additions & 0 deletions apps/common-library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
50 changes: 50 additions & 0 deletions apps/common-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
28 changes: 28 additions & 0 deletions apps/common-library/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
13 changes: 13 additions & 0 deletions apps/common-library/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit 277deac

Please sign in to comment.