Skip to content

Commit ff35840

Browse files
committed
feat: 更新项目名称和版本,添加 Ant Design Vue 支持
1 parent 042f016 commit ff35840

7 files changed

Lines changed: 9115 additions & 70 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,14 @@ jobs:
8888
8989
- name: 生成变更日志
9090
id: changelog
91-
run: |
92-
# 获取上一个标签
93-
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
94-
95-
if [ -z "$PREV_TAG" ]; then
96-
# 如果没有上一个标签,获取所有提交
97-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
98-
else
99-
# 获取两个标签之间的提交
100-
CHANGELOG=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
101-
fi
102-
103-
# 保存到文件以避免特殊字符问题
104-
echo "$CHANGELOG" > changelog.txt
105-
echo "changelog_file=changelog.txt" >> $GITHUB_OUTPUT
91+
run: npx changelogithub
92+
continue-on-error: true
93+
env:
94+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
10695

10796
- name: 发布到 npm
10897
run: pnpm publish --no-git-checks
109-
env:
110-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
98+
11199

112100
- name: 创建 GitHub Release
113101
uses: actions/create-release@v1
@@ -125,4 +113,4 @@ jobs:
125113
echo "🎉 发布成功!"
126114
echo "📦 版本: ${{ steps.get_version.outputs.version }}"
127115
echo "🏷️ 标签: ${{ steps.get_version.outputs.tag_name }}"
128-
echo "📝 npm: https://www.npmjs.com/package/winjs-plugin-template"
116+
echo "📝 npm: https://www.npmjs.com/package/@winner-fed/plugin-antdv"

README.md

Lines changed: 88 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,111 @@
1-
# winjs-plugin-example
1+
# winjs-plugin-antdv
22

3-
Example plugin for WinJS.
3+
适配 WinJS 的 Ant Design Vue 插件,提供 Ant Design Vue 组件库的自动导入和样式配置。
44

55
<p>
6-
<a href="https://npmjs.com/package/winjs-plugin-example">
7-
<img src="https://img.shields.io/npm/v/winjs-plugin-example?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
6+
<a href="https://npmjs.com/package/@winner-fed/plugin-antdv">
7+
<img src="https://img.shields.io/npm/v/@winner-fed/plugin-antdv?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
88
</a>
99
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
10-
<a href="https://npmcharts.com/compare/winjs-plugin-example?minimal=true"><img src="https://img.shields.io/npm/dm/winjs-plugin-example.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
10+
<a href="https://npmcharts.com/compare/@winner-fed/plugin-antdv?minimal=true"><img src="https://img.shields.io/npm/dm/@winner-fed/plugin-antdv.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
1111
</p>
1212

13-
## Usage
13+
## 功能特性
1414

15-
Install:
15+
- 🚀 **自动导入组件** - 无需手动导入,直接使用 Ant Design Vue 组件
16+
- 🎨 **自动导入样式** - 自动处理样式文件的导入
17+
- 📦 **版本兼容** - 支持 Ant Design Vue 1.x 和 4.x 版本
18+
- 🔧 **智能检测** - 自动检测项目中的依赖版本
19+
-**按需加载** - 只导入使用的组件,减小打包体积
20+
21+
## 安装
1622

1723
```bash
18-
npm add winjs-plugin-example -D
24+
npm install @winner-fed/plugin-antdv
1925
```
2026

21-
Add plugin to your `.winrc.ts`:
27+
## 配置
28+
29+
在 WinJS 项目中启用插件:
2230

23-
```ts
24-
// .winrc.ts
25-
export default {
26-
plugins: ['winjs-plugin-example'],
27-
// 开启配置
28-
example: {}
29-
};
31+
```typescript
32+
// win.config.ts
33+
import { defineConfig } from '@winner-fed/winjs';
34+
35+
export default defineConfig({
36+
plugins: [
37+
'@winner-fed/plugin-antdv'
38+
],
39+
// 可选:插件配置
40+
antdv: {
41+
// 插件配置选项
42+
}
43+
});
3044
```
3145

32-
## Options
46+
## 使用示例
3347

34-
### foo
48+
### 基本使用
3549

36-
Some description.
50+
安装并配置插件后,可以在 Vue 组件中直接使用 Ant Design Vue 组件:
3751

38-
- Type: `string`
39-
- Default: `undefined`
40-
- Example:
52+
```vue
53+
<template>
54+
<div>
55+
<a-button type="primary">主要按钮</a-button>
56+
<a-button>默认按钮</a-button>
57+
<a-divider />
58+
<a-input placeholder="请输入内容" />
59+
<a-space>
60+
<a-tag color="blue">标签</a-tag>
61+
<a-tag color="green">标签</a-tag>
62+
</a-space>
63+
</div>
64+
</template>
4165
42-
```js
43-
export default {
44-
plugins: ['winjs-plugin-example'],
45-
// 开启配置
46-
example: {
47-
foo: 'bar'
48-
}
49-
};
66+
<script setup lang="ts">
67+
// 无需手动导入组件,插件会自动处理
68+
// import { Button, Input, Tag } from 'ant-design-vue';
69+
</script>
5070
```
5171

