Skip to content

Commit 32e006f

Browse files
committed
feat: update GitHub Actions workflow for deployment, switch to pnpm, and improve Node.js version handling
chore: add CLAUDE.md to .gitignore refactor: remove CMD instruction from Dockerfile fix: use environment variable for CESIUM_ION_TOKEN in config cleanup: remove commented routes in routes.ts fix: update package.json to ensure all-contributors-cli is included refactor: improve Cesium global variable handling in app.tsx feat: add TODO for logout functionality in RightContent fix: update Chinese locale for HaiAirPosture refactor: remove console logs from AudioPlayer refactor: update D3 imports to use named imports fix: remove console logs from Frequency component fix: remove console logs from FullCalendar component refactor: remove console logs from GeoHash component refactor: dynamically load thermal map data in HaiAirPosture fix: update ThermalMap to handle loading state and improve error handling fix: remove console logs from Trajectory component fix: remove console logs from Unit component fix: remove console logs from InfoMap component fix: remove console logs from RichTextEditing component refactor: remove console logs from cesiumCompute utility fix: remove console logs from requestConfig error handling chore: add .env.example for environment variable setup chore: add typings for global variables in typings.d.ts chore: add vercel.json for Vercel deployment configuration
1 parent 4a5ba2d commit 32e006f

27 files changed

Lines changed: 222 additions & 262 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Cesium Ion Token
2+
# 从 https://ion.cesium.com/ 获取你的 token
3+
CESIUM_ION_TOKEN=your_cesium_ion_token_here

.eslintrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
11
module.exports = {
22
extends: require.resolve('@umijs/max/eslint'),
3+
rules: {
4+
// 禁止使用 console.log,但允许 warn 和 error
5+
'no-console': ['warn', { allow: ['warn', 'error'] }],
6+
// 禁止未使用的变量(仅警告)
7+
'@typescript-eslint/no-unused-vars': [
8+
'warn',
9+
{
10+
argsIgnorePattern: '^_',
11+
varsIgnorePattern: '^_',
12+
},
13+
],
14+
// 禁止使用 any 类型(仅警告,避免影响现有代码)
15+
'@typescript-eslint/no-explicit-any': 'warn',
16+
// 要求使用 === 和 !==
17+
eqeqeq: ['warn', 'always'],
18+
// 禁止在 return、throw、continue 和 break 语句后出现不可达代码
19+
'no-unreachable': 'warn',
20+
},
321
};

.github/workflows/deploy.yml

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
1-
name: Deploy to GitHub Pages # 自定义工作流名称
2-
3-
on: # 触发条件
4-
push: # 当推送时触发
5-
branches: # 推送到哪些分支时触发
6-
- master # 当推送到 master 分支时,触发 deploy 构建
7-
pull_request: # 当 PR 时触发
8-
branches: # PR 到哪些分支时触发
9-
- master # 当 PR 到 master 分支时,触发 deploy 构建
10-
workflow_dispatch: # 手动触发
11-
branches: # 手动触发时,触发 deploy 构建
12-
- master # 手动触发时,触发 deploy 构建
13-
14-
jobs: # 一个工作流可以包含多个 job
15-
build-and-deploy: # 自定义 job 名称
16-
runs-on: ubuntu-latest # 运行环境
17-
18-
steps: # job 包含的步骤
19-
- name: Checkout code # 步骤名称
20-
uses: actions/checkout@v4 # 使用的 action
21-
22-
- name: Setup Node.js # 安装 Node.js
23-
uses: actions/setup-node@v4 # 使用的 action
24-
with: # action 参数
25-
node-version: '20' # 设置 Node.js 版本
26-
27-
- name: Install pnpm # 安装依赖
28-
run: npm install -g pnpm # 执行命令
29-
30-
- name: Install dependencies # 安装依赖
31-
run: pnpm install # 执行命令
32-
33-
- name: Build project # 构建项目
34-
run: pnpm build:github # 执行命令
35-
36-
- name: Deploy to GitHub Pages # 部署到 GitHub Pages
37-
uses: JamesIves/github-pages-deploy-action@4.1.4 # 使用的 action
38-
with: # action 参数
39-
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub Token
40-
BRANCH: gh-pages # 部署到的分支
41-
FOLDER: dist # 部署的文件夹
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18'
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v2
23+
with:
24+
version: 8
25+
26+
- name: Install dependencies
27+
run: pnpm install
28+
29+
- name: Build
30+
env:
31+
CESIUM_ION_TOKEN: ${{ secrets.CESIUM_ION_TOKEN }}
32+
run: pnpm run build:github
33+
34+
- name: Deploy to GitHub Pages
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./dist

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
/dist
1212
/.mfsu
1313
.swc
14+
CLAUDE.md

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ COPY ./nginx.conf /etc/nginx/nginx.conf
99
# 暴露 80 端口
1010
EXPOSE 80
1111

