Files
heroui-vue/tests/package/README.md
T

20 lines
1.7 KiB
Markdown
Raw 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.
# 独立打包消费用例
`consume-slider.mjs` 和 `slider-contract.ts` 应复制到工作区之外的全新 Vue 工程运行,依赖安装使用 `pnpm pack` 生成的两个 tarball,不设置指向源码的 paths/alias。private 样式包通过 pnpm overrides 指向本地样式 tarball。
库构建与打包后,在消费工程执行:
```sh
node consume-slider.mjs
pnpm exec tsc --noEmit --strict --skipLibCheck --module nodenext --moduleResolution nodenext --target es2022 slider-contract.ts
pnpm exec tsc --noEmit --strict --skipLibCheck --module esnext --moduleResolution bundler --target es2022 slider-contract.ts
```
`@ts-expect-error` 必须实际生效;出现 unused 指令是失败,不得删除反例。数字字段的 validate 参数也必须保留推断类型。`skipLibCheck` 只略过依赖内部诊断,不略过这些消费端反例。
SLIDER-01 已在 `/private/tmp/heroui-slider-consumer` 完成上述检查,临时契约文件名为 `contract.ts`。默认工作区 typecheck 仍使用源码 alias,所以不能代替此独立产物检查。
M30–M32 增加 consume-m30-m32.mjs 和 m30-m32-contract.ts。将它们复制到同一个独立消费工程,执行运行脚本,并将契约文件加入上述两种 tsc 命令。合并后的产物还应同时通过原 NumberField/Slider 消费检查,避免只验证新加组件。
LISTBOX-01 增加 `consume-list-box.mjs` / `list-box-contract.ts`。同样复制到独立消费者,用两份新 tarball 安装后运行脚本,并在 NodeNext / bundler 两种模式执行契约文件。Root 的泛型 Props 曾在 Parameters 提取后退化,非法模型/模式反例与事件参数推断必须保留。