52-
## License
72+
### 支持的组件
73+
74+
插件支持所有 Ant Design Vue 组件,包括但不限于:
75+
76+
- **通用组件**:Button、Icon、Typography
77+
- **布局组件**:Divider、Grid、Layout、Space
78+
- **导航组件**:Affix、Breadcrumb、Dropdown、Menu、Pagination、Steps
79+
- **数据录入**:AutoComplete、Cascader、Checkbox、DatePicker、Form、Input、InputNumber、Mentions、Radio、Rate、Select、Slider、Switch、TimePicker、Transfer、TreeSelect、Upload
80+
- **数据展示**:Avatar、Badge、Calendar、Card、Carousel、Collapse、Comment、Descriptions、Empty、Image、List、Popover、Statistic、Table、Tabs、Tag、Timeline、Tooltip、Tree
81+
- **反馈组件**:Alert、Drawer、Message、Modal、Notification、Popconfirm、Progress、Result、Skeleton、Spin
82+
- **其他组件**:Anchor、BackTop、ConfigProvider、LocaleProvider
83+
84+
## 依赖要求
85+
86+
- `ant-design-vue`: ^4.0.0
87+
- `vue`: ^3.0.0
88+
89+
## 版本兼容性
90+
91+
| 插件版本 | Ant Design Vue 版本 | Vue 版本 |
92+
|---------|-------------------|----------|
93+
| ^1.0.0 | ^4.0.0 | ^3.0.0 |
94+
| ^1.0.0 | ^1.x | ^2.0.0 |
95+
96+
## 工作原理
97+
98+
1. **依赖检测**:插件会自动检测项目中的 `ant-design-vue` 依赖
99+
2. **版本判断**:根据检测到的版本自动配置不同的导入策略
100+
3. **解析器配置**:集成 `unplugin-vue-components``AntDesignVueResolver`
101+
4. **自动导入**:在构建时自动添加组件导入语句和样式导入
102+
103+
## 注意事项
104+
105+
- 确保项目中已安装 `ant-design-vue` 依赖
106+
- 插件会自动处理样式导入,无需手动导入样式文件
107+
- 支持 TypeScript,提供完整的类型支持
108+
109+
## 许可证
53110

54111
[MIT](./LICENSE).

package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
{
2-
"name": "winjs-plugin-template",
2+
"name": "@winner-fed/plugin-antdv",
33
"keywords": [
44
"winjs",
55
"plugin",
6-
"template",
6+
"vue",
7+
"antd",
8+
"ant-design-vue",
9+
"components",
10+
"auto-import",
11+
"ui-library",
12+
"resolver",
713
"winner-fed",
814
"winjs-dev",
915
"rslib",
1016
"rsbuild",
11-
"typescript",
12-
"biome"
17+
"typescript"
1318
],
14-
"version": "0.0.0",
19+
"version": "1.0.0",
1520
"repository": {
1621
"type": "git",
17-
"url": "git+https://github.com/winjs-dev/winjs-plugin-template.git"
22+
"url": "git+https://github.com/winjs-dev/winjs-plugin-antdv.git"
1823
},
1924
"license": "MIT",
2025
"type": "module",
@@ -52,13 +57,16 @@
5257
"@winner-fed/winjs": "*",
5358
"playwright": "^1.53.2",
5459
"simple-git-hooks": "^2.13.0",
55-
"typescript": "^5.8.3"
60+
"typescript": "^5.8.3",
61+
"unplugin-vue-components": "28.4.1"
5662
},
5763
"peerDevDependencies": {
58-
"@winner-fed/winjs": "*"
64+
"@winner-fed/winjs": "*",
65+
"unplugin-vue-components": "28.4.1"
5966
},
6067
"peerDependencies": {
61-
"@winner-fed/utils": "*"
68+
"@winner-fed/utils": "*",
69+
"ant-design-vue": "^4.0.0"
6270
},
6371
"peerDependenciesMeta": {
6472
"@rsbuild/core": {

playground/.winrc.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@ import { defineConfig } from 'win';
22

33
export default defineConfig({
44
plugins: ['../src'],
5-
example: {
6-
foo: 'bar',
7-
},
5+
antdv: {},
86
});

playground/src/pages/index.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44
<p>
55
<img src="@/assets/img/logo.png" width="200" height="200" alt="logo" />
66
</p>
7+
<p><a-button type="primary">我是 ant-design-vue 的 Button</a-button></p>
8+
<p>
9+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
10+
probare, quae sunt a te dicta? Refert tamen, quo modo.
11+
</p>
12+
<a-divider />
13+
<p>
14+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista
15+
probare, quae sunt a te dicta? Refert tamen, quo modo.
16+
</p>
17+
<a-divider>With Text</a-divider>
718
<p>To get started, edit <code>pages/index.vue</code> and save to reload.</p>
819
</div>
920
</template>
21+
<script setup lang="ts">
22+
</script>

0 commit comments

Comments
 (0)