| `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.
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.
然后在项目根目录用 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 分支)。