Browse Source

chore: use bun

pull/11888/head
ian 3 months ago
parent
commit
370ba773f1
  1. 26
      .claude/skills/pro-upgrade/SKILL.md
  2. 8
      README.md
  3. 12
      README.zh-CN.md
  4. 140
      bun.lock
  5. 76
      docs/cheatsheet.en-US.md
  6. 78
      docs/cheatsheet.zh-CN.md
  7. 4
      package.json
  8. 10
      scripts/i18n-remove.js
  9. 22
      scripts/simple.js

26
.claude/skills/pro-upgrade/SKILL.md

@ -2,15 +2,15 @@
name: pro-upgrade
description: >
Use when the user wants to upgrade their Ant Design Pro project to the latest version.
Triggers on: upgrade pro, pro upgrade, migrate pro, update pro, 升级, 迁移项目,
Triggers on: upgrade pro, pro upgrade, migrate pro, update pro, 升级,迁移项目,
"how to upgrade", "update to latest", "keep project up to date".
allowed-tools:
- Bash(git clone *)
- Bash(diff *)
- Bash(npm install)
- Bash(npm run lint*)
- Bash(npm run build*)
- Bash(npm run tsc*)
- Bash(bun install)
- Bash(bun run lint*)
- Bash(bun run build*)
- Bash(bun run tsc*)
- Bash(npx antd *)
- Bash(rm -rf /tmp/ant-design-pro-upgrade*)
- Read
@ -65,7 +65,7 @@ Separate the user's project files into **framework files** (Pro-owned, rarely cu
| `biome.json` or `biome.jsonc` | linter config |
| `.husky/` | git hooks |
| `commitlint.config.*` | commit lint config |
| `src/services/ant-design-pro/` | auto-generated — do NOT manually edit; regenerate with `npm run openapi` |
| `src/services/ant-design-pro/` | auto-generated — do NOT manually edit; regenerate with `bun run openapi` |
**Business files** — preserve these, only adjust imports/APIs if needed:
@ -104,7 +104,7 @@ Apply changes with these rules:
- Never rewrite business logic, restructure components, or change styling approaches unless the old approach is broken.
**Auto-generated files:**
- `src/services/ant-design-pro/`: do NOT edit. Tell the user to run `npm run openapi` after upgrade.
- `src/services/ant-design-pro/`: do NOT edit. Tell the user to run `bun run openapi` after upgrade.
### Step 5 — Antd-specific migration checks
@ -128,15 +128,15 @@ Address any findings by updating the flagged code.
### Step 6 — Install and verify
```bash
npm install
npm run lint
npm run build
bun install
bun run lint
bun run build
```
Fix any errors. Common post-upgrade issues:
- Type errors from changed APIs → check `npx antd info <Component>` for current APIs
- New lint rules from Biome config changes → run `npm run biome` to auto-fix
- Missing peer dependencies → check `npm install` warnings
- New lint rules from Biome config changes → run `bun run biome` to auto-fix
- Missing peer dependencies → check `bun install` warnings
### Step 7 — Cleanup and summarize
@ -153,7 +153,7 @@ Output a summary of all changes made, grouped by category:
5. **Manual review needed** — anything you're unsure about or that requires user action
Remind the user to:
- Run `npm run openapi` if they use the auto-generated API services
- Run `bun run openapi` if they use the auto-generated API services
- Test their application thoroughly
- Commit the changes

8
README.md

@ -90,14 +90,14 @@ cd myapp
### Installation
```bash
npm install
bun install
```
### Development
```bash
# Start development server (full version by default)
npm start
bun start
```
### Simplify to Simple Version
@ -105,7 +105,7 @@ npm start
This project includes all blocks by default. If you need a minimal version, run:
```bash
npm run simple
bun run simple
```
This will:
@ -119,7 +119,7 @@ This will:
### Build
```bash
npm run build
bun run build
```
## AI Skills (Claude Code)

12
README.zh-CN.md