12-
# 启动 Nginx 服务
13-
CMD ["nginx", "-g", "daemon off;"]
14-
1512
# 为 Nginx 配置文件添加执行权限
1613
# RUN chmod +x /etc/nginx/nginx.conf
1714

config/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export default defineConfig({
2323
],
2424
define: {
2525
CESIUM_BASE_URL: '/Cesium',
26-
CESIUM_ION_TOKEN:
27-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkZjBmZTAzMS1jMTJkLTQ5OGQtYTkyYS0xODcyMjU3MTQzMmUiLCJpZCI6MTg2MDcxLCJpYXQiOjE3MDM0MDIwMzl9.DQzBf8T_0U92DwjBcYQqdgwhFs-Cx7EacplwoL_ypjY',
26+
CESIUM_ION_TOKEN: process.env.CESIUM_ION_TOKEN,
2827
},
2928
headScripts: [
3029
{

config/routes.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ export const routes = [
1212
icon: 'HomeFilled',
1313
component: './Home',
1414
},
15-
// {
16-
// name: '权限演示',
17-
// path: '/access',
18-
// component: './Access',
19-
// },
20-
// {
21-
// name: ' CRUD 示例',
22-
// path: '/table',
23-
// component: './Table',
24-
// },
2515
{
2616
name: 'feature',
2717
path: '/feature',
@@ -31,18 +21,8 @@ export const routes = [
3121
name: 'feature',
3222
path: '/feature',
3323
hideInMenu: true,
34-
// component: './Feature/index',
3524
component: './Feature/FullCalendar',
3625
},
37-
// {
38-
// name: 'formily',
39-
// path: '/feature/formily',
40-
// component: './Feature/Formily/Designable',
41-
// icon: 'HourglassOutlined',
42-
// target: '_blank',
43-
// hideChildrenInMenu: true,
44-
// menuRender: false,
45-
// },
4626
{
4727
name: 'fullCalendar',
4828
path: '/feature/fullCalendar',
@@ -77,7 +57,6 @@ export const routes = [
7757
name: 'VideoPlayer',
7858
path: '/feature/VideoPlayer',
7959
icon: 'VideoCameraAddOutlined',
80-
// component: './Feature/VideoPlayer/xgplayer',
8160
routes: [
8261
{
8362
name: 'xgplayer',
@@ -101,17 +80,11 @@ export const routes = [
10180
path: '/feature/D3/Frequency',
10281
component: './Feature/D3/Frequency',
10382
},
104-
// {
105-
// name: 'BarChartRace',
106-
// path: '/feature/D3/BarChartRace',
107-
// component: './Feature/D3/BarChartRace',
108-
// },
10983
],
11084
},
11185
{
11286
name: 'AudioFeature',
11387
path: '/feature/AudioFeature',
114-
// icon: 'NotificationOutlined',
11588
icon: 'CustomerServiceOutlined',
11689
routes: [
11790
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"@types/d3": "^7.4.3",
4646
"@umijs/max": "^4.0.74",
4747
"ahooks": "^3.7.8",
48-
"all-contributors-cli": "^6.26.1",
4948
"antd": "^5.17.3",
5049
"artplayer": "^5.2.1",
5150
"cesium": "^1.112.0",
@@ -69,6 +68,7 @@
6968
"@types/rbush": "^4.0.0",
7069
"@types/react": "^18.2.18",
7170
"@types/react-dom": "^18.2.7",
71+
"all-contributors-cli": "^6.26.1",
7272
"cross-env": "^7.0.3",
7373
"husky": "^8.0.3",
7474
"lint-staged": "^13.2.3",

src/app.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@ import 'cesium/Build/Cesium/Widgets/widgets.css';
66
import { getInitialState as libGetInitialState } from './utils/Auth/initalState';
77
import { requestConfig } from './utils/requestConfig';
88

9-
// NOTE cesium-heatmap 插件需要全局引入 Cesium 库
9+
// NOTE: cesium-heatmap 插件需要全局引入 Cesium 库
10+
// 声明全局 Cesium 类型
11+
declare global {
12+
interface Window {
13+
Cesium: typeof import('cesium');
14+
}
15+
}
16+
1017
import * as Cesium from 'cesium';
11-
window.Cesium = Cesium;
18+
// 仅在需要时挂载到 window,避免全局污染
19+
if (typeof window !== 'undefined' && !window.Cesium) {
20+
window.Cesium = Cesium;
21+
}
1222

1323
// NOTE:全局初始化数据配置,用于 Layout 用户信息和权限初始化
1424
// 更多信息见文档:https://umijs.org/docs/api/runtime-config#getinitialstate

src/layouts/RightContent.tsx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
GithubOutlined,
3-
GlobalOutlined,
4-
SkinOutlined,
5-
UserOutlined,
6-
} from '@ant-design/icons';
1+
import { GithubOutlined, GlobalOutlined, SkinOutlined, UserOutlined } from '@ant-design/icons';
72
import { setLocale, useIntl } from '@umijs/max';
83
import { Avatar, Button, Popover, message } from 'antd';
94
import { useState } from 'react';
@@ -13,9 +8,7 @@ const RightContent = () => {
138
// NOTE: 多语言
149
const intl = useIntl();
1510
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16-
const [localeType, setLocaleType] = useState(
17-
localStorage.getItem('umi_locale') || 'zh-CN',
18-
);
11+
const [localeType, setLocaleType] = useState(localStorage.getItem('umi_locale') || 'zh-CN');
1912
if (!localStorage.getItem('umi_locale')) {
2013
setLocale('zh-CN');
2114
}
@@ -56,7 +49,7 @@ const RightContent = () => {
5649
<div
5750
className="w-24 px-2 py-1 text-center rounded-md cursor-pointer hover:bg-zinc-200"
5851
onClick={() => {
59-
console.log('logout');
52+
// TODO: 实现登出功能
6053
}}
6154
>
6255
{intl.formatMessage({ id: 'Logout' })}
@@ -93,10 +86,7 @@ const RightContent = () => {
9386
</div>
9487
}
9588
>
96-
<Button
97-
className="flex items-center justify-center"
98-
icon={<SkinOutlined />}
99-
/>
89+
<Button className="flex items-center justify-center" icon={<SkinOutlined />} />
10090
</Popover>
10191

10292
{/* NOTE: 多语言 */}
@@ -121,10 +111,7 @@ const RightContent = () => {
121111
</div>
122112
}
123113
>
124-
<Button
125-
className="flex items-center justify-center"
126-
icon={<GlobalOutlined />}
127-
/>
114+
<Button className="flex items-center justify-center" icon={<GlobalOutlined />} />
128115
</Popover>
129116

130117
{/* NOTE: GitHub 链接 */}

0 commit comments

Comments
 (0)