Files
4dc473ba55 refactor(api): modular defineApi layer with shared API_PREFIX (#1181)
* refactor(api): introduce defineApi + axios request layer

Replace ad-hoc fetch httpClient with api/request.ts (axios interceptors,
envelope unwrap, auth refresh) and defineApi-based resource modules.
Move session hydration into api/auth, sync both templates, and update docs.

Co-authored-by: zuiidea <zuiiidea@gmail.com>

* chore: unify Cursor rules, fix monorepo install hooks, refresh basic docs

Add root preinstall to set githooks and disable parallel vp config git lock races; merge per-app Cursor thin rules into app.mdx; keep template READMEs free of monorepo-only paths and describe basic as default English rather than English-only.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: add root turbo fmt and format app sources

Expose fmt via turbo at the monorepo root, apply Oxfmt in basic/with-lingui, and run vp staged through pnpm exec in pre-commit so hooks work without a global vp.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: drop root eslint/prettier and bump turbo to 2.11.9

Root formatting and lint stay on turbo fmt/lint via Vite+ in workspace apps.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: consolidate agent guidance into AGENTS.md

Merge scoped instructions into per-app AGENTS.md, add monorepo AGENTS.md and add-resource skill, and remove template .github Copilot files plus the Cursor app router rule.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(basic): add add-resource skill and portable app-root paths

Align basic with with-lingui for CRUD scaffolding via AGENTS.md and .agents/skills, and drop hardcoded monorepo paths in agent docs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(api): split modules under shared/ with API_PREFIX

Move auth and users into folder modules, centralize path constants, and align MSW with endpoint paths in both template apps.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: document modular API layer in README files

Expand template READMEs with src/api layout, fix CLI table and E2E script references.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: align site with modular src/api layout

Document API_PREFIX, folder structure, templates, and E2E script usage in en/zh.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: zuiidea <zuiidea@example.com>
2026-10-22 23:13:22 +08:00

44 lines
1.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 可用脚本
description: package.json 中与开发相关的 npm 脚本
---
# 可用脚本
在模板目录执行(需先 `vp install`)。两模板大部分脚本相同;**仅 with-lingui** 含 `i18n:*` 脚本。
## 开发与构建
| 脚本 | 说明 |
|------|------|
| `vp dev` | 启动开发服务器(默认端口 5173) |
| `vp build` | 生产构建(模板中常与 `tsc` 组合,见各 `package.json`) |
| `vp preview` | 预览构建产物 |
## 质量
| 脚本 | 说明 |
|------|------|
| `vp fmt` | 格式化 |
| `vp lint` | Lint |
| `vp check --no-fmt` | 类型检查等(模板内常用 `check`) |
## 测试
| 脚本 | 说明 |
|------|------|
| `pnpm run test:unit` | Vitest 单元测试 |
| `pnpm run test:e2e` | Playwright 全部 E2E |
| `pnpm run test:e2e -- e2e/login.spec.ts e2e/users.spec.ts` | 核心流程(登录 + users CRUD) |
| `pnpm run test:e2e:ui` | Playwright UI 模式 |
## With Lingui 专有
| 脚本 | 说明 |
|------|------|
| `pnpm run i18n:extract` | 抽取文案 |
| `pnpm run i18n:compile` | 编译 catalog |
| `pnpm run i18n:check` | 抽取后校验 git diff(CI 友好) |
具体以各应用 **`package.json` 的 `scripts`** 为准。