Skip to content

Commit b6c5bad

Browse files
committed
feat: 完成 HaloLight React SPA 版本完整实现
- 基于 React 19 + Vite + TypeScript 构建 - Zustand 状态管理 + TanStack Query 数据获取 - 完整认证流程 (登录/注册/忘记/重置密码) - 可拖拽仪表盘 (react-grid-layout) - 主题切换 (light/dark/system + 11 skins) - shadcn/ui 组件库 (28+ 组件) - CI/CD (lint/type-check/test/build)
0 parents  commit b6c5bad

187 files changed

Lines changed: 32540 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.development

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# 开发环境配置
2+
VITE_API_URL=http://localhost:3001
3+
VITE_USE_MOCK=true
4+
5+
# Demo 账号(密码与 src/lib/api/client.ts 中 authApi.login 验证一致)
6+
VITE_DEMO_EMAIL=admin@halolight.h7ml.cn
7+
VITE_DEMO_PASSWORD=123456
8+
VITE_SHOW_DEMO_HINT=true
9+
10+
# 品牌配置
11+
VITE_BRAND_NAME=Admin Pro
12+
13+
# Google Analytics(可选,大陆部署可留空)
14+
# VITE_GA_ID=

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# HaloLight React 环境变量配置
2+
3+
# API 配置
4+
VITE_API_URL=https://api.halolight.h7ml.cn
5+
VITE_USE_MOCK=true
6+
7+
# Demo 账号(生产环境请留空)
8+
VITE_DEMO_EMAIL=admin@halolight.h7ml.cn
9+
VITE_DEMO_PASSWORD=Admin@123
10+
VITE_SHOW_DEMO_HINT=true
11+
12+
# 品牌配置
13+
VITE_BRAND_NAME=Admin Pro
14+
VITE_BRAND_DESCRIPTION=基于 React 18 + Vite 的现代化中文后台管理系统
15+
16+
# Google Analytics(可选,大陆部署可留空)
17+
VITE_GA_ID=
18+
19+
# WebSocket 配置
20+
VITE_WS_URL=wss://ws.halolight.h7ml.cn

.github/workflows/ci.yml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main, develop]
6+
pull_request:
7+
branches: [master, main, develop]
8+
workflow_dispatch:
9+
10+
# 取消同一分支的之前运行,节省资源
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
VITE_API_URL: /api
17+
VITE_USE_MOCK: "true"
18+
CI: "true"
19+
20+
jobs:
21+
# ============================================================================
22+
# 代码质量检查
23+
# ============================================================================
24+
lint:
25+
name: Lint & Type Check
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Setup pnpm
32+
uses: pnpm/action-setup@v4
33+
with:
34+
version: 10.23.0
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
cache: "pnpm"
40+
41+
- name: Get pnpm store path
42+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
43+
44+
- name: Cache pnpm store
45+
uses: actions/cache@v4
46+
with:
47+
path: ${{ env.STORE_PATH }}
48+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
49+
restore-keys: |
50+
${{ runner.os }}-pnpm-store-
51+
52+
- name: Install dependencies
53+
run: pnpm install --frozen-lockfile
54+
55+
- name: Run ESLint
56+
run: pnpm lint
57+
58+
- name: Run TypeScript type check
59+
run: pnpm type-check
60+
61+
# ============================================================================
62+
# 单元测试
63+
# ============================================================================
64+
test:
65+
name: Unit Tests
66+
runs-on: ubuntu-latest
67+
needs: lint
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
72+
- name: Setup pnpm
73+
uses: pnpm/action-setup@v4
74+
with:
75+
version: 10.23.0
76+
77+
- name: Setup Node.js
78+
uses: actions/setup-node@v4
79+
with:
80+
cache: "pnpm"
81+
82+
- name: Get pnpm store path
83+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
84+
85+
- name: Cache pnpm store
86+
uses: actions/cache@v4
87+
with:
88+
path: ${{ env.STORE_PATH }}
89+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
90+
restore-keys: |
91+
${{ runner.os }}-pnpm-store-
92+
93+
- name: Install dependencies
94+
run: pnpm install --frozen-lockfile
95+
96+
- name: Run tests with coverage
97+
run: pnpm test:coverage
98+
continue-on-error: true
99+
100+
- name: Upload coverage to Codecov
101+
uses: codecov/codecov-action@v4
102+
if: always()
103+
with:
104+
token: ${{ secrets.CODECOV_TOKEN }}
105+
fail_ci_if_error: false
106+
files: ./coverage/lcov.info
107+
flags: unittests
108+
name: codecov-umbrella
109+
110+
# ============================================================================
111+
# 构建检查
112+
# ============================================================================
113+
build:
114+
name: Build
115+
runs-on: ubuntu-latest
116+
needs: lint
117+
steps:
118+
- name: Checkout repository
119+
uses: actions/checkout@v4
120+
121+
- name: Setup pnpm
122+
uses: pnpm/action-setup@v4
123+
with:
124+
version: 10.23.0
125+
126+
- name: Setup Node.js
127+
uses: actions/setup-node@v4
128+
with:
129+
cache: "pnpm"
130+
131+
- name: Get pnpm store path
132+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
133+
134+
- name: Cache pnpm store
135+
uses: actions/cache@v4
136+
with:
137+
path: ${{ env.STORE_PATH }}
138+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
139+
restore-keys: |
140+
${{ runner.os }}-pnpm-store-
141+
142+
- name: Cache Vite build
143+
uses: actions/cache@v4
144+
with:
145+
path: |
146+
node_modules/.vite
147+
key: ${{ runner.os }}-vite-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**/*.ts', '**/*.tsx') }}
148+
restore-keys: |
149+
${{ runner.os }}-vite-${{ hashFiles('pnpm-lock.yaml') }}-
150+
151+
- name: Install dependencies
152+
run: pnpm install --frozen-lockfile
153+
154+
- name: Build application
155+
run: pnpm build
156+
157+
- name: Upload build artifacts
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: build-output
161+
path: dist/
162+
retention-days: 7
163+
164+
# ============================================================================
165+
# 依赖安全审计
166+
# ============================================================================
167+
security:
168+
name: Security Audit
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Checkout repository
172+
uses: actions/checkout@v4
173+
174+
- name: Setup pnpm
175+
uses: pnpm/action-setup@v4
176+
with:
177+
version: 10.23.0
178+
179+
- name: Setup Node.js
180+
uses: actions/setup-node@v4
181+
with:
182+
cache: "pnpm"
183+
184+
- name: Install dependencies
185+
run: pnpm install --frozen-lockfile
186+
187+
- name: Run security audit
188+
run: pnpm audit --audit-level=high
189+
continue-on-error: true
190+
191+
# ============================================================================
192+
# 依赖更新检查(仅 PR)
193+
# ============================================================================
194+
dependency-review:
195+
name: Dependency Review
196+
runs-on: ubuntu-latest
197+
if: github.event_name == 'pull_request'
198+
steps:
199+
- name: Checkout repository
200+
uses: actions/checkout@v4
201+
202+
- name: Dependency Review
203+
uses: actions/dependency-review-action@v4
204+
with:
205+
fail-on-severity: high
206+
allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

0 commit comments

Comments
 (0)