Uh oh!
There was an error while loading. Please reload this page.
fix(create-plugin): 把脚手架 build 侧 devDependencies 锚到仓内工具链,并把整张清单钉进 parity 测试 - #3754
Merged
Merged
Conversation
…in the whole manifest
The five build-side ranges in `DEV_DEPENDENCIES` were never sourced from
anything: the scaffold declared vite ^7.3.1, @vitejs/plugin-react ^4.2.1,
vite-plugin-dts ^4.5.4, typescript ^5.9.3 and vitest ^4.0.18 while this repo
builds and tests every in-tree plugin on ^8.2.0 / ^6.0.5 / ^5.0.3 / ^6.0.3 /
^4.1.10. objectui#3716's end-to-end run of the generated artifact only ever
exercised the in-repo versions, so the declared ranges were not under test.
All five now quote an in-repo anchor. Two anchors are needed: the generator
writes into `<cwd>/packages/plugin-<name>`, so a generated plugin is a sibling
of `packages/plugin-*`, and those manifests anchor the two build-only tools the
root manifest omits (@vitejs/plugin-react, vite-plugin-dts) while the root
anchors the rest. All 19 in-repo plugins already agree on both ranges.
The parity test now covers every entry of the generated devDependencies instead
of the three testing ones, plus a completeness check that fails on a dependency
added without an anchor, and a cross-check that the two anchors agree wherever
both declare a dependency.
Also switches the generated vite.config.ts from `__dirname` to
`import.meta.dirname`. vite 8 still defines `__dirname` under its default
`bundle` config loader but warns on it, and under `configLoader: 'native'` --
planned to become the default -- the generated config failed to load outright
("__dirname is not defined in ES module scope"). Same conversion
apps/console/vite.config.ts got in objectui#3384.
Not a peer-dependency fix: @vitejs/plugin-react ^4.2.1 resolved to 4.7.0, whose
vite peer had widened to accept vite 7, so the old manifest installed cleanly
under strict-peer-dependencies. The cost was a scaffold one to two majors
behind its own monorepo.
Fixes#3742
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRtThe latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 8, 2026 12:10
Uh oh!
There was an error while loading. Please reload this page.
yinlianghui pushed a commit
that referenced
this pull request
Aug 8, 2026
…nding (#3715) PR #3754 (#3742) landed while this branch was open and turned templates.test.ts from "the three testing ranges are sourced from the repo" into "every generated devDependency range is anchored, none unpinned". The page said "the testing ones", which was accurate at the fetch point and understated after that merge — exactly the drift this shrink exists to avoid, so the sentence now names the anchoring without naming a subset or a count.
This was referenced Aug 8, 2026
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…bjectstack-ai#3715) (objectstack-ai#3760) * docs(create-plugin): shrink the page to what does not drift, point at buildPluginFiles() (objectstack-ai#3715) The page described a scaffolder that does not exist: it claimed the CLI installs dependencies and inits a git repo (it does neither), listed six prompts (there are two after the name), put the output in the current directory (it writes packages/plugin-NAME), told readers to run `npm run dev` against a build.lib config that has no dev server, and documented a whole `.create-plugin.config.js` configuration surface the generator never reads. Every one of those distortions came from transcribing generator output into prose, so per the triage ruling (route B) the transcriptions are deleted rather than rewritten: the generated tree, the four generated-file samples and the CLI's own dependency list are replaced with a pointer at buildPluginFiles() in packages/create-plugin/src/templates.ts, which is the single source of truth for what a scaffolded plugin contains. What survives is the invocation surface (install, name rules, where it writes, how to iterate, how to publish), plus the structural facts a reader needs and that cannot go stale on their own. No version literal is restated anywhere on the page, so doc-version-claims' KNOWN_CLAIMS needs no row deleted (it had none for this file). * docs(create-plugin): widen the parity-gate sentence to match objectstack-ai#3742 landing (objectstack-ai#3715) PR objectstack-ai#3754 (objectstack-ai#3742) landed while this branch was open and turned templates.test.ts from "the three testing ranges are sourced from the repo" into "every generated devDependency range is anchored, none unpinned". The page said "the testing ones", which was accurate at the fetch point and understated after that merge — exactly the drift this shrink exists to avoid, so the sentence now names the anchoring without naming a subset or a count. --------- Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Aug 12, 2026
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 freeto 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.
Fixes#3742
先说结论:issue 标题的那个论断不成立,但卡片要做的事成立
标题说「
@vitejs/plugin-react ^4.2.1的 peer 结构性无法被vite ^7.3.1满足 ……pnpm install必报 peer 冲突」。这一条经实测不成立,原因是把「区间」当成了「定版」来量:npm view @vitejs/plugin-react@4.2.1 peerDependencies→{ vite: '^4.2.0 || ^5.0.0' },那是区间下界那一个版本的 peer。^4.2.1实际装的是 4.x 的最高版 4.7.0,它的 peer 早已放宽:vite ^7.3.1(解析到 7.3.6)落在里面。拿改动前的模板清单做一次真实解析,并且把strict-peer-dependencies开到比本仓更严:装得干干净净。所以没有 peer 冲突要修。
但漂移是真的,而且卡片给的修法方向正确、与那个论断无关:五条 build 区间从未被锚定到任何东西,#3716 对生成产物的端到端验证只在仓内实际装的版本下跑过,声明区间从来不是被测的那一组。这个 PR 修的是漂移,不是 peer。changeset 和代码注释都按事实写,没有顺着标题写成「修了 peer 冲突」。
改了什么
1. 五条 build 区间改为从仓内锚点取值
沿用 PR #3733 给三条 test 区间定的做法(锚到仓根清单)。需要两个锚点,因为仓根并不声明全部:生成器写入
packages/plugin-插件名(相对 cwd),生成的包是packages/plugin-*的同级兄弟,所以仓根不声明的两个 build 工具就锚到这些 plugin 清单上。vite^7.3.1^8.2.0typescript^5.9.3^6.0.3vitest^4.0.18^4.1.10@vitejs/plugin-react^4.2.1^6.0.5packages/plugin-*(仓根无)vite-plugin-dts^4.5.4^5.0.3packages/plugin-*(仓根无)后两条无需在「选哪个 plugin」上做判断:全部 19 个仓内 plugin 对这两个区间完全一致,测试断言的就是这个一致性(不一致就红,并列出分歧的清单),而不是挑一个赢家。
2. parity 测试覆盖整张 devDependencies 清单
这是卡片的重点。原测试只钉三条 test 区间,旁边五条 build 区间就是因为没有任何东西钉它们才漂了 1–2 个 major。现在:
3. 生成的
vite.config.ts:__dirname→import.meta.dirnameissue 的附带观察,已核实,而且比「有警告」更严重。用 vite 8.2.0 自己的
loadConfigFromFile把生成产物的两个版本各按两种 loader 加载一遍(预测在前,四条全部命中):即在未来默认的
native下旧写法是直接加载失败,不只是告警;新写法在两种 loader 下都正常,且解析出同一个 entry。apps/console/vite.config.ts已在 #3384 因同样理由转换过,本仓engines.node: ">=22"满足import.meta.dirname。与 #3592(仓内 28 个 config 用
__dirname,标finding)不重叠:那张单子的普查是git grep -- '*vite.config.ts',扫不到本模板 —— 模板是.ts源码里的字符串字面量。这里修的是这个模式的产出源头,#3592 的存量替换不受影响。验证
反向验证(先写预测再跑,四次全部按预测方向红):
vite改^8.1.0AssertionError: vite range must match the repo root: expected '^8.1.0' to be '^8.2.0'@vitejs/plugin-react改^6.0.4AssertionError: @vitejs/plugin-react range must match packages/plugin-*: expected '^6.0.4' to be '^6.0.5'AssertionError: expected [ … 8 ] to deeply equal [ … 7 ]/+ "unanchored-newcomer"__dirnameexpected '…' to contain 'path.resolve(import.meta.dirname,'全部扰动已还原,基线 12 passed。
产物生成 smoke(#3716 的离线做法):
pnpm --filter @object-ui/create-plugin build后把构建出的生成器跑进临时目录,产出的package.jsondevDependencies 与vite.config.ts均为新值(上面第 3 节的 config 加载就是直接拿这份产物跑的)。未做产物的完整vite build。改后清单的两两 peer 一致性(非 optional peer 冲突 0 条):
再用真实解析复核(同样开
strict-peer-dependencies=true),生成产物的清单装得干净:另外
packages/plugin-grid/node_modules里实际装着 vite 8.2.0 + @vitejs/plugin-react 6.0.5 + vite-plugin-dts 5.0.3,即这一组本来就在本仓共存。范围
只动
packages/create-plugin/(templates.ts、templates.test.ts)加一个 changeset。未动content/docs/utilities/create-plugin.mdx(属 #3715),未动content/docs/releases/。越界发现另行记录,未在本 PR 修:生成的
dependencies里lucide-react: '^0.563.0',而仓内 23 处声明全部是^1.28.0;且没有任何生成的源文件 import 它。0.x 的 caret 不跨 minor 浮动(^0.563.0即>=0.563.0 <0.564.0),所以脚手架是被钉死在 0.563.x 上的。它位于dependencies而非devDependencies,不在本卡范围内。Generated by Claude Code