Skip to content

Commit

Permalink
feat: update vite-plugin-utools
Browse files Browse the repository at this point in the history
  • Loading branch information
QC2168 committed Dec 11, 2024
1 parent b282d47 commit 21f6940
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 31 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

## ✨ 特性

- 🌈 开箱即用的`Vite+Vue3``Utools`插件开发模板
- 🌈 开箱即用的`Vite+Vue3+TS``Utools`插件开发模板
- ⚡ 开发环境自动注入`HMR`字段
- 🦍 自动构建`upx`
- 🧸 构建`utools/preload`文件,自动处理插件第三方依赖(依赖脚本位于`script/build.js`
- 🚀 构建桌面应用(`electron`
- 🚀 构建桌面应用(`electron` 不需要可移除

## 🥩 开始使用

Expand Down Expand Up @@ -49,9 +49,10 @@ pnpm build
> 原理:通过读取提供的`preload.js`文件,获取所需的依赖包后,在插件打包目录下执行`npm install`实现依赖安装
```js
const install = require("@qc2168/vite-plugin-utools").install
import { install } from '@qc2168/vite-plugin-utools';
// 添加编译后的preload文件
install(['./dist/preload.js', './dist/preload2.js'])
install(['./dist/preload.js']);

```

### 如何启动插件
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"preview": "vite preview"
},
"dependencies": {
"@qc2168/vite-plugin-utools": "^1.5.1",
"@qc2168/vite-plugin-utools": "^1.6.0",
"vue": "^3.5.13"
},
"devDependencies": {
Expand Down
20 changes: 0 additions & 20 deletions plugin.json

This file was deleted.

35 changes: 35 additions & 0 deletions plugin.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
// 下列属性为插件必需属性,了解更多属性请往前 官方文档-完整配置篇
// https://www.u.tools/docs/developer/config.html
// 插件图标路径
logo: "logo.png",
// 预加载脚本
preload: "preload.js",
// 插件入口页面
main: "index.html",
// 插件ID
name: "your plugin ID",
// 版本号
version: "1.0.0",
// 显示名称
pluginName: "template",
// 描述
description: "plugin template",
// 作者
author: "QC2168",
// 主页
homepage: "https://github.com/QC2168",
// 功能列表
features: [
{
// 功能代码
code: "template",
// 功能说明
explain: "插件模板主界面",
// 触发命令
cmds: [
"template"
]
}
]
}
7 changes: 1 addition & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ export default defineConfig(({ command, mode }) => {
mode: isBuild ? BuildMode.ExcludeDependencies : BuildMode.IncludeDependencies
}
],
hmr: {
pluginJsonPath: './plugin.json'
},
upx: {
pluginJsonPath: './plugin.json',
}
hmr: true,
}),
isStartElectron && electron([
{
Expand Down

0 comments on commit 21f6940

Please sign in to comment.