Skip to content

Commit b1b5a02

Browse files
committed
feat: 初始化 HaloLight React 版本
- 基于 React 18 + Vite + TypeScript 构建 - 完整的后台管理系统功能 - TDK 和 PWA 支持 - CI/CD 工作流配置
0 parents  commit b1b5a02

187 files changed

Lines changed: 32532 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: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
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+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
cache: "pnpm"
38+
39+
- name: Get pnpm store path
40+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
41+
42+
- name: Cache pnpm store
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ env.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Run ESLint
54+
run: pnpm lint
55+
56+
- name: Run TypeScript type check
57+
run: pnpm type-check
58+
59+
# ============================================================================
60+
# 单元测试
61+
# ============================================================================
62+
test:
63+
name: Unit Tests
64+
runs-on: ubuntu-latest
65+
needs: lint
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@v4
69+
70+
- name: Setup pnpm
71+
uses: pnpm/action-setup@v4
72+
73+
- name: Setup Node.js
74+
uses: actions/setup-node@v4
75+
with:
76+
cache: "pnpm"
77+
78+
- name: Get pnpm store path
79+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
80+
81+
- name: Cache pnpm store
82+
uses: actions/cache@v4
83+
with:
84+
path: ${{ env.STORE_PATH }}
85+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
86+
restore-keys: |
87+
${{ runner.os }}-pnpm-store-
88+
89+
- name: Install dependencies
90+
run: pnpm install --frozen-lockfile
91+
92+
- name: Run tests with coverage
93+
run: pnpm test:coverage
94+
continue-on-error: true
95+
96+
- name: Upload coverage to Codecov
97+
uses: codecov/codecov-action@v4
98+
if: always()
99+
with:
100+
token: ${{ secrets.CODECOV_TOKEN }}
101+
fail_ci_if_error: false
102+
files: ./coverage/lcov.info
103+
flags: unittests
104+
name: codecov-umbrella
105+
106+
# ============================================================================
107+
# 构建检查
108+
# ============================================================================
109+
build:
110+
name: Build
111+
runs-on: ubuntu-latest
112+
needs: lint
113+
steps:
114+
- name: Checkout repository
115+
uses: actions/checkout@v4
116+
117+
- name: Setup pnpm
118+
uses: pnpm/action-setup@v4
119+
120+
- name: Setup Node.js
121+
uses: actions/setup-node@v4
122+
with:
123+
cache: "pnpm"
124+
125+
- name: Get pnpm store path
126+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
127+
128+
- name: Cache pnpm store
129+
uses: actions/cache@v4
130+
with:
131+
path: ${{ env.STORE_PATH }}
132+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
133+
restore-keys: |
134+
${{ runner.os }}-pnpm-store-
135+
136+
- name: Cache Vite build
137+
uses: actions/cache@v4
138+
with:
139+
path: |
140+
node_modules/.vite
141+
key: ${{ runner.os }}-vite-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**/*.ts', '**/*.tsx') }}
142+
restore-keys: |
143+
${{ runner.os }}-vite-${{ hashFiles('pnpm-lock.yaml') }}-
144+
145+
- name: Install dependencies
146+
run: pnpm install --frozen-lockfile
147+
148+
- name: Build application
149+
run: pnpm build
150+
151+
- name: Upload build artifacts
152+
uses: actions/upload-artifact@v4
153+
with:
154+
name: build-output
155+
path: dist/
156+
retention-days: 7
157+
158+
# ============================================================================
159+
# 依赖安全审计
160+
# ============================================================================
161+
security:
162+
name: Security Audit
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Checkout repository
166+
uses: actions/checkout@v4
167+
168+
- name: Setup pnpm
169+
uses: pnpm/action-setup@v4
170+
171+
- name: Setup Node.js
172+
uses: actions/setup-node@v4
173+
with:
174+
cache: "pnpm"
175+
176+
- name: Install dependencies
177+
run: pnpm install --frozen-lockfile
178+
179+
- name: Run security audit
180+
run: pnpm audit --audit-level=high
181+
continue-on-error: true
182+
183+
# ============================================================================
184+
# 依赖更新检查(仅 PR)
185+
# ============================================================================
186+
dependency-review:
187+
name: Dependency Review
188+
runs-on: ubuntu-latest
189+
if: github.event_name == 'pull_request'
190+
steps:
191+
- name: Checkout repository
192+
uses: actions/checkout@v4
193+
194+
- name: Dependency Review
195+
uses: actions/dependency-review-action@v4
196+
with:
197+
fail-on-severity: high
198+
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)