From 4e94c85a9af2982dba4ad430176d2f7f42b3be3b Mon Sep 17 00:00:00 2001 From: ckt1031 <65409152+ckt1031@users.noreply.github.com> Date: Sat, 15 Jul 2023 21:41:23 +0800 Subject: [PATCH] feat: move to vite for faster builld --- .github/workflows/linux-release.yml | 2 +- .github/workflows/macos-release.yml | 2 +- .github/workflows/windows-release.yml | 2 +- Dockerfile | 2 +- README.md | 6 - english.dockerfile | 2 +- web/README.md | 4 +- web/{public => }/index.html | 1 + web/package-lock.json | 17269 +--------------- web/package.json | 11 +- web/src/{App.js => App.jsx} | 0 .../{ChannelsTable.js => ChannelsTable.jsx} | 0 .../{DiscordOAuth.js => DiscordOAuth.jsx} | 0 web/src/components/{Footer.js => Footer.jsx} | 2 +- .../{GitHubOAuth.js => GitHubOAuth.jsx} | 0 web/src/components/{Header.js => Header.jsx} | 0 .../components/{Loading.js => Loading.jsx} | 0 .../{LoginForm.js => LoginForm.jsx} | 0 .../{LogsTable.js => LogsTable.jsx} | 0 ...erationSetting.js => OperationSetting.jsx} | 0 .../{OtherSetting.js => OtherSetting.jsx} | 2 +- ...setConfirm.js => PasswordResetConfirm.jsx} | 0 ...wordResetForm.js => PasswordResetForm.jsx} | 0 ...PersonalSetting.js => PersonalSetting.jsx} | 0 .../{PrivateRoute.js => PrivateRoute.jsx} | 0 ...demptionsTable.js => RedemptionsTable.jsx} | 0 .../{RegisterForm.js => RegisterForm.jsx} | 0 .../{SystemSetting.js => SystemSetting.jsx} | 0 .../{TokensTable.js => TokensTable.jsx} | 0 .../{UsersTable.js => UsersTable.jsx} | 0 ...nel.constants.js => channel.constants.jsx} | 0 ...common.constant.js => common.constant.jsx} | 0 web/src/constants/{index.js => index.jsx} | 0 ...toast.constants.js => toast.constants.jsx} | 0 .../{user.constants.js => user.constants.jsx} | 0 .../context/Status/{index.js => index.jsx} | 0 .../Status/{reducer.js => reducer.jsx} | 0 web/src/context/User/{index.js => index.jsx} | 0 .../context/User/{reducer.js => reducer.jsx} | 0 web/src/helpers/{api.js => api.jsx} | 2 +- .../{auth-header.js => auth-header.jsx} | 0 web/src/helpers/{history.js => history.jsx} | 0 web/src/helpers/{index.js => index.jsx} | 0 web/src/helpers/{render.js => render.jsx} | 0 web/src/helpers/{utils.js => utils.jsx} | 0 web/src/{index.js => index.jsx} | 0 web/src/pages/About/{index.js => index.jsx} | 0 .../{EditChannel.js => EditChannel.jsx} | 0 web/src/pages/Channel/{index.js => index.jsx} | 0 web/src/pages/Chat/{index.js => index.jsx} | 0 web/src/pages/Home/{index.js => index.jsx} | 0 web/src/pages/Log/{index.js => index.jsx} | 0 .../pages/NotFound/{index.js => index.jsx} | 0 .../{EditRedemption.js => EditRedemption.jsx} | 0 .../pages/Redemption/{index.js => index.jsx} | 0 web/src/pages/Setting/{index.js => index.jsx} | 0 .../Token/{EditToken.js => EditToken.jsx} | 0 web/src/pages/Token/{index.js => index.jsx} | 0 web/src/pages/TopUp/{index.js => index.jsx} | 0 .../pages/User/{AddUser.js => AddUser.jsx} | 0 .../pages/User/{EditUser.js => EditUser.jsx} | 0 web/src/pages/User/{index.js => index.jsx} | 0 web/vite.config.js | 11 + 63 files changed, 411 insertions(+), 16907 deletions(-) rename web/{public => }/index.html (91%) rename web/src/{App.js => App.jsx} (100%) rename web/src/components/{ChannelsTable.js => ChannelsTable.jsx} (100%) rename web/src/components/{DiscordOAuth.js => DiscordOAuth.jsx} (100%) rename web/src/components/{Footer.js => Footer.jsx} (95%) rename web/src/components/{GitHubOAuth.js => GitHubOAuth.jsx} (100%) rename web/src/components/{Header.js => Header.jsx} (100%) rename web/src/components/{Loading.js => Loading.jsx} (100%) rename web/src/components/{LoginForm.js => LoginForm.jsx} (100%) rename web/src/components/{LogsTable.js => LogsTable.jsx} (100%) rename web/src/components/{OperationSetting.js => OperationSetting.jsx} (100%) rename web/src/components/{OtherSetting.js => OtherSetting.jsx} (99%) rename web/src/components/{PasswordResetConfirm.js => PasswordResetConfirm.jsx} (100%) rename web/src/components/{PasswordResetForm.js => PasswordResetForm.jsx} (100%) rename web/src/components/{PersonalSetting.js => PersonalSetting.jsx} (100%) rename web/src/components/{PrivateRoute.js => PrivateRoute.jsx} (100%) rename web/src/components/{RedemptionsTable.js => RedemptionsTable.jsx} (100%) rename web/src/components/{RegisterForm.js => RegisterForm.jsx} (100%) rename web/src/components/{SystemSetting.js => SystemSetting.jsx} (100%) rename web/src/components/{TokensTable.js => TokensTable.jsx} (100%) rename web/src/components/{UsersTable.js => UsersTable.jsx} (100%) rename web/src/constants/{channel.constants.js => channel.constants.jsx} (100%) rename web/src/constants/{common.constant.js => common.constant.jsx} (100%) rename web/src/constants/{index.js => index.jsx} (100%) rename web/src/constants/{toast.constants.js => toast.constants.jsx} (100%) rename web/src/constants/{user.constants.js => user.constants.jsx} (100%) rename web/src/context/Status/{index.js => index.jsx} (100%) rename web/src/context/Status/{reducer.js => reducer.jsx} (100%) rename web/src/context/User/{index.js => index.jsx} (100%) rename web/src/context/User/{reducer.js => reducer.jsx} (100%) rename web/src/helpers/{api.js => api.jsx} (68%) rename web/src/helpers/{auth-header.js => auth-header.jsx} (100%) rename web/src/helpers/{history.js => history.jsx} (100%) rename web/src/helpers/{index.js => index.jsx} (100%) rename web/src/helpers/{render.js => render.jsx} (100%) rename web/src/helpers/{utils.js => utils.jsx} (100%) rename web/src/{index.js => index.jsx} (100%) rename web/src/pages/About/{index.js => index.jsx} (100%) rename web/src/pages/Channel/{EditChannel.js => EditChannel.jsx} (100%) rename web/src/pages/Channel/{index.js => index.jsx} (100%) rename web/src/pages/Chat/{index.js => index.jsx} (100%) rename web/src/pages/Home/{index.js => index.jsx} (100%) rename web/src/pages/Log/{index.js => index.jsx} (100%) rename web/src/pages/NotFound/{index.js => index.jsx} (100%) rename web/src/pages/Redemption/{EditRedemption.js => EditRedemption.jsx} (100%) rename web/src/pages/Redemption/{index.js => index.jsx} (100%) rename web/src/pages/Setting/{index.js => index.jsx} (100%) rename web/src/pages/Token/{EditToken.js => EditToken.jsx} (100%) rename web/src/pages/Token/{index.js => index.jsx} (100%) rename web/src/pages/TopUp/{index.js => index.jsx} (100%) rename web/src/pages/User/{AddUser.js => AddUser.jsx} (100%) rename web/src/pages/User/{EditUser.js => EditUser.jsx} (100%) rename web/src/pages/User/{index.js => index.jsx} (100%) create mode 100644 web/vite.config.js diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index 364b83ae..e1199421 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -24,7 +24,7 @@ jobs: run: | cd web npm install - REACT_APP_VERSION=$(git describe --tags) npm run build + VITE_REACT_APP_VERSION=$(git describe --tags) npm run build cd .. - name: Set up Go uses: actions/setup-go@v3 diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml index bdd0d208..87a9a859 100644 --- a/.github/workflows/macos-release.yml +++ b/.github/workflows/macos-release.yml @@ -24,7 +24,7 @@ jobs: run: | cd web npm install - REACT_APP_VERSION=$(git describe --tags) npm run build + VITE_REACT_APP_VERSION=$(git describe --tags) npm run build cd .. - name: Set up Go uses: actions/setup-go@v3 diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 33193a89..4a52b4a0 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -27,7 +27,7 @@ jobs: run: | cd web npm install - REACT_APP_VERSION=$(git describe --tags) npm run build + VITE_REACT_APP_VERSION=$(git describe --tags) npm run build cd .. - name: Set up Go uses: actions/setup-go@v3 diff --git a/Dockerfile b/Dockerfile index 5d56dfe1..6e808325 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ COPY ./web/package*.json ./ RUN npm ci COPY ./web . COPY ./VERSION . -RUN REACT_APP_VERSION=$(cat VERSION) npm run build +RUN VITE_REACT_APP_VERSION=$(cat VERSION) npm run build # Go build stage FROM golang AS builder2 diff --git a/README.md b/README.md index 7fd38ec3..8f92bb50 100644 --- a/README.md +++ b/README.md @@ -57,12 +57,6 @@ _✨ All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用 > **Warning**:从 `v0.3` 版本升级到 `v0.4` 版本需要手动迁移数据库,请手动执行[数据库迁移脚本](./bin/migration_v0.3-v0.4.sql)。 -## 👍Forks 特殊功能⚡ - -1. 增强的**频道测试**以提高稳定性。 -2. 支持 **Dall-E 2 模型图像生成** API。 -3. 修复**登录页面**中缺少的 **Turnstile 验证码**。 - ## 功能 1. 支持多种 API 访问渠道: + [x] OpenAI 官方通道(支持配置镜像) diff --git a/english.dockerfile b/english.dockerfile index 9504b9e6..081557bb 100644 --- a/english.dockerfile +++ b/english.dockerfile @@ -10,7 +10,7 @@ WORKDIR /build COPY ./web/package*.json ./ RUN npm ci COPY --from=translator /app . -RUN cd web && REACT_APP_VERSION=$(cat VERSION) npm run build +RUN cd web && VITE_REACT_APP_VERSION=$(cat VERSION) npm run build # Go build stage FROM golang:1.20.5 AS goBuilder diff --git a/web/README.md b/web/README.md index 07a1fd2a..7626a4c2 100644 --- a/web/README.md +++ b/web/README.md @@ -10,8 +10,8 @@ npm start npm run build ``` -If you want to change the default server, please set `REACT_APP_SERVER` environment variables before build, -for example: `REACT_APP_SERVER=http://your.domain.com`. +If you want to change the default server, please set `VITE_REACT_APP_SERVER` environment variables before build, +for example: `VITE_REACT_APP_SERVER=http://your.domain.com`. Before you start editing, make sure your `Actions on Save` options have `Optimize imports` & `Run Prettier` enabled. diff --git a/web/public/index.html b/web/index.html similarity index 91% rename from web/public/index.html rename to web/index.html index 113c8607..4dffa3df 100644 --- a/web/public/index.html +++ b/web/index.html @@ -14,5 +14,6 @@
+