Use bun for web3proxy and webui

This commit is contained in:
2025-12-13 17:46:25 +07:00
parent c4e444347c
commit 588927678c
16 changed files with 6692 additions and 11326 deletions

View File

@@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
- uses: oven-sh/setup-bun@v1
with:
node-version: '18.1.0'
- run: yarn install
- run: yarn build
bun-version: '1.3'
- run: bun install
- run: bun run build

View File

@@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
- uses: oven-sh/setup-bun@v1
with:
node-version: '18.1.0'
- run: yarn install
- run: yarn lint
bun-version: '1.3'
- run: bun install
- run: bun run lint

View File

@@ -1,18 +0,0 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '18.1.0'
- run: yarn install
- run: yarn test

View File

@@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
- uses: oven-sh/setup-bun@v1
with:
node-version: '18.1.0'
- run: yarn install
- run: yarn typecheck
bun-version: '1.3'
- run: bun install
- run: bun run typecheck

View File

@@ -1,5 +1,5 @@
# Use an official Node.js image as the base
FROM node:18-alpine
# Use an official Bun image as the base
FROM oven/bun:1.3-debian
# Set the working directory in the container
WORKDIR /app
@@ -8,26 +8,26 @@ WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Install git and Python
RUN apk update && apk add --no-cache git python3 make g++
RUN apt-get update && apt-get install -y git python3 make g++ && rm -rf /var/lib/apt/lists/*
# Create a symlink for python3 as python
RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy package.json and package-lock.json to the container
# Copy package.json and bun.lockb to the container
# COPY package*.json ./
COPY /src/Managing.WebApp/package.json ./
# Install dependencies with the --legacy-peer-deps flag to bypass peer dependency conflicts
RUN npm install --legacy-peer-deps
RUN npm install -g tailwindcss postcss autoprefixer @tailwindcss/typography
# Install dependencies with bun
RUN bun install
RUN bun add -g tailwindcss postcss autoprefixer @tailwindcss/typography
# Copy the rest of the app's source code to the container
# COPY . .
COPY src/Managing.WebApp/ /app/
RUN node --max-old-space-size=8192 ./node_modules/.bin/vite build
RUN bun --bun ./node_modules/.bin/vite build
# Build the app
RUN npm run build
RUN bun run build
# Use NGINX as the web server
FROM nginx:alpine

View File

@@ -1,5 +1,5 @@
# Use an official Node.js image as the base
FROM node:22.14.0-alpine
# Use an official Bun image as the base
FROM oven/bun:1.3-debian
# Add build argument for cache busting
ARG CACHEBUST=1
@@ -11,31 +11,30 @@ WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Install git and Python
RUN apk update && apk add --no-cache git python3 make g++
RUN apt-get update && apt-get install -y git python3 make g++ && rm -rf /var/lib/apt/lists/*
# Create a symlink for python3 as python
# Create a symlink for python3 as python
# This might not be strictly necessary for your current issue but good to keep if Python scripts are involved.
# RUN ln -sf /usr/bin/python3 /usr/bin/python
# RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy package.json and package-lock.json to the container
# COPY package*.json ./
COPY /src/Managing.WebApp/package.json ./
# Copy package.json and bun.lockb to the container
# COPY package*.json ./
COPY /src/Managing.WebApp/package.json ./
# Use cache busting argument to force cache invalidation
RUN echo "Cache bust: $CACHEBUST"
# Install dependencies with the --legacy-peer-deps flag to bypass peer dependency conflicts
# Add --no-cache flag to prevent npm cache usage
RUN npm install --legacy-peer-deps --loglevel verbose --no-cache
RUN npm install -g tailwindcss postcss autoprefixer @tailwindcss/typography
# Install dependencies with bun
RUN bun install
RUN bun add -g tailwindcss postcss autoprefixer @tailwindcss/typography
# Copy the rest of the app's source code to the container
# COPY . .
RUN ls -la
COPY src/Managing.WebApp/ .
# Copy the rest of the app's source code to the container
# COPY . .
RUN ls -la
COPY src/Managing.WebApp/ .
# Build the app
RUN npm run build
# Build the app
RUN bun run build
# Use NGINX as the web server
FROM nginx:alpine

4486
src/Managing.WebApp/bun.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,35 +0,0 @@
const config = {
collectCoverageFrom: ['<rootDir>/src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'],
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'mjs', 'jsx', 'ts', 'tsx', 'json'],
moduleNameMapper: {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
},
notify: true,
notifyMode: 'success-change',
resetMocks: true,
roots: ['<rootDir>'],
setupFilesAfterEnv: ['<rootDir>/jest/setupTests.ts'],
testEnvironment: 'jsdom',
testMatch: [
'<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
],
transform: {
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)':
'<rootDir>/jest/fileTransform.js',
'^.+\\.[jt]sx?$': 'esbuild-jest',
'^.+\\.css$': '<rootDir>/jest/cssTransform.js',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
verbose: true,
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
}
module.exports = config

View File

@@ -3,16 +3,15 @@
"version": "2.0.0",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"dev": "bunx --bun vite",
"build": "bunx --bun vite build",
"preview": "bunx --bun vite preview",
"serve": "serve -s dist -p 3000",
"test": "jest",
"lint": "eslint . --ext .ts,.tsx,.js,jsx",
"lint:fix": "eslint . --ext .ts,.tsx,.js,jsx --fix",
"typecheck": "tsc --noEmit",
"prettier": "prettier --write \"**/*.+(json|yml|css|md|mdx)\"",
"clean": "rimraf node_modules yarn.lock dist",
"clean": "rimraf node_modules bun.lock dist",
"validate": "./scripts/validate"
},
"dependencies": {
@@ -40,7 +39,7 @@
"genetic-js": "^0.1.14",
"jotai": "^1.6.7",
"latest-version": "^9.0.0",
"lightweight-charts": "git+https://github.com/ntf/lightweight-charts.git",
"lightweight-charts": "^4.2.2",
"moment": "^2.29.3",
"plotly.js": "^2.18.1",
"postcss": "^8.4.13",