my-lib-port v0.0.5
快速开始
vue-components-lib-seed 介绍
帮助你快速创建组件库。
- :rocket: 使用
Vite开发 - :airplane: 使用
esbuild构建 - :helicopter: 用
ts-morph生成类型
文档
特点
- :rainbow: 快速开发和构建
- :fireworks: 自定义友好
- :pencil: 更漂亮的文档,支持
中文和英文。 受益于vueuse,支持暗黑模式。 - :lollipop: 丰富的脚本,灵感来自 esbuild-plugin-vue & vue-dts-gen
- :yum: 类型友好
- :truck:
ESM和CJS产品
怎样使用
检查项
- Replace all
my-lib-portwords with your libary name. Just searchmy-lib-portand replace them in VScode.gitignorepackage.jsonvite.config.ts.vitepressscripts...
安装
yarn开发模式
Benefited from
vite-plugin-pages, thesrc/pages/index.vueis the entry page for development. You can visit/[component-name]/demoto check component, likehttp://localhost:3000/#/button/demo.
yarn dev构建
yarn build测试
yarn test生成入口文件
入口文件是 rollup 的
input选项。
yarn gen-entry生成一个新的组件
您必须为此命令指定组件名称。
yarn gen [component\'s name]生成 d.ts 文件
npx esno ./scripts/gen-dts.ts发布你的组件库
This command will add git tag、generate changelog. You can test your lib with argument
--dry
yarn release [--dry]文档的构建
:exclamation: Noted: you should run
yarn build:libbefore run this command. Because the docs need the build bundle.
开发文档
yarn docs:dev构建文档
yarn docs:build部署文档
vuecompoent-seed 提供了一个 github action。 当你将代码推送到 master 分支时,文档会自动部署在 gh-pages 分支上。然后你可以把 gh-pages 分支设置为 Github Pages 的来源。
在文档中使用组件 demo
以 button 组件为例。
在 button.md 文件中, 插入如下代码:
:::demo
src/packages/button/demo/demo0.vue
:::
- or
:::demo
src/packages/button/demo/demo*.vue
:::vuecomponent-sedd 提供了一个全局组件 Demos 用来展示所有的组件示例。
这也是当前展示组件实例的唯一方式。 了解更多.
自定义文档样式
你可以在 markdown 文件的 frontmatter 新增 class 字段, 全局组件 <Content> 将会继承你定义的 class。 当然, unocss 也能在这里使用。
---
class: 'custom-class'
---推荐编辑器配置
如果你使用 <script setup>
<script setup> is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use Volar instead of Vetur (and disable Vetur).
此项目离不开以下开源项目
特别感谢
| eeeeelle :writing_hand: 发布脚本 |
|---|