fix(docs): 修复 docs:dev 全新 checkout 无法启动#130
Merged
Merged
Conversation
token-meta.json / token.json 是 gitignored 的构建产物,docs:dev 未生成它们, 全新 checkout 后 component-token-table.vue import 报错无法启动。 在 docs:dev 前置 build:token,与 docs build 脚本保持一致。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 本次变更属于 ...
🔗 相关 Issue
无对应 Issue。复现:在全新 checkout 上执行
vp run docs:dev(或pnpm docs:dev)会因缺失 token 资源而崩溃(测试 #129 时发现,但该问题在 main 上早已存在,与搜索功能无关)。💡 背景与方案
问题:
token-meta.json与token.json是.gitignore忽略的构建产物,分别由@antdv-next/x的build:token-meta(typedoc 解析源码)与build:token-statistic(依赖build:comp产物做 SSR 收集)生成。docs 的build脚本已前置build:token,但docs:dev没有,导致全新 checkout / 切分支后component-token-table.vueimport 这两个文件报错、dev 无法启动:方案: 在
docs:dev的两个入口(根package.json与packages/docs/package.json)前置vp run --filter @antdv-next/x build:token,与 build 脚本保持一致。build:token失败则&&中止,不会带病启动。验证: 删除两个 token 文件后执行
vp run docs:dev,确认先自动执行build:token重新生成token-meta.json/token.json,随后 dev server 正常启动,无 import 报错。代价: 每次 dev 启动多约 8s(增量)/ 15-40s(冷启动)用于构建 token,换取 token 数据始终与当前 x 源码一致。
📝 变更日志
docs:devfailing to start on fresh checkout by generating token assets firstdocs:dev因缺失 token 资源无法启动的问题