Skip to content

Commit 0397388

Browse files
committed
dashboard: switch to vite
1 parent db4efc0 commit 0397388

File tree

9 files changed

+23456
-41181
lines changed

9 files changed

+23456
-41181
lines changed

.github/workflows/build.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ jobs:
1717
run: |
1818
npm ci
1919
npm run build
20-
IFS='/' read -a strarr <<< $GITHUB_REPOSITORY && sed -i "`wc -l < dashboard/package.json`i\,\"homepage\":\"https://${strarr[0]}.github.io/${strarr[1]}\"" dashboard/package.json
21-
NODE_OPTIONS=--max-old-space-size=4096 npm run build -w dashboard
20+
npm run build -w dashboard
2221
- name: Deploy 🚀
2322
uses: JamesIves/github-pages-deploy-action@v4.2.5
2423
with:
2524
branch: gh-pages # The branch the action should deploy to.
26-
folder: dashboard/build # The folder the action should deploy.
25+
folder: dashboard/dist # The folder the action should deploy.

dashboard/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<meta name="description" content="A dashboard for monitoring Wormhole" />
7+
<meta name="theme-color" content="#ffffff" />
8+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
9+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
10+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
11+
<link rel="manifest" href="/site.webmanifest" />
12+
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
13+
<link rel="shortcut icon" href="/favicon.ico" />
14+
<meta name="msapplication-TileColor" content="#da532c" />
15+
<meta name="msapplication-config" content="/browserconfig.xml" />
16+
<title>Wormhole Dashboard</title>
17+
</head>
18+
<body>
19+
<noscript>You need to enable JavaScript to run this app.</noscript>
20+
<div id="root"></div>
21+
<script type="module" src="/src/index.tsx"></script>
22+
</body>
23+
</html>

dashboard/package.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",
2525
"react-router-dom": "^5.3.4",
26-
"react-scripts": "5.0.1",
2726
"react-timeago": "^7.1.0",
28-
"typescript": "^4.7.4",
29-
"use-debounce": "^10.0.0",
30-
"webpack-bundle-analyzer": "^4.10.1"
27+
"use-debounce": "^10.0.0"
3128
},
3229
"scripts": {
33-
"start": "GENERATE_SOURCEMAP=false react-scripts start",
34-
"build": "GENERATE_SOURCEMAP=false react-scripts build",
35-
"eject": "react-scripts eject",
36-
"analyze": "npm run build -- --stats && npx webpack-bundle-analyzer ./build/bundle-stats.json"
30+
"start": "vite",
31+
"build": "tsc && vite build",
32+
"analyze": "vite-bundle-visualizer"
3733
},
3834
"eslintConfig": {
3935
"extends": [
@@ -59,6 +55,12 @@
5955
"@types/numeral": "^2.0.2",
6056
"@types/react-router-dom": "^5.3.3",
6157
"@types/react-timeago": "^4.1.3",
62-
"prettier": "^2.3.2"
58+
"@vitejs/plugin-react": "^4.2.1",
59+
"prettier": "^2.3.2",
60+
"typescript": "^5.4.5",
61+
"vite": "^5.2.11",
62+
"vite-bundle-visualizer": "^1.1.0",
63+
"vite-plugin-svgr": "^4.2.0",
64+
"vite-tsconfig-paths": "^4.3.2"
6365
}
6466
}

dashboard/public/index.html

-22
This file was deleted.

dashboard/src/react-app-env.d.ts

-1
This file was deleted.

dashboard/src/vite-env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

dashboard/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "ESNext",
44
"lib": ["dom", "dom.iterable", "esnext"],
5+
"types": ["vite/client", "vite-plugin-svgr/client"],
56
"allowJs": true,
67
"skipLibCheck": true,
78
"esModuleInterop": true,

dashboard/vite.config.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
import viteTsconfigPaths from 'vite-tsconfig-paths';
4+
import svgr from 'vite-plugin-svgr';
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
base: '/wormhole-dashboard/',
9+
plugins: [
10+
react(),
11+
viteTsconfigPaths(),
12+
svgr({
13+
include: '**/*.svg?react',
14+
}),
15+
],
16+
// https://vitejs.dev/guide/dep-pre-bundling#monorepos-and-linked-dependencies
17+
optimizeDeps: {
18+
include: ['@wormhole-foundation/wormhole-monitor-common'],
19+
},
20+
build: {
21+
commonjsOptions: {
22+
include: [/common/, /node_modules/],
23+
},
24+
},
25+
});

0 commit comments

Comments
 (0)