Skip to content

create-plugin.mdx 描述的是一个不存在的脚手架:提示词、产物目录、dev 脚本、配置文件、版本与依赖清单全部与真实生成器不符 #3715

Description

@yinlianghui

#3709 的修复过程中量到的。#3709 只覆盖该页 ### package.json 那一个代码块(门禁 ledger 记的三行),本单是同一页其余部分的同类失真 —— 范围更大、且同样属于「读者照做会坏」。

真相锚:packages/create-plugin/src/index.ts(全文 396 行)与 packages/create-plugin/package.json

逐条实测

页面位置 文档写的 生成器实际 依据
Quick Start「This will:」 Install dependenciesInitialize a git repository 两件都不做,只在末尾打印 Next steps: cd ... / pnpm install / pnpm build index.ts:370-376,全文无 git 调用、无安装调用
Interactive Prompts 6 问(name / Description / Author / Component name / Component type / License) 3 问(name / description / author) index.ts:28-44、79-92
Generated Structure 产物在 cwd 的 my-awesome-plugin/ 产物在 packages/plugin-NAME/ index.ts:94 path.join(process.cwd(), 'packages', fullPackageName)
Generated Structure src/AwesomeComponent.tsx、有 .gitignore 实为 src/PascalImpl.tsx,不写 .gitignore,另有文档没列的 src/PascalImpl.test.tsx index.ts:291-345
§2 Start Development npm run dev,「starts Vite in dev mode with HMR」 生成的 scripts 只有 build / test / lint,没有 dev —— 照做得到 "Missing script: dev";vite.config 写的是 build.lib(库构建),本就没有 dev server index.ts:136-140、173-198
Configuration Options 支持 .create-plugin.config.js 自定义模板 全文不读任何配置文件,template / defaults / prompts 三个选项都不存在 index.ts 全文;CLI 只有 -d / -a 两个 option(:385-390)
Package Information Version: 0.3.1 packages/create-plugin/package.json 的 version 是 17.3.0 该清单
Dependencies InquirerOra 实为 commander + prompts,没有 Ora 该清单的 dependencies:chalk / commander / fs-extra / prompts
Generated Files 三个代码样例 src/index.tsx 注册 awesome-componentAwesomeComponent.tsxReact.lazytypes.ts 定义 AwesomeComponentSchema 生成的三个文件形状都不同(注册的是 cleanName、Impl 不用 lazy、types.ts 只有一个 Schema interface) index.ts:259-345

为什么单独立

#3709 的完成范围由它的正文、门禁 ledger 的三条记录和派发裁决共同框定在 manifest 那一个块(裁决明确写 truth = index.ts:143-153,即 dependencies / peerDependencies 两段)。上表全部落在那个窗口之外,没有一条能被那道版本门禁看见(它们大多不含版本字面量),所以修 #3709 不会顺带修掉它们,也不该在同一个 PR 里越界修。

严重度按「照做会坏」排:npm run dev(§2,直接报错)与 .create-plugin.config.js(整节虚构)最重,产物目录写错次之,Version / Dependencies 属陈旧。

一个必须先拍板的问题

这一页有两种改法,取舍不该由实现者自己定:

倾向 B,理由与 #3645 仓规同源:这一页的每一处失真都是「把生成器的输出抄进散文」造成的,重写只是把同一台机器重新上膛;而 create-plugin 的输出读者跑一次就能看到,不像 peer 区间那样需要文档代答。若选 A,应同时加一道把文档钉到生成器的测试(形状可照 scripts/__tests__/ci-cd-pipeline-doc.test.ts),否则一年后会回到今天这个状态。

已搜重

create-plugin scaffold docscreate-plugin generator template 两组关键字搜过开放 issue,除 #3708 / #3709 / #3710 本身外无命中。


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions