Repository navigation
chore(docs): migrate toolchain to vite-plus standard - #102
Conversation
Replace the scattered Prettier/ESLint/lint-staged/simple-git-hooks stack with the unified vite-plus toolchain described by the SoybeanJS standard templates, and refresh the docs pages that described the old tooling. Toolchain: - add vite.config.ts (staged/lint/fmt from @soybeanjs/oxc-config) - add eslint.config.mjs using @soybeanjs/eslint-config-vue, drop eslint.config.js - add .vite-hooks/pre-commit and the `prepare: vp config --no-agent` script - add AGENTS.md, .github/workflows/pr-agent.yml, .editorconfig, .gitattributes - align .vscode settings/extensions/launch with the template - package.json: drop @soybeanjs/eslint-config, eslint-plugin-vue, vue-eslint-parser; add @soybeanjs/oxc-config, tsx, vite-plus - pnpm-workspace.yaml: add the vite/typescript catalogs - bump vitepress to 2.0.0-alpha.20, which requires vite 8 and now resolves to the vite shipped by vite-plus Docs: - rewrite standard/lint, standard/tools and guide/cli/git-hooks (zh/en/jp) to describe vp fmt, vp lint, vp staged and vp config - drop stale prettier/simple-git-hooks references in intro and quick-start - fix vue/no-template-target-blank in .vitepress/theme/NoticeBar.vue
| * text=auto | ||
| *.* text eol=lf |
There was a problem hiding this comment.
二进制文件损坏风险
*.* text eol=lf 对所有带扩展名的文件显式设置 text,会绕过 git 的二进制自动检测,强制执行 CRLF→LF 归一化。PNG 等二进制资源的文件签名本身就包含 0D 0A 字节(PNG magic 为 89 50 4E 47 0D 0A 1A 0A),一旦被 git add 或 git add --renormalize 就会被改写而损坏;文档站通常会包含 public 下的图片、favicon 等二进制资产。建议只保留 * text=auto(可安全识别二进制),或补充 *.png、*.ico、*.woff2 等文件的 binary 覆盖规则。
| > 1、把 `package.json` 的 `prepare` 脚本删掉 | ||
| > | ||
| > 2、执行 `simple-git-hooks` 命令 | ||
| > 2、删除 `.vite-hooks/` 目录下的钩子脚本(例如 `pre-commit`) |
There was a problem hiding this comment.
文档步骤不完整
「永久关闭校验」的两个步骤并不能真正关闭钩子:core.hooksPath 已被 prepare 指向 .vite-hooks/_,删除 prepare 脚本和 .vite-hooks/ 下的源脚本后,_ 目录中已生成的 pre-commit 钩子依然生效(轻则继续执行检查,重则因源脚本缺失报错而阻断提交)。已在本地执行过安装的开发者照做后会发现校验并未关闭,应补充 git config --unset core.hooksPath 或删除 .vite-hooks/_ 目录。英文版(src/guide/cli/git-hooks.md)与日文版(src/jp/guide/cli/git-hooks.md)存在同样问题。
| @@ -94,8 +94,8 @@ pnpm i | |||
| "gen-route": "sa gen-route", | |||
| // eslint check and auto fix | |||
| "lint": "eslint . --fix", | |||
There was a problem hiding this comment.
文档不一致
中文版 quick-start 已把示例脚本更新为 "lint": "vp lint --fix && eslint --fix .",但英文版与日文版同一示例中 lint 仍是 "eslint . --fix",与本次迁移到 vite-plus 后的命令及仓库实际 package.json 不一致;读者按英文/日文文档配置会得到与规范不符的 lint 命令。建议同步更新两个语言版本。
PR Reviewer Guide 🔍(Review updated until commit 0949a75)Here are some key observations to aid the review process:
✅ Resolved findingspackage.jsonPossible Issue 本 PR 在 AGENTS.mdDocumentation Inconsistency
src/jp/standard/tools.md:78-85文档不一致 新增的日语文档中 .gitattributes:1-2二进制文件损坏风险
src/zh/guide/cli/git-hooks.md:34-36文档步骤不完整 「永久关闭校验」的两个步骤并不能真正关闭钩子: src/guide/quick-start.md:96文档不一致 中文版 quick-start 已把示例脚本更新为 |
Cloudflare Pages only sets NODE_VERSION for the production environment, so preview builds fell back to the build image default of node 18.17.1. vite-plus requires node ^22.18.0 || ^24.11.0 || >=26, and its `vp` bin is an extensionless ESM entry, so the `prepare` script died with ERR_UNKNOWN_FILE_EXTENSION and took the whole build down. Add a repo-level .nvmrc so every environment resolves the same node version, and raise the engines floor to match what vite-plus needs.
- .gitattributes: use the template `* text=auto eol=lf` instead of a separate `*.* text eol=lf` rule, which forced `text` on every file with an extension and could mangle binary assets - quick-start: the en and jp `lint` example still read `eslint . --fix`; align it with the zh version and with the actual `package.json` - quick-start: eslint.config.js is now eslint.config.mjs - git-hooks: deleting the `prepare` script does not disable hooks on its own; core.hooksPath already points at the generated dispatcher, so document `vp hooks disable` for all three locales
Deploying soybean-admin-docs with
|
| Latest commit: |
0949a75
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://24fc1eb8.soybean-admin-docs-d90.pages.dev |
| Branch Preview URL: | https://chore-standardize.soybean-admin-docs-d90.pages.dev |
| ```json | ||
| { | ||
| "engines": { | ||
| "node": ">=20.19.0", | ||
| "pnpm": ">=8.7.0" | ||
| } | ||
| } | ||
| ``` |
There was a problem hiding this comment.
文档不一致
新增的日语文档中 engines 示例仍写 "node": ">=20.19.0",而同一 PR 已将本仓库 package.json 的 engines 提升为 >=22.18.0(.nvmrc 也升到 24.15.0)。该页面正是向用户介绍新版 vite-plus 工具链的入口,却展示过时的 Node 最低版本,可能误导用户在不满足实际要求的旧 Node 环境下安装运行。建议与本次迁移后的实际约束(>=22.18.0)对齐,并顺带核对中文版对应段落是否同样过时。
|
Persistent review updated to latest commit 948eb26 |
vite-plus requires node ^22.18.0 || ^24.11.0 || >=26, so the engines floor is now >=22.18.0. Update the two `engines` examples in the tools pages and the tutorial note that still advertised >=20.19.0.
|
Persistent review updated to latest commit caadaaf |
- AGENTS.md carried the template's `ubean` / `proposals` / `agents` scope examples, which match nothing in this repository; point them at the real areas instead - `catalog:` in pnpm-workspace.yaml needs pnpm >= 9.5, so raising the engines floor to >=10.0.0 keeps installs from failing on declarations the pinned pnpm would reject; sync the two docs examples
|
Persistent review updated to latest commit 0949a75 |
User description
What
Replace the scattered Prettier / ESLint / lint-staged / simple-git-hooks stack with the unified vite-plus toolchain from the SoybeanJS
templates/vue-tsstandard, and refresh the docs pages that described the old tooling.Also bumps three dependencies.
Toolchain
vite.config.ts—staged/lint/fmtsourced from@soybeanjs/oxc-config,resolve.tsconfigPaths: trueeslint.config.mjsusing@soybeanjs/eslint-config-vue, dropeslint.config.js.vite-hooks/pre-commit(vp staged) andprepare: vp config --no-agentAGENTS.md,.github/workflows/pr-agent.yml.editorconfig,.gitattributes,.vscode/{settings,extensions,launch}.jsonwith the templatepackage.json— drop@soybeanjs/eslint-config,eslint-plugin-vue,vue-eslint-parser; add@soybeanjs/oxc-config,tsx,vite-pluspnpm-workspace.yaml— add thevite/typescriptcatalogsvitepressto2.0.0-alpha.20, which requires vite 8 and now resolves to the vite shipped by vite-plusdev/build/previewintentionally stay on the nativevitepresscommands: VitePress drives its own internalcreateServer/buildand ignores the projectvite.config.ts.Dependencies
@types/node^26.6.4^26.6.5vue-tsc^3.3.12^3.3.13vitepress-plugin-llms^1.13.1^1.14.0Docs (zh / en / jp)
standard/lint,standard/tools,guide/cli/git-hooksaroundvp fmt/vp lint/vp staged/vp configguide/introandguide/quick-startvue/no-template-target-blankin.vitepress/theme/NoticeBar.vueVerification
pnpm fmt/pnpm lint/pnpm typecheck/pnpm buildall exit 0vp check --fixgit config core.hooksPathis.vite-hooks/_Notes
One non-obvious blocker hit along the way: with
vue3.5.38, VitePress2.0.0-alpha.20splits@vue/sharedinto two copies andwatch(lang, fn)fails witherror TS2769: No overload matches this callinNoticeBar.vue. Fixed by bumpingvueto 3.5.43 —pnpm installalone does not pick it up, sincepackage.jsonpinned^3.5.38and pnpm reuses the lockfile version.Need help on this PR? Tag
@codesmith-botwith what you need.PR Type
Enhancement, Documentation, Other
Description
将分散的 Prettier / ESLint / lint-staged / simple-git-hooks 工具链统一迁移到 vite-plus(
vp fmt/vp lint/vp staged/vp config)重写 zh / en / jp 三语文档,介绍新工具链并移除过时的 prettier、simple-git-hooks 说明
新增 PR-Agent CI 工作流、
AGENTS.md编码规范与.nvmrc固定 Node 版本升级依赖(vitepress
2.0.0-alpha.20、vue、vue-tsc 等)并将 engines 提升至 Node>=22.18.0、pnpm>=10.0.0修复
NoticeBar.vue中target="_blank"缺少rel的 lint 问题;其余文件按新格式化规则调整 import 排序Diagram Walkthrough
File Walkthrough
2 files
新增 vite-plus 配置(staged、lint、fmt)新增 PR-Agent 自动评审工作流1 files
更新脚本与依赖至 vite-plus 工具链9 files
新增 vite 与 typescript catalog 及 overrides新配置改用 @soybeanjs/eslint-config-vue删除旧版 eslint 配置文件新增 pre-commit 钩子执行 vp staged固定 Node 版本为 24.15.0切换默认格式化器为 Oxc更新推荐插件列表加入 Oxc更新调试配置改用 tsx 运行新增 skipLibCheck 编译选项7 files
新增 AI 编码规范与提交约定重写英文格式化检查文档为 vite-plus重写中文格式化检查文档为 vite-plus重写日文格式化检查文档为 vite-plus重写中文工具规范为 vite-plus 工具链重写日文工具规范为 vite-plus 工具链更新快速开始的脚本与插件说明1 files
修复链接缺少 rel 属性问题22 files