Skip to content

Commit 3e770ea

Browse files
initial open source commit
0 parents  commit 3e770ea

File tree

761 files changed

+93122
-0
lines changed

Some content is hidden

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

761 files changed

+93122
-0
lines changed

.github/workflows/ci.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: OSS CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
concurrency:
13+
group: oss-ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
quality-check:
18+
name: Quality Check
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 20
21+
env:
22+
YARN_ENABLE_GLOBAL_CACHE: 'false'
23+
YARN_CACHE_FOLDER: .yarn/cache
24+
CHECK_NO_HARDCODED_ZH_SCAN_JSX_TEXT: '1'
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '22'
35+
36+
- name: Enable Corepack
37+
run: corepack enable && corepack prepare yarn@4.5.1 --activate
38+
39+
- name: Restore Yarn cache
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
.yarn/cache
44+
.yarn/install-state.gz
45+
key: ${{ runner.os }}-yarn4-oss-${{ hashFiles('yarn.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-yarn4-oss-
48+
49+
- name: Install dependencies
50+
run: yarn install --immutable
51+
52+
- name: Frontend quality checks
53+
run: yarn quality:frontend
54+
55+
guard-checks:
56+
name: Guard Checks
57+
runs-on: ubuntu-latest
58+
timeout-minutes: 10
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Run large-file and secrets checks
66+
env:
67+
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
68+
HEAD_SHA: ${{ github.sha }}
69+
run: |
70+
set -euo pipefail
71+
bash scripts/check-large-files.sh "${BASE_SHA}" "${HEAD_SHA}"
72+
bash scripts/check-secrets.sh "${BASE_SHA}" "${HEAD_SHA}"
73+
74+
build-test:
75+
name: Build and Test
76+
needs:
77+
- quality-check
78+
- guard-checks
79+
runs-on: ubuntu-latest
80+
timeout-minutes: 20
81+
env:
82+
YARN_ENABLE_GLOBAL_CACHE: 'false'
83+
YARN_CACHE_FOLDER: .yarn/cache
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Setup Node.js
89+
uses: actions/setup-node@v4
90+
with:
91+
node-version: '22'
92+
93+
- name: Enable Corepack
94+
run: corepack enable && corepack prepare yarn@4.5.1 --activate
95+
96+
- name: Restore Yarn cache
97+
uses: actions/cache@v4
98+
with:
99+
path: |
100+
.yarn/cache
101+
.yarn/install-state.gz
102+
key: ${{ runner.os }}-yarn4-oss-${{ hashFiles('yarn.lock') }}
103+
restore-keys: |
104+
${{ runner.os }}-yarn4-oss-
105+
106+
- name: Install dependencies
107+
run: yarn install --immutable
108+
109+
- name: Type check
110+
run: yarn type-check
111+
112+
- name: Test
113+
run: yarn test
114+
115+
- name: Build
116+
run: yarn build
117+
118+
- name: Mock backend smoke test
119+
run: |
120+
PORT=9100 yarn mock:backend &
121+
MOCK_PID=$!
122+
trap "kill ${MOCK_PID}" EXIT
123+
sleep 5
124+
curl --fail http://127.0.0.1:9100/healthz

.github/workflows/pages.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: github-pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
name: Build Pages Artifact
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 20
23+
env:
24+
YARN_ENABLE_GLOBAL_CACHE: 'false'
25+
YARN_CACHE_FOLDER: .yarn/cache
26+
VITE_BACKEND_DOMAIN: ${{ vars.VITE_BACKEND_DOMAIN || 'https://uc.easecation.net' }}
27+
VITE_IAM_FRONTEND_URL: ${{ vars.VITE_IAM_FRONTEND_URL || 'https://example.com/iam' }}
28+
VITE_IAM_CLIENT_ID: ${{ vars.VITE_IAM_CLIENT_ID || 'demo-client-id' }}
29+
VITE_MAINTENANCE_MODE: ${{ vars.VITE_MAINTENANCE_MODE || 'false' }}
30+
VITE_WECHAT_APP_ID: ${{ vars.VITE_WECHAT_APP_ID || 'demo-wechat-app-id' }}
31+
VITE_QQ_APP_ID: ${{ vars.VITE_QQ_APP_ID || 'demo-qq-app-id' }}
32+
VITE_QQ_STATE: ${{ vars.VITE_QQ_STATE || 'demo-state' }}
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v5
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: '22'
44+
45+
- name: Enable Corepack
46+
run: corepack enable && corepack prepare yarn@4.5.1 --activate
47+
48+
- name: Restore Yarn cache
49+
uses: actions/cache@v4
50+
with:
51+
path: |
52+
.yarn/cache
53+
.yarn/install-state.gz
54+
key: ${{ runner.os }}-yarn4-pages-${{ hashFiles('yarn.lock') }}
55+
restore-keys: |
56+
${{ runner.os }}-yarn4-pages-
57+
58+
- name: Install dependencies
59+
run: yarn install --immutable
60+
61+
- name: Build frontend-user
62+
env:
63+
VITE_USE_HASH_ROUTER: 'true'
64+
VITE_BASE_PATH: /${{ github.event.repository.name }}/
65+
run: yarn build:frontend-user
66+
67+
- name: Build frontend-admin
68+
env:
69+
VITE_USE_HASH_ROUTER: 'true'
70+
VITE_BASE_PATH: /${{ github.event.repository.name }}/admin/
71+
run: yarn build:frontend-admin
72+
73+
- name: Prepare Pages artifact
74+
run: |
75+
rm -rf .pages
76+
mkdir -p .pages/admin
77+
cp -R frontend-user/dist/. .pages/
78+
cp -R frontend-admin/dist/. .pages/admin/
79+
80+
- name: Upload Pages artifact
81+
uses: actions/upload-pages-artifact@v3
82+
with:
83+
path: .pages
84+
85+
deploy:
86+
name: Deploy to GitHub Pages
87+
needs: build
88+
runs-on: ubuntu-latest
89+
environment:
90+
name: github-pages
91+
url: ${{ steps.deployment.outputs.page_url }}
92+
steps:
93+
- name: Deploy Pages
94+
id: deployment
95+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules/
2+
dist/
3+
dist-ssr/
4+
build/
5+
coverage/
6+
logs/
7+
*.log
8+
*.tsbuildinfo
9+
.yarn/install-state.gz
10+
.env
11+
*.local
12+
.DS_Store
13+
.idea/
14+
*.iml
15+
.vscode/
16+
!.vscode/extensions.json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.yarnrc.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
nodeLinker: node-modules
2+
packageExtensions:
3+
"@inversifyjs/core@*":
4+
dependencies:
5+
"reflect-metadata": "^0.2.2"
6+
"antd-style@*":
7+
dependencies:
8+
"react-dom": "^18.3.1"
9+
"serverless-tencent@*":
10+
dependencies:
11+
"inquirer": "^8.2.6"
12+
"swagger-parser@*":
13+
dependencies:
14+
"openapi-types": "^12.1.0"
15+
"ts-node-dev@*":
16+
dependencies:
17+
"@types/node": "^22.0.0"

CONTRIBUTING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Contributing to EaseCation Open User Center
2+
3+
感谢你愿意为 `EaseCation Open User Center` 贡献代码、文档或反馈。
4+
5+
开始贡献前,建议先阅读 [README.md](README.md) 了解项目背景、启动方式和仓库结构;这份文档主要说明协作方式和提交要求。
6+
7+
## 贡献方式
8+
9+
你可以通过以下方式参与:
10+
11+
- 提交 Bug 反馈
12+
- 提出功能建议或交互改进建议
13+
- 完善文档
14+
- 修复问题或提交新功能代码
15+
16+
如果改动会影响现有流程、接口约定或页面行为,建议先开 Issue 讨论。
17+
18+
## 提交前检查
19+
20+
仓库 CI 会执行质量检查、类型检查、测试、构建和基础安全检查。提交 Pull Request 前,建议至少本地运行以下命令:
21+
22+
```bash
23+
yarn quality:frontend
24+
yarn type-check
25+
yarn test
26+
yarn build
27+
```
28+
29+
如果改动只涉及部分模块,至少也要确保:
30+
31+
- 改动相关页面可以正常启动和访问
32+
- 多个模块共用的类型或工具函数优先放在 `shared/``frontend-common/`
33+
- 没有引入新的硬编码中文或破坏现有国际化约定
34+
- 没有引入暗色模式相关 API 的错误用法
35+
- 没有提交密钥、令牌、生产配置或其他敏感信息
36+
37+
## 提交内容建议
38+
39+
请尽量保持每个 Pull Request 聚焦单一目标。
40+
41+
推荐做法:
42+
43+
- 一个 PR 只解决一个明确问题,或只引入一组紧密相关的改动
44+
- 避免把重构、样式调整和功能修改混在同一个 PR 里
45+
- 不要顺手提交无关格式化结果或大面积无意义改名
46+
- 如果改动了接口、状态流转或共享类型,请在描述中明确说明影响范围
47+
48+
## Pull Request 说明
49+
50+
提交 PR 时,建议在描述中写清楚:
51+
52+
- 改动背景
53+
- 解决了什么问题
54+
- 主要改了哪些模块
55+
- 是否影响用户端、管理端或 Mock 后端
56+
- 本地如何验证
57+
58+
如果是 UI 改动,建议附上截图或录屏。
59+
60+
## 文档与代码风格
61+
62+
请尽量保持与现有仓库一致的风格:
63+
64+
- 文档优先写清楚“做什么、为什么、怎么验证”
65+
- 尽量复用已有类型、组件、Hook 和工具函数
66+
- 公共逻辑优先抽到共享层,而不是在页面内重复实现
67+
- 不要提交 `.env`、构建产物、日志文件或其他本地临时文件
68+
69+
## 当前不开源部分
70+
71+
以下内容当前不在开源范围内:
72+
73+
- 生产后端
74+
- 数据库迁移
75+
- 部署密钥
76+
- 私有基础设施配置
77+
78+
涉及这些部分的功能,通常需要通过 `mock-backend/` 或共享契约适配。提交相关改动时,请避免假设生产内部实现细节。
79+
80+
## License
81+
82+
向本仓库提交代码即表示你同意这些贡献将继续以仓库当前使用的 `GNU AGPL-3.0` 许可证进行分发。

0 commit comments

Comments
 (0)