mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-08-29 00:41:25 +08:00
ci: add Bun test verification
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: '1.3.14'
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Verify
|
||||
run: bun run verify
|
||||
@@ -0,0 +1,33 @@
|
||||
# Repository Guidelines
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
This is a React 19 + TypeScript Vite frontend for the CLI Proxy API Management API. Main source lives in `src/`: routes in `src/router`, pages in `src/pages`, components in `src/components`, API clients in `src/services/api`, state in `src/stores`, hooks in `src/hooks`, styles in `src/styles`, and types in `src/types`. Assets live in `src/assets`, with provider icons under `src/assets/icons`. Localization files are in `src/i18n/locales`; update all supported locales when adding user-facing text. Production output is `dist/index.html`.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
- `bun install --frozen-lockfile`: install dependencies from `bun.lock`.
|
||||
- `bun run dev`: start the Vite dev server at `http://localhost:5173`.
|
||||
- `bun run build`: run TypeScript compilation and build `dist/`.
|
||||
- `bun run preview`: serve the built output locally.
|
||||
- `bun run test`: run the Bun test suite.
|
||||
- `bun run lint`: run ESLint over TypeScript/TSX files.
|
||||
- `bun run verify`: run tests, lint, TypeScript compilation, and the production build.
|
||||
- `bun run type-check`: run `tsc --noEmit`.
|
||||
- `bun run format`: apply Prettier to `src/**/*.{ts,tsx,css,scss}`.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Use 2-space indentation, semicolons, single quotes, ES5 trailing commas, and 100-character line width. Prefer typed React components and avoid new `any` unless it marks a boundary. Use the `@/` alias for `src` imports. Component files use PascalCase, hooks use `useName`, API modules use domain names such as `oauth.ts`, and SCSS Modules sit beside their page or component as `Name.module.scss`.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
Tests use Bun's built-in test runner and are colocated under `tests/` as `*.test.ts`. Run `bun run test` for focused test work and `bun run verify` before handoff. Use `bun run type-check` as a fast standalone TypeScript check. For UI changes, verify the affected route in the browser and include screenshots or notes.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
Git history follows Conventional Commit style, for example `feat: add support for xAI provider`, `fix(auth-files): keep disabled card actions visible`, and `ci: use node 24 for releases`. Keep commits focused and scoped when useful. Pull requests should include a change summary, linked issue when applicable, UI screenshots, backend version or reproduction details for integration work, and verification notes.
|
||||
|
||||
## Architecture & Configuration Notes
|
||||
|
||||
This UI is not the proxy; it talks to the backend Management API under `/v0/management`. Treat backend contracts as the source of truth. For OAuth/provider changes, inspect `../CLIProxyAPI` before changing route names, provider keys, callback parameters, or auth-file semantics. Store no secrets in the repo; management keys are entered at runtime and persisted only in browser storage.
|
||||
@@ -138,7 +138,9 @@ The UI language is automatically detected from browser settings and can be manua
|
||||
bun run dev # Vite dev server
|
||||
bun run build # tsc + Vite build
|
||||
bun run preview # serve dist locally
|
||||
bun run test # Bun test suite
|
||||
bun run lint # ESLint (fails on warnings)
|
||||
bun run verify # test + lint + build
|
||||
bun run format # Prettier
|
||||
bun run type-check # tsc --noEmit
|
||||
```
|
||||
@@ -149,7 +151,7 @@ Issues and PRs are welcome. Please include:
|
||||
|
||||
- Reproduction steps (server version + UI version)
|
||||
- Screenshots for UI changes
|
||||
- Verification notes (`bun run lint`, `bun run type-check`, `bun run build`)
|
||||
- Verification notes (`bun run verify`, plus `bun run type-check` when run separately)
|
||||
|
||||
## License
|
||||
|
||||
|
||||
+3
-1
@@ -138,7 +138,9 @@ bun run build
|
||||
bun run dev # 启动开发服务器
|
||||
bun run build # tsc + Vite 构建
|
||||
bun run preview # 本地预览 dist
|
||||
bun run test # Bun 测试套件
|
||||
bun run lint # ESLint(warnings 视为失败)
|
||||
bun run verify # 测试 + lint + 构建
|
||||
bun run format # Prettier
|
||||
bun run type-check # tsc --noEmit
|
||||
```
|
||||
@@ -149,7 +151,7 @@ bun run type-check # tsc --noEmit
|
||||
|
||||
- 复现步骤(服务端版本 + UI 版本)
|
||||
- UI 改动截图
|
||||
- 验证记录(`bun run lint`、`bun run type-check`、`bun run build`)
|
||||
- 验证记录(`bun run verify`,以及按需单独运行的 `bun run type-check`)
|
||||
|
||||
## 许可证
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "bun test",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives",
|
||||
"verify": "bun run test && bun run lint && bun run build",
|
||||
"format": "prettier --write \"src/**/*.{ts,tsx,css,scss}\"",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user