@ -19,7 +19,7 @@ Language : [English](./README.md) | 简体中文
- 预览:https://preview.pro.ant.design
- 使用文档:[docs/cheatsheet.zh-CN.md](./docs/cheatsheet.zh-CN.md)
- 更新日志: https://github.com/ant-design/ant-design-pro/releases
- 更新日志:https://github.com/ant-design/ant-design-pro/releases
- 常见问题:[docs/cheatsheet.zh-CN.md#faq](./docs/cheatsheet.zh-CN.md#faq)
- **v6 正式发布!** — [查看 v6 更新内容](https://github.com/ant-design/ant-design-pro/releases/tag/v6.0.0)
@ -89,14 +89,14 @@ cd myapp
### 安装依赖
```bash
npm install
bun install
```
### 开发
```bash
# 启动开发服务器(默认为完整版)
npm start
bun start
```
### 精简为简单版本
@ -104,7 +104,7 @@ npm start
本项目默认包含所有区块。如果你需要一个最小化的版本,运行:
```bash
npm run simple
bun run simple
```
这将会:
@ -118,12 +118,12 @@ npm run simple
### 构建
```bash
npm run build
bun run build
```
更多信息请参考 [使用文档](./docs/cheatsheet.zh-CN.md)。
## AI Skills(Claude Code)
## AI Skills (Claude Code)
本项目内置了两个 [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills),位于 `.claude/skills/` 目录下:

140
bun.lock

@ -5,62 +5,62 @@
"": {
"name": "ant-design-pro",
"dependencies": {
"@ant-design/icons": "latest",
"@ant-design/plots": "latest",
"@ant-design/pro-components": "latest",
"@ant-design/x": "latest",
"@ant-design/x-markdown": "latest",
"@ant-design/x-sdk": "latest",
"@rc-component/util": "latest",
"@tanstack/react-query": "latest",
"antd": "latest",
"antd-style": "latest",
"china-division": "latest",
"clsx": "latest",
"d3": "latest",
"dayjs": "latest",
"highlight.js": "latest",
"react": "latest",
"react-dom": "latest",
"topojson-client": "latest",
"@ant-design/icons": "^6.2.5",
"@ant-design/plots": "^2.6.8",
"@ant-design/pro-components": "3.1.12-0",
"@ant-design/x": "^2.8.0",
"@ant-design/x-markdown": "^2.8.0",
"@ant-design/x-sdk": "^2.8.0",
"@rc-component/util": "^1.11.1",
"@tanstack/react-query": "^5.101.1",
"antd": "^6.4.5",
"antd-style": "^4.1.0",
"china-division": "^2.7.0",
"clsx": "^2.1.1",
"d3": "^7.9.0",
"dayjs": "^1.11.21",
"highlight.js": "^11.11.1",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"topojson-client": "^3.1.0",
},
"devDependencies": {
"@ant-design/cli": "latest",
"@biomejs/biome": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@testing-library/dom": "latest",
"@testing-library/jest-dom": "latest",
"@testing-library/react": "latest",
"@types/d3": "latest",
"@types/express": "latest",
"@types/node": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",
"@types/react-helmet": "latest",
"@types/topojson-client": "latest",
"@types/topojson-specification": "latest",
"@umijs/lint": "latest",
"@umijs/max": "latest",
"@umijs/max-plugin-openapi": "latest",
"@umijs/request-record": "latest",
"@vitest/coverage-v8": "latest",
"@vitest/ui": "latest",
"cross-env": "latest",
"express": "latest",
"geojson": "latest",
"gh-pages": "latest",
"happy-dom": "latest",
"husky": "latest",
"jsdom": "latest",
"lint-staged": "latest",
"mockjs": "latest",
"react-doctor": "latest",
"swagger-ui-dist": "latest",
"tailwindcss": "latest",
"ts-node": "latest",
"typescript": "latest",
"vitest": "latest",
"@ant-design/cli": "^6.4.5",
"@biomejs/biome": "^2.5.1",
"@commitlint/cli": "^21.1.0",
"@commitlint/config-conventional": "^21.1.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/d3": "^7.4.3",
"@types/express": "^5.0.6",
"@types/node": "^26.0.1",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@types/react-helmet": "^6.1.11",
"@types/topojson-client": "^3.1.5",
"@types/topojson-specification": "^1.0.5",
"@umijs/lint": "^4.6.68",
"@umijs/max": "^4.6.68",
"@umijs/max-plugin-openapi": "^2.0.3",
"@umijs/request-record": "^1.1.4",
"@vitest/coverage-v8": "4.1.9",
"@vitest/ui": "4.1.9",
"cross-env": "^10.1.0",
"express": "^5.2.1",
"geojson": "^0.5.0",
"gh-pages": "^6.3.0",
"happy-dom": "^20.10.6",
"husky": "^9.1.7",
"jsdom": "^29.1.1",
"lint-staged": "^17.0.8",
"mockjs": "^1.1.0",
"react-doctor": "^0.5.8",
"swagger-ui-dist": "^5.32.8",
"tailwindcss": "^4.3.1",
"ts-node": "^10.9.2",
"typescript": "^6.0.3",
"vitest": "4.1.9",
},
},
},
@ -97,7 +97,7 @@
"@ant-design/pro-card": ["@ant-design/pro-card@2.10.0", "https://registry.npmmirror.com/@ant-design/pro-card/-/pro-card-2.10.0.tgz", { "dependencies": { "@ant-design/cssinjs": "^1.21.1", "@ant-design/icons": "^5.0.0", "@ant-design/pro-provider": "2.16.2", "@ant-design/pro-utils": "2.18.0", "@babel/runtime": "^7.18.0", "classnames": "^2.3.2", "rc-resize-observer": "^1.0.0", "rc-util": "^5.4.0" }, "peerDependencies": { "antd": "^4.24.15 || ^5.11.2", "react": ">=17.0.0" } }, "sha512-sLONn1odmE0Wkbse8pol4WiaEzBV8JU5s3FAMflPpycfUcbSaa1ktXzQ7LCo2SAvOS7gkfmpFjBPtrfbigKh4g=="],
"@ant-design/pro-components": ["@ant-design/pro-components@2.8.10", "https://registry.npmmirror.com/@ant-design/pro-components/-/pro-components-2.8.10.tgz", { "dependencies": { "@ant-design/pro-card": "2.10.0", "@ant-design/pro-descriptions": "2.6.10", "@ant-design/pro-field": "3.1.0", "@ant-design/pro-form": "2.32.0", "@ant-design/pro-layout": "7.22.7", "@ant-design/pro-list": "2.6.10", "@ant-design/pro-provider": "2.16.2", "@ant-design/pro-skeleton": "2.2.1", "@ant-design/pro-table": "3.21.0", "@ant-design/pro-utils": "2.18.0", "@babel/runtime": "^7.16.3" }, "peerDependencies": { "antd": "^4.24.15 || ^5.11.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } }, "sha512-QHnnIXdmC5GTAtm6i8eeJy5yT9npPlFyxpDm+duiDrTRKRFaAQBduArxlH3DA/hoRCCypzPONxfK9BQNIhIyZA=="],
"@ant-design/pro-components": ["@ant-design/pro-components@3.1.12-0", "", { "dependencies": { "@ant-design/cssinjs": "^2.1.2", "@ant-design/icons": "^6.1.0", "@babel/runtime": "^7.28.6", "@ctrl/tinycolor": "^4.2.0", "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@emotion/css": "^11.13.5", "@rc-component/form": "^1.7.1", "@rc-component/resize-observer": "^1.1.1", "@rc-component/table": "^1.9.1", "@rc-component/util": "^1.9.0", "@umijs/route-utils": "^4.0.3", "@umijs/use-params": "^1.0.9", "clsx": "^2.1.1", "dayjs": "^1.11.19", "lodash-es": "^4.17.23", "path-to-regexp": "^8.3.0", "react-draggable": "^4.5.0", "safe-stable-stringify": "^2.5.0", "swr": "^2.4.1" }, "peerDependencies": { "antd": "^6.0.0", "react": ">=18.0.0", "react-dom": ">=18.0.0" } }, "sha512-Tpe82PZHK1lX2eLyO35yUx99r/ZpNcq/tI+4WthjfQ/qbkz8NzxPmzdN/krAtlRsKDhPr6SpfregPKqCVueGrQ=="],
"@ant-design/pro-descriptions": ["@ant-design/pro-descriptions@2.6.10", "https://registry.npmmirror.com/@ant-design/pro-descriptions/-/pro-descriptions-2.6.10.tgz", { "dependencies": { "@ant-design/pro-field": "3.1.0", "@ant-design/pro-form": "2.32.0", "@ant-design/pro-provider": "2.16.2", "@ant-design/pro-skeleton": "2.2.1", "@ant-design/pro-utils": "2.18.0", "@babel/runtime": "^7.18.0", "rc-resize-observer": "^0.2.3", "rc-util": "^5.0.6" }, "peerDependencies": { "antd": "^4.24.15 || ^5.11.2", "react": ">=17.0.0" } }, "sha512-+4MbiOfumnWlW0Awm4m8JML5o3lR649FD24AaivCmr8BQvIAAXdTITnDMXEg8BqvdP4KOvNsStZrvYfqoev33A=="],
@ -355,15 +355,15 @@
"@csstools/selector-specificity": ["@csstools/selector-specificity@2.2.0", "https://registry.npmmirror.com/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", { "peerDependencies": { "postcss-selector-parser": "^6.0.10" } }, "sha512-+OJ9konv95ClSTOJCmMZqpd5+YGsB2S+x6w3E1oaM8UuR5j8nTNHYSz8c9BEPGDOCMQYIEEGlVPj/VY64iTbGw=="],
"@ctrl/tinycolor": ["@ctrl/tinycolor@3.6.1", "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", {}, "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA=="],
"@ctrl/tinycolor": ["@ctrl/tinycolor@4.2.0", "", {}, "sha512-kzyuwOAQnXJNLS9PSyrk0CWk35nWJW/zl/6KvnTBMFK65gm7U1/Z5BqjxeapjZCIhQcM/DsrEmcbRwDyXyXK4A=="],
"@dnd-kit/accessibility": ["@dnd-kit/accessibility@3.1.1", "https://registry.npmmirror.com/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw=="],
"@dnd-kit/core": ["@dnd-kit/core@6.3.1", "https://registry.npmmirror.com/@dnd-kit/core/-/core-6.3.1.tgz", { "dependencies": { "@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ=="],
"@dnd-kit/modifiers": ["@dnd-kit/modifiers@6.0.1", "https://registry.npmmirror.com/@dnd-kit/modifiers/-/modifiers-6.0.1.tgz", { "dependencies": { "@dnd-kit/utilities": "^3.2.1", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.0.6", "react": ">=16.8.0" } }, "sha512-rbxcsg3HhzlcMHVHWDuh9LCjpOVAgqbV78wLGI8tziXY3+qcMQ61qVXIvNKQFuhj75dSfD+o+PYZQ/NUk2A23A=="],
"@dnd-kit/modifiers": ["@dnd-kit/modifiers@9.0.0", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.3.0", "react": ">=16.8.0" } }, "sha512-ybiLc66qRGuZoC20wdSSG6pDXFikui/dCNGthxv4Ndy8ylErY0N3KVxY2bgo7AWwIbxDmXDg3ylAFmnrjcbVvw=="],
"@dnd-kit/sortable": ["@dnd-kit/sortable@7.0.2", "https://registry.npmmirror.com/@dnd-kit/sortable/-/sortable-7.0.2.tgz", { "dependencies": { "@dnd-kit/utilities": "^3.2.0", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.0.7", "react": ">=16.8.0" } }, "sha512-wDkBHHf9iCi1veM834Gbk1429bd4lHX4RpAwT0y2cHLf246GAvU2sVw/oxWNpPKQNQRQaeGXhAVgrOl1IT+iyA=="],
"@dnd-kit/sortable": ["@dnd-kit/sortable@10.0.0", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.3.0", "react": ">=16.8.0" } }, "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg=="],
"@dnd-kit/utilities": ["@dnd-kit/utilities@3.2.2", "https://registry.npmmirror.com/@dnd-kit/utilities/-/utilities-3.2.2.tgz", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg=="],
@ -2785,7 +2785,7 @@
"path-scurry": ["path-scurry@1.11.1", "https://registry.npmmirror.com/path-scurry/-/path-scurry-1.11.1.tgz", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
"path-to-regexp": ["path-to-regexp@0.1.13", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz", {}, "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA=="],
"path-to-regexp": ["path-to-regexp@8.4.2", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
"path-type": ["path-type@4.0.0", "https://registry.npmmirror.com/path-type/-/path-type-4.0.0.tgz", {}, "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="],
@ -3049,6 +3049,8 @@
"react-dom": ["react-dom@19.2.7", "https://registry.npmmirror.com/react-dom/-/react-dom-19.2.7.tgz", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.7" } }, "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ=="],
"react-draggable": ["react-draggable@4.7.0", "", { "dependencies": { "clsx": "^2.1.1", "prop-types": "^15.8.1" }, "peerDependencies": { "react": ">= 16.3.0", "react-dom": ">= 16.3.0" } }, "sha512-kTpANmKWVnFXiZ76Ag2ZowiFStuBYnJ606PI1TbUsOg29/400/JNIxI9+CuenhiAqFuXWJffz6F4UI3R51kUug=="],
"react-error-overlay": ["react-error-overlay@6.0.9", "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz", {}, "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew=="],
"react-fast-compare": ["react-fast-compare@3.2.2", "https://registry.npmmirror.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz", {}, "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ=="],
@ -3675,10 +3677,16 @@
"@ant-design/pro-provider/@ant-design/cssinjs": ["@ant-design/cssinjs@1.24.0", "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.24.0.tgz", { "dependencies": { "@babel/runtime": "^7.11.1", "@emotion/hash": "^0.8.0", "@emotion/unitless": "^0.7.5", "classnames": "^2.3.1", "csstype": "^3.1.3", "rc-util": "^5.35.0", "stylis": "^4.3.4" }, "peerDependencies": { "react": ">=16.0.0", "react-dom": ">=16.0.0" } }, "sha512-K4cYrJBsgvL+IoozUXYjbT6LHHNt+19a9zkvpBPxLjFHas1UpPM2A5MlhROb0BT8N8WoavM5VsP9MeSeNK/3mg=="],
"@ant-design/pro-provider/@ctrl/tinycolor": ["@ctrl/tinycolor@3.6.1", "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", {}, "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA=="],
"@ant-design/pro-table/@ant-design/cssinjs": ["@ant-design/cssinjs@1.24.0", "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.24.0.tgz", { "dependencies": { "@babel/runtime": "^7.11.1", "@emotion/hash": "^0.8.0", "@emotion/unitless": "^0.7.5", "classnames": "^2.3.1", "csstype": "^3.1.3", "rc-util": "^5.35.0", "stylis": "^4.3.4" }, "peerDependencies": { "react": ">=16.0.0", "react-dom": ">=16.0.0" } }, "sha512-K4cYrJBsgvL+IoozUXYjbT6LHHNt+19a9zkvpBPxLjFHas1UpPM2A5MlhROb0BT8N8WoavM5VsP9MeSeNK/3mg=="],
"@ant-design/pro-table/@ant-design/icons": ["@ant-design/icons@5.6.1", "https://registry.npmmirror.com/@ant-design/icons/-/icons-5.6.1.tgz", { "dependencies": { "@ant-design/colors": "^7.0.0", "@ant-design/icons-svg": "^4.4.0", "@babel/runtime": "^7.24.8", "classnames": "^2.2.6", "rc-util": "^5.31.1" }, "peerDependencies": { "react": ">=16.0.0", "react-dom": ">=16.0.0" } }, "sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg=="],
"@ant-design/pro-table/@dnd-kit/modifiers": ["@dnd-kit/modifiers@6.0.1", "https://registry.npmmirror.com/@dnd-kit/modifiers/-/modifiers-6.0.1.tgz", { "dependencies": { "@dnd-kit/utilities": "^3.2.1", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.0.6", "react": ">=16.8.0" } }, "sha512-rbxcsg3HhzlcMHVHWDuh9LCjpOVAgqbV78wLGI8tziXY3+qcMQ61qVXIvNKQFuhj75dSfD+o+PYZQ/NUk2A23A=="],
"@ant-design/pro-table/@dnd-kit/sortable": ["@dnd-kit/sortable@7.0.2", "https://registry.npmmirror.com/@dnd-kit/sortable/-/sortable-7.0.2.tgz", { "dependencies": { "@dnd-kit/utilities": "^3.2.0", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.0.7", "react": ">=16.8.0" } }, "sha512-wDkBHHf9iCi1veM834Gbk1429bd4lHX4RpAwT0y2cHLf246GAvU2sVw/oxWNpPKQNQRQaeGXhAVgrOl1IT+iyA=="],
"@ant-design/pro-utils/@ant-design/icons": ["@ant-design/icons@5.6.1", "https://registry.npmmirror.com/@ant-design/icons/-/icons-5.6.1.tgz", { "dependencies": { "@ant-design/colors": "^7.0.0", "@ant-design/icons-svg": "^4.4.0", "@babel/runtime": "^7.24.8", "classnames": "^2.2.6", "rc-util": "^5.31.1" }, "peerDependencies": { "react": ">=16.0.0", "react-dom": ">=16.0.0" } }, "sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg=="],
"@antv/component/@antv/scale": ["@antv/scale@0.4.16", "https://registry.npmmirror.com/@antv/scale/-/scale-0.4.16.tgz", { "dependencies": { "@antv/util": "^3.3.7", "color-string": "^1.5.5", "fecha": "^4.2.1" } }, "sha512-5wg/zB5kXHxpTV5OYwJD3ja6R8yTiqIOkjOhmpEJiowkzRlbEC/BOyMvNUq5fqFIHnMCE9woO7+c3zxEQCKPjw=="],
@ -3815,6 +3823,8 @@
"@umijs/plugins/@ant-design/icons": ["@ant-design/icons@4.8.3", "https://registry.npmmirror.com/@ant-design/icons/-/icons-4.8.3.tgz", { "dependencies": { "@ant-design/colors": "^6.0.0", "@ant-design/icons-svg": "^4.3.0", "@babel/runtime": "^7.11.2", "classnames": "^2.2.6", "lodash": "^4.17.15", "rc-util": "^5.9.4" }, "peerDependencies": { "react": ">=16.0.0", "react-dom": ">=16.0.0" } }, "sha512-HGlIQZzrEbAhpJR6+IGdzfbPym94Owr6JZkJ2QCCnOkPVIWMO2xgIVcOKnl8YcpijIo39V7l2qQL5fmtw56cMw=="],
"@umijs/plugins/@ant-design/pro-components": ["@ant-design/pro-components@2.8.10", "https://registry.npmmirror.com/@ant-design/pro-components/-/pro-components-2.8.10.tgz", { "dependencies": { "@ant-design/pro-card": "2.10.0", "@ant-design/pro-descriptions": "2.6.10", "@ant-design/pro-field": "3.1.0", "@ant-design/pro-form": "2.32.0", "@ant-design/pro-layout": "7.22.7", "@ant-design/pro-list": "2.6.10", "@ant-design/pro-provider": "2.16.2", "@ant-design/pro-skeleton": "2.2.1", "@ant-design/pro-table": "3.21.0", "@ant-design/pro-utils": "2.18.0", "@babel/runtime": "^7.16.3" }, "peerDependencies": { "antd": "^4.24.15 || ^5.11.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } }, "sha512-QHnnIXdmC5GTAtm6i8eeJy5yT9npPlFyxpDm+duiDrTRKRFaAQBduArxlH3DA/hoRCCypzPONxfK9BQNIhIyZA=="],
"@umijs/plugins/@tanstack/react-query": ["@tanstack/react-query@4.44.0", "https://registry.npmmirror.com/@tanstack/react-query/-/react-query-4.44.0.tgz", { "dependencies": { "@tanstack/query-core": "4.44.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-native": "*" }, "optionalPeers": ["react-dom", "react-native"] }, "sha512-RuIqHYrS98LrK/8kJJOJMMSQ/BCpojwsXDh7p0fBmp38ZOz6dlk+uyFRRusH+V+t3POoCsDOQ2zhomEYOeReXw=="],
"@umijs/preset-umi/@iconify/utils": ["@iconify/utils@2.1.1", "https://registry.npmmirror.com/@iconify/utils/-/utils-2.1.1.tgz", { "dependencies": { "@antfu/install-pkg": "^0.1.1", "@antfu/utils": "^0.7.2", "@iconify/types": "^2.0.0", "debug": "^4.3.4", "kolorist": "^1.6.0", "local-pkg": "^0.4.2" } }, "sha512-H8xz74JDzDw8f0qLxwIaxFMnFkbXTZNWEufOk3WxaLFHV4h0A2FjIDgNk5LzC0am4jssnjdeJJdRs3UFu3582Q=="],
@ -4175,8 +4185,6 @@
"rollup-plugin-visualizer/yargs": ["yargs@17.7.3", "https://registry.npmmirror.com/yargs/-/yargs-17.7.3.tgz", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g=="],
"router/path-to-regexp": ["path-to-regexp@8.4.2", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
"safe-array-concat/isarray": ["isarray@2.0.5", "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
"safe-push-apply/isarray": ["isarray@2.0.5", "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
@ -4389,6 +4397,8 @@
"@umijs/bundler-mako/express/merge-descriptors": ["merge-descriptors@1.0.3", "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
"@umijs/bundler-mako/express/path-to-regexp": ["path-to-regexp@0.1.13", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz", {}, "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA=="],
"@umijs/bundler-mako/express/send": ["send@0.19.2", "https://registry.npmmirror.com/send/-/send-0.19.2.tgz", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "~0.5.2", "http-errors": "~2.0.1", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "~2.4.1", "range-parser": "~1.2.1", "statuses": "~2.0.2" } }, "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg=="],
"@umijs/bundler-mako/express/type-is": ["type-is@1.6.18", "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
@ -4411,6 +4421,8 @@
"@umijs/bundler-utoopack/express/merge-descriptors": ["merge-descriptors@1.0.3", "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
"@umijs/bundler-utoopack/express/path-to-regexp": ["path-to-regexp@0.1.13", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz", {}, "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA=="],
"@umijs/bundler-utoopack/express/send": ["send@0.19.2", "https://registry.npmmirror.com/send/-/send-0.19.2.tgz", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "~0.5.2", "http-errors": "~2.0.1", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "~2.4.1", "range-parser": "~1.2.1", "statuses": "~2.0.2" } }, "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg=="],
"@umijs/bundler-utoopack/express/type-is": ["type-is@1.6.18", "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
@ -4447,6 +4459,8 @@
"@umijs/max/antd/@ant-design/react-slick": ["@ant-design/react-slick@1.0.2", "https://registry.npmmirror.com/@ant-design/react-slick/-/react-slick-1.0.2.tgz", { "dependencies": { "@babel/runtime": "^7.10.4", "classnames": "^2.2.5", "json2mq": "^0.2.0", "resize-observer-polyfill": "^1.5.1", "throttle-debounce": "^5.0.0" }, "peerDependencies": { "react": ">=16.9.0" } }, "sha512-Wj8onxL/T8KQLFFiCA4t8eIRGpRR+UPgOdac2sYzonv+i0n3kXHmvHLLiOYL655DQx2Umii9Y9nNgL7ssu5haQ=="],
"@umijs/max/antd/@ctrl/tinycolor": ["@ctrl/tinycolor@3.6.1", "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", {}, "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA=="],
"@umijs/max/antd/scroll-into-view-if-needed": ["scroll-into-view-if-needed@2.2.31", "https://registry.npmmirror.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.31.tgz", { "dependencies": { "compute-scroll-into-view": "^1.0.20" } }, "sha512-dGCXy99wZQivjmjIqihaBQNjryrz5rueJY7eHfTdyWEiR4ttYpsajb14rn9s5d4DY4EcY6+4+U/maARBXJedkA=="],
"@umijs/plugins/@ant-design/icons/@ant-design/colors": ["@ant-design/colors@6.0.0", "https://registry.npmmirror.com/@ant-design/colors/-/colors-6.0.0.tgz", { "dependencies": { "@ctrl/tinycolor": "^3.4.0" } }, "sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ=="],
@ -4475,6 +4489,8 @@
"@umijs/request-record/express/merge-descriptors": ["merge-descriptors@1.0.3", "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
"@umijs/request-record/express/path-to-regexp": ["path-to-regexp@0.1.13", "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.13.tgz", {}, "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA=="],
"@umijs/request-record/express/send": ["send@0.19.2", "https://registry.npmmirror.com/send/-/send-0.19.2.tgz", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "~0.5.2", "http-errors": "~2.0.1", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "~2.4.1", "range-parser": "~1.2.1", "statuses": "~2.0.2" } }, "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg=="],
"@umijs/request-record/express/type-is": ["type-is@1.6.18", "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
@ -4839,6 +4855,8 @@
"@umijs/max/antd/scroll-into-view-if-needed/compute-scroll-into-view": ["compute-scroll-into-view@1.0.20", "https://registry.npmmirror.com/compute-scroll-into-view/-/compute-scroll-into-view-1.0.20.tgz", {}, "sha512-UCB0ioiyj8CRjtrvaceBLqqhZCVP+1B8+NWQhmdsm0VXOJtobBCf1dBQmebCCo34qZmUwZfIH2MZLqNHazrfjg=="],
"@umijs/plugins/@ant-design/icons/@ant-design/colors/@ctrl/tinycolor": ["@ctrl/tinycolor@3.6.1", "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", {}, "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA=="],
"@umijs/request-record/express/accepts/mime-types": ["mime-types@2.1.35", "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
"@umijs/request-record/express/accepts/negotiator": ["negotiator@0.6.3", "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz", {}, "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="],

76
docs/cheatsheet.en-US.md

@ -23,7 +23,7 @@
```bash
git clone --depth 1 https://github.com/ant-design/ant-design-pro.git my-project
cd my-project
npm install
bun install
```
The project offers two modes:
@ -35,8 +35,8 @@ Switch to simple mode:
```bash
git add -A && git commit -m "chore: save before simple" # Commit first to allow revert
npm run simple # Remove demo pages and unused deps
npm install # Update dependencies
bun run simple # Remove demo pages and unused deps
bun install # Update dependencies
```
> 💡 Start with full mode to learn the project structure, then switch to simple mode for development.
@ -66,30 +66,30 @@ npm install # Update dependencies
| Command | Description |
|---------|-------------|
| `npm start` | Start dev server (UMI_ENV=dev, with Mock) |
| `npm run dev` | Start dev server (UMI_ENV=dev, no Mock) |
| `npm run start:no-mock` | Start without Mock |
| `npm run start:pre` | Pre-production environment |
| `npm run start:test` | Test environment |
| `npm run build` | Build for production |
| `npm run preview` | Preview built output (run `npm run build` first, port 8000) |
| `npm run preview:build` | Build and preview (port 8000) |
| `npm run deploy` | Build and deploy to GitHub Pages |
| `npm run analyze` | Analyze bundle size |
| `npm run lint` | Lint (Biome + TypeScript) |
| `npm run biome` | Auto-fix with Biome |
| `npm test` | Run tests |
| `npm run test:coverage` | Test with coverage |
| `npm run test:update` | Update test snapshots |
| `npm run tsc` | Type check without emitting |
| `npm run i18n-remove` | Remove i18n wrappers (locale=zh-CN) |
| `npm run record` | Record request data for login scene |
| `npm run openapi` | Generate API code from OpenAPI schema |
| `npm run simple` | Strip demo pages and unused deps |
| `bun start` | Start dev server (UMI_ENV=dev, with Mock) |
| `bun run dev` | Start dev server (UMI_ENV=dev, no Mock) |
| `bun run start:no-mock` | Start without Mock |
| `bun run start:pre` | Pre-production environment |
| `bun run start:test` | Test environment |
| `bun run build` | Build for production |
| `bun run preview` | Preview built output (run `bun run build` first, port 8000) |
| `bun run preview:build` | Build and preview (port 8000) |
| `bun run deploy` | Build and deploy to GitHub Pages |
| `bun run analyze` | Analyze bundle size |
| `bun run lint` | Lint (Biome + TypeScript) |
| `bun run biome` | Auto-fix with Biome |
| `bun test` | Run tests |
| `bun run test:coverage` | Test with coverage |
| `bun run test:update` | Update test snapshots |
| `bun run tsc` | Type check without emitting |
| `bun run i18n-remove` | Remove i18n wrappers (locale=zh-CN) |
| `bun run record` | Record request data for login scene |
| `bun run openapi` | Generate API code from OpenAPI schema |
| `bun run simple` | Strip demo pages and unused deps |
> 💡 `UMI_ENV` switches environment configs, mapping to different proxy rules in `config/proxy.ts`.
> 💡 `npm run simple` removes demo pages (dashboard, form, list etc.) and unused dependencies (plots, etc.), replacing with minimal routes. Ideal for starting from scratch. **Commit your code first so you can revert if needed.**
> 💡 `bun run simple` removes demo pages (dashboard, form, list etc.) and unused dependencies (plots, etc.), replacing with minimal routes. Ideal for starting from scratch. **Commit your code first so you can revert if needed.**
**Build tool:** This project uses [utoopack](https://github.com/utooland/utoo) (a next-gen bundler powered by Turbopack) as the default build tool, configured via the `utoopack` field in `config/config.ts`. utoopack is Webpack-compatible and supports `module.rules` for custom loaders.
@ -283,7 +283,7 @@ await request('/api/users', { method: 'POST', data: { name: 'test' } });
**OpenAPI code generation:**
```bash
npm run openapi
bun run openapi
```
Auto-generates API calling code under `src/services/` based on `config/oneapi.json`.
@ -441,9 +441,9 @@ Use SettingDrawer in dev mode to switch themes in real-time.
**Jest testing:**
```bash
npm test # Run all tests
npm run test:coverage # With coverage report
npm run test:update # Update snapshots
bun test # Run all tests
bun run test:coverage # With coverage report
bun run test:update # Update snapshots
```
Test files go next to the component, named `*.test.ts(x)`.
@ -474,14 +474,14 @@ export default {
};
```
> 💡 Use `MOCK=none` to skip mock and proxy to backend: `npm run start:no-mock`.
> 💡 Use `MOCK=none` to skip mock and proxy to backend: `bun run start:no-mock`.
→ See [umi Testing](https://umijs.org/en-US/docs/guides/test), [umi Mock](https://umijs.org/en-US/docs/guides/mock)
## FAQ
**Q: How to disable Mock?**
`npm run start:no-mock` or `cross-env MOCK=none max dev`
`bun run start:no-mock` or `cross-env MOCK=none max dev`
**Q: How to change the primary color?**
Edit `colorPrimary` in `config/defaultSettings.ts`. Use SettingDrawer for live preview in dev mode.
@ -500,10 +500,10 @@ npx skills add ant-design/ant-design-pro
Then run `/pro-upgrade` in Claude Code at the project root — AI will auto-diff the latest template and assist your upgrade (deps, config, code patterns, etc.), with conservative handling for ambiguous merges. For other AI assistants, paste the content of `.claude/skills/pro-upgrade/SKILL.md` to them.
**Q: How to deploy?**
`npm run build` generates `dist/`. Deploy to any static file server. Set `publicPath` for non-root deployments. `npm run deploy` builds and publishes to GitHub Pages automatically (pushes to gh-pages branch).
`bun run build` generates `dist/`. Deploy to any static file server. Set `publicPath` for non-root deployments. `bun run deploy` builds and publishes to GitHub Pages automatically (pushes to gh-pages branch).
**Q: How to use OpenAPI code generation?**
1. Configure `openAPI` in `config/config.ts` 2. Run `npm run openapi` 3. Code is auto-generated under `src/services/`
1. Configure `openAPI` in `config/config.ts` 2. Run `bun run openapi` 3. Code is auto-generated under `src/services/`
→ See [umi FAQ](https://umijs.org/en-US/docs/introduce/faq)
@ -551,7 +551,7 @@ Then run `/pro-upgrade` in Claude Code at the project root — AI will auto-diff
```bash
# 1. Edit OpenAPI config: config/oneapi.json
# 2. Run generation (overwrites src/services/ant-design-pro/)
npm run openapi
bun run openapi
# 3. Never edit generated code manually — modify oneapi.json and regenerate
```
@ -559,8 +559,8 @@ npm run openapi
```bash
git add -A && git commit -m "chore: save before simple" # Must commit first
npm run simple # Irreversible
npm install # Update dependencies
bun run simple # Irreversible
bun install # Update dependencies
```
## AI Skills (Claude Code)
@ -581,7 +581,7 @@ What it does:
2. Classifies framework vs. business files
3. Merges dependency updates, config changes, and code pattern migrations
4. Runs `npx antd lint` to catch antd-specific issues
5. Verifies with `npm run lint && npm run build`
5. Verifies with `bun run lint && bun run build`
### `/antd` — Ant Design CLI Helper
@ -613,8 +613,8 @@ For other AI assistants (Cursor, etc.), paste the content of `.claude/skills/pro
## Constraints & Gotchas
- **`src/services/ant-design-pro/`** is auto-generated code. Do NOT edit manually. Modify `config/oneapi.json` and run `npm run openapi` to regenerate.
- **`npm run simple` is irreversible**: It deletes demo pages and unused dependencies. Always commit before running.
- **`src/services/ant-design-pro/`** is auto-generated code. Do NOT edit manually. Modify `config/oneapi.json` and run `bun run openapi` to regenerate.
- **`bun run simple` is irreversible**: It deletes demo pages and unused dependencies. Always commit before running.
- **`.umi` temp directory**: `src/.umi` is auto-generated by Umi. Delete it and restart the dev server if you encounter unexpected behavior.
- **Biome over ESLint**: This project uses Biome for linting and formatting. Do not install ESLint or Prettier plugins.
- **Commit convention**: Must follow [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `feat:`, `fix:`, `chore:`).

78
docs/cheatsheet.zh-CN.md

@ -23,7 +23,7 @@
```bash
git clone --depth 1 https://github.com/ant-design/ant-design-pro.git my-project
cd my-project
npm install
bun install
```
项目提供两种模式:
@ -35,8 +35,8 @@ npm install
```bash
git add -A && git commit -m "chore: save before simple" # 先提交,以便回退
npm run simple # 删除示例页面和多余依赖
npm install # 更新依赖
bun run simple # 删除示例页面和多余依赖
bun install # 更新依赖
```
> 💡 建议先用完整模式熟悉项目结构,再切换精简模式开始开发。
@ -66,30 +66,30 @@ npm install # 更新依赖
| 命令 | 说明 |
|------|------|
| `npm start` | 启动开发服务器(UMI_ENV=dev,带 Mock) |
| `npm run dev` | 启动开发服务器(UMI_ENV=dev,无 Mock) |
| `npm run start:no-mock` | 无 Mock 启动 |
| `npm run start:pre` | 预发布环境启动 |
| `npm run start:test` | 测试环境启动 |
| `npm run build` | 构建生产产物 |
| `npm run preview` | 预览已构建产物(需先 `npm run build`,端口 8000) |
| `npm run preview:build` | 构建并本地预览(端口 8000) |
| `npm run deploy` | 构建并部署到 GitHub Pages |
| `npm run analyze` | 构建产物体积分析 |
| `npm run lint` | 代码检查(Biome + TypeScript) |
| `npm run biome` | Biome 自动修复 |
| `npm test` | 运行测试 |
| `npm run test:coverage` | 测试覆盖率 |
| `npm run test:update` | 更新测试快照 |
| `npm run tsc` | 类型检查(不生成文件) |
| `npm run i18n-remove` | 移除国际化(locale=zh-CN) |
| `npm run record` | 录制登录场景请求数据 |
| `npm run openapi` | 根据 OpenAPI 生成 API 代码 |
| `npm run simple` | 精简模式(删除示例页面和多余依赖) |
| `bun start` | 启动开发服务器(UMI_ENV=dev,带 Mock) |
| `bun run dev` | 启动开发服务器(UMI_ENV=dev,无 Mock) |
| `bun run start:no-mock` | 无 Mock 启动 |
| `bun run start:pre` | 预发布环境启动 |
| `bun run start:test` | 测试环境启动 |
| `bun run build` | 构建生产产物 |
| `bun run preview` | 预览已构建产物(需先 `bun run build`,端口 8000) |
| `bun run preview:build` | 构建并本地预览(端口 8000) |
| `bun run deploy` | 构建并部署到 GitHub Pages |
| `bun run analyze` | 构建产物体积分析 |
| `bun run lint` | 代码检查(Biome + TypeScript) |
| `bun run biome` | Biome 自动修复 |
| `bun test` | 运行测试 |
| `bun run test:coverage` | 测试覆盖率 |
| `bun run test:update` | 更新测试快照 |
| `bun run tsc` | 类型检查(不生成文件) |
| `bun run i18n-remove` | 移除国际化(locale=zh-CN) |
| `bun run record` | 录制登录场景请求数据 |
| `bun run openapi` | 根据 OpenAPI 生成 API 代码 |
| `bun run simple` | 精简模式(删除示例页面和多余依赖) |
> 💡 `UMI_ENV` 用于切换环境配置,对应 `config/proxy.ts` 中的不同代理规则。
> 💡 `npm run simple` 会删除示例页面(dashboard、form、list 等)和多余依赖(plots 等),替换为精简路由,适合从零开始开发。**建议先提交代码,以便需要时回退。**
> 💡 `bun run simple` 会删除示例页面(dashboard、form、list 等)和多余依赖(plots 等),替换为精简路由,适合从零开始开发。**建议先提交代码,以便需要时回退。**
**构建工具:** 本项目使用 [utoopack](https://github.com/utooland/utoo)(基于 Turbopack 的新一代打包器)作为默认构建工具,通过 `config/config.ts` 中的 `utoopack` 字段配置。utoopack 兼容 Webpack 配置格式,支持 `module.rules` 配置自定义加载器。
@ -283,7 +283,7 @@ await request('/api/users', { method: 'POST', data: { name: 'test' } });
**OpenAPI 代码生成:**
```bash
npm run openapi
bun run openapi
```
根据 `config/oneapi.json` 自动生成 `src/services/` 下的 API 调用代码。
@ -441,9 +441,9 @@ antd: {
**Jest 测试:**
```bash
npm test # 运行所有测试
npm run test:coverage # 带覆盖率报告
npm run test:update # 更新快照
bun test # 运行所有测试
bun run test:coverage # 带覆盖率报告
bun run test:update # 更新快照
```
测试文件放在对应组件目录下,命名为 `*.test.ts(x)`。
@ -474,14 +474,14 @@ export default {
};
```
> 💡 用 `MOCK=none` 启动可跳过 Mock,直接代理到后端:`npm run start:no-mock`。
> 💡 用 `MOCK=none` 启动可跳过 Mock,直接代理到后端:`bun run start:no-mock`。
→ 更多内容见 [umi 测试](https://umijs.org/docs/guides/test)、[umi Mock](https://umijs.org/docs/guides/mock)
## FAQ
**Q: 如何关闭 Mock?**
`npm run start:no-mock` 或 `cross-env MOCK=none max dev`
`bun run start:no-mock` 或 `cross-env MOCK=none max dev`
**Q: 如何修改主题色?**
修改 `config/defaultSettings.ts` 的 `colorPrimary`,开发时可用 SettingDrawer 实时调整。
@ -500,10 +500,10 @@ npx skills add ant-design/ant-design-pro
然后在项目根目录用 Claude Code 运行 `/pro-upgrade`,AI 会自动对比最新模板并辅助完成升级(依赖、配置、代码模式等),遇到冲突时会保守处理并询问确认。如使用其他 AI 助手,可将 `.claude/skills/pro-upgrade/SKILL.md` 中的内容提供给它。
**Q: 如何部署?**
`npm run build` 生成 `dist/` 目录,部署到任意静态服务器。配置 `publicPath` 处理非根目录部署。`npm run deploy` 会自动构建并发布到 GitHub Pages(推送到 gh-pages 分支)。
`bun run build` 生成 `dist/` 目录,部署到任意静态服务器。配置 `publicPath` 处理非根目录部署。`bun run deploy` 会自动构建并发布到 GitHub Pages(推送到 gh-pages 分支)。
**Q: 如何使用 OpenAPI 代码生成?**
1. 在 `config/config.ts` 配置 `openAPI` 2. 运行 `npm run openapi` 3. 自动生成 `src/services/` 下的代码
1. 在 `config/config.ts` 配置 `openAPI` 2. 运行 `bun run openapi` 3. 自动生成 `src/services/` 下的代码
→ 更多内容见 [umi FAQ](https://umijs.org/docs/introduce/faq)
@ -551,7 +551,7 @@ npx skills add ant-design/ant-design-pro
```bash
# 1. 编辑 OpenAPI 配置:config/oneapi.json
# 2. 运行生成命令(覆盖 src/services/ant-design-pro/)
npm run openapi
bun run openapi
# 3. 不要手动编辑生成代码,改 oneapi.json 重新生成
```
@ -559,11 +559,11 @@ npm run openapi
```bash
git add -A && git commit -m "chore: save before simple" # 必须先提交
npm run simple # 不可逆操作
npm install # 更新依赖
bun run simple # 不可逆操作
bun install # 更新依赖
```
## AI Skills(Claude Code)
## AI Skills (Claude Code)
本项目内置两个 [Claude Code Skills](https://docs.anthropic.com/en/docs/claude-code/skills)(位于 `.claude/skills/`):
@ -581,7 +581,7 @@ npm install # 更新依赖
2. 将文件分类为框架文件和业务文件
3. 合并依赖更新、配置变更和代码模式迁移
4. 运行 `npx antd lint` 检查 antd 相关问题
5. 通过 `npm run lint && npm run build` 验证
5. 通过 `bun run lint && bun run build` 验证
### `/antd` — Ant Design CLI 助手
@ -613,8 +613,8 @@ npx skills add ant-design/ant-design-pro
## 注意事项
- **`src/services/ant-design-pro/`** 为自动生成代码,禁止手动编辑。修改 `config/oneapi.json` 后执行 `npm run openapi` 重新生成
- **`npm run simple` 不可逆**:会删除示例页面和多余依赖,执行前务必提交代码
- **`src/services/ant-design-pro/`** 为自动生成代码,禁止手动编辑。修改 `config/oneapi.json` 后执行 `bun run openapi` 重新生成
- **`bun run simple` 不可逆**:会删除示例页面和多余依赖,执行前务必提交代码
- **`.umi` 临时目录**:`src/.umi` 由 Umi 自动生成,遇到异常可删除后重启开发服务器
- **Biome 代替 ESLint**:项目使用 Biome 进行 lint 和格式化,不要安装 ESLint 或 Prettier 插件
- **Commit 规范**:必须遵循 [Conventional Commits](https://www.conventionalcommits.org/),如 `feat:`, `fix:`, `chore:` 等

4
package.json

@ -37,7 +37,7 @@
"dependencies": {
"@ant-design/icons": "^6.2.5",
"@ant-design/plots": "^2.6.8",
"@ant-design/pro-components": "^2.8.10",
"@ant-design/pro-components": "3.1.12-0",
"@ant-design/x": "^2.8.0",
"@ant-design/x-markdown": "^2.8.0",
"@ant-design/x-sdk": "^2.8.0",
@ -93,7 +93,7 @@
"vitest": "4.1.9"
},
"engines": {
"node": ">=22.0.0"
"node": ">=22.13.0"
},
"create-umi": {
"ignoreScript": [

10
scripts/i18n-remove.js

@ -1,6 +1,6 @@
/**
* i18n 移除脚本 - 将国际化的文本替换为中文,移除 i18n 相关代码
* 执行 npm run i18n-remove 运行此脚本
* 执行 bun run i18n-remove 运行此脚本
*
* 此操作不可逆,会执行以下变更:
* - 读取 src/locales/zh-CN 的翻译映射
@ -338,7 +338,7 @@ function processFile(filePath, localeMap) {
content = content.replace(/\{'([^']*)'\}/g, (match, text, offset, str) => {
const before = str.slice(Math.max(0, offset - 30), offset);
const charBeforeBrace = before.trimEnd().slice(-1);
// 不简化: JSX 属性(=)、模板字符串($)、函数参数/数组/表达式((,[,,)
// 不简化:JSX 属性 (=)、模板字符串 ($)、函数参数/数组/表达式 ((,[,,)
if (
charBeforeBrace === '=' ||
charBeforeBrace === '$' ||
@ -367,7 +367,7 @@ function processFile(filePath, localeMap) {
if (content !== original) {
fs.writeFileSync(filePath, content);
const relPath = path.relative('.', filePath);
console.log(`✓ 已处理: ${relPath}`);
console.log(`✓ 已处理:${relPath}`);
}
}
@ -406,7 +406,7 @@ function replaceFormatMessageCalls(content, localeMap) {
const defaultMsg = dmMatch ? dmMatch[1] || dmMatch[2] : '';
// 检查是否有第二参数(ICU 格式化参数),如果有则跳过
// 第一参数结束位置: 找到第一个 },{ 或 },\s*{
// 第一参数结束位置:找到第一个 },{ 或 },\s*{
const firstArgEnd = fullCall.indexOf('},');
if (firstArgEnd !== -1 && firstArgEnd < fullCall.length - 2) {
// 有第二参数 — 无法静态替换,跳过
@ -587,7 +587,7 @@ function main() {
console.log('\n========================================');
console.log(' i18n 移除完成!');
console.log(' 请运行 npm install 并检查代码');
console.log(' 请运行 bun install 并检查代码');
console.log('========================================');
}

22
scripts/simple.js

@ -1,6 +1,6 @@
/**
* 精简脚本 - 将完整版精简为简单版
* 执行 npm run simple 运行此脚本
* 执行 bun run simple 运行此脚本
*
* 此操作不可逆,会删除以下内容:
* - 页面目录:dashboard, form, list/basic-list, list/card-list, list/search, profile, result, exception, account, user/register, user/register-result
@ -42,9 +42,9 @@ const devDepsToRemove = [
function deleteDir(dirPath) {
if (fs.existsSync(dirPath)) {
fs.rmSync(dirPath, { recursive: true, force: true });
console.log(`✓ 已删除目录: ${dirPath}`);
console.log(`✓ 已删除目录:${dirPath}`);
} else {
console.log(`- 目录不存在,跳过: ${dirPath}`);
console.log(`- 目录不存在,跳过:${dirPath}`);
}
}
@ -52,9 +52,9 @@ function deleteDir(dirPath) {
function deleteFile(filePath) {
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
console.log(`✓ 已删除文件: ${filePath}`);
console.log(`✓ 已删除文件:${filePath}`);
} else {
console.log(`- 文件不存在,跳过: ${filePath}`);
console.log(`- 文件不存在,跳过:${filePath}`);
}
}
@ -68,12 +68,12 @@ function replaceRoutes() {
const simpleRoutes = fs.readFileSync(simpleRoutesPath, 'utf-8');
// 写入到 routes.ts
fs.writeFileSync(routesPath, simpleRoutes);
console.log(`✓ 已替换路由配置: ${routesPath}`);
console.log(`✓ 已替换路由配置:${routesPath}`);
// 删除简单版路由备份文件
fs.unlinkSync(simpleRoutesPath);
console.log(`✓ 已删除备份文件: ${simpleRoutesPath}`);
console.log(`✓ 已删除备份文件:${simpleRoutesPath}`);
} else {
console.log(`- 简单版路由配置不存在,跳过: ${simpleRoutesPath}`);
console.log(`- 简单版路由配置不存在,跳过:${simpleRoutesPath}`);
}
}
@ -89,7 +89,7 @@ function updatePackageJson() {
for (const dep of depsToRemove) {
if (pkg.dependencies[dep]) {
delete pkg.dependencies[dep];
console.log(`✓ 已移除依赖: ${dep}`);
console.log(`✓ 已移除依赖:${dep}`);
modified = true;
}
}
@ -100,7 +100,7 @@ function updatePackageJson() {
for (const dep of devDepsToRemove) {
if (pkg.devDependencies[dep]) {
delete pkg.devDependencies[dep];
console.log(`✓ 已移除开发依赖: ${dep}`);
console.log(`✓ 已移除开发依赖:${dep}`);
modified = true;
}
}
@ -157,7 +157,7 @@ function main() {
console.log('\n========================================');
console.log(' 精简完成!');
console.log(' 请运行 npm install 更新依赖');
console.log(' 请运行 bun install 更新依赖');
console.log('========================================');
}

Loading…
Cancel
Save