File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,15 @@ $ npm run build
2020
2121## 从零生成此项目 (可选)
2222
23- 可选阅读,仅推荐有需要自定义插件模板的查看 (如需要开发有 Vue/React 等依赖的插件模板)
23+ > [ !note]
24+ > 可选阅读
25+ >
26+ > 如果你使用 js 来编写则不需要这些,直接仿照官方的 js 示例插件来编写就可以了
27+ >
28+ > 若使用模板,一般来说你只要根据模板创建你的项目即可 (即在 github repo 页面直接按右上角的根据模板创建),
29+ > 也不需要阅读此章
30+ >
31+ > 仅推荐想要了解模板细节、有需要自定义插件模板的开发者查看此节 (如需要开发其他框架依赖的插件模板)
2432
2533(1) git 环境 (可选)
2634
@@ -82,6 +90,10 @@ Is this OK? (yes)
8290
8391$ npm install -D typescript vite
8492
93+ # 为 any-menu 插件提供类型,对应 any-menu/any-menu 项目的 src/Type/
94+ # 当然,
95+ $ npm install -D any-menu
96+
8597# 替换 package.json 的 scripts (使用 vite 和 typescript)
8698# 添加 tsconfig.json
8799# 添加 vite.config.js
@@ -91,14 +103,6 @@ $ npm install -D typescript vite
91103
92104``` bash
93105# 然后是文件准备
94-
95- # (1) typescript 类型
96- # 复制 any-menu/any-menu 项目的 src/Core/PluginInterface.ts 接口到 /types/any-menu.d.ts
97- # 或复制该项目的 /types/any-menu.d.ts
98- # 或等待后期这一步会转而使用 npm 类型依赖包来实现
99- #
100- # 当然,如果你使用 js 来编写则不需要这一步,直接仿照官方的 js 示例插件来编写就可以了
101-
102- # (2) 创建和编写 src/ 文件夹内的内容 (主要程序代码和样式文件)
106+ # 创建和编写 `src/` 文件夹内的内容 (主要程序代码和样式文件)
103107# 特殊:这里使用的特殊的方式将 css 文件转为字符串附加到 js 上,这样能方便你更好地利用代码着色功能编辑 js 文件
104108```
Original file line number Diff line number Diff line change 1717 "typecheck" : " tsc --noEmit"
1818 },
1919 "devDependencies" : {
20+ "any-menu" : " ^1.0.0" ,
2021 "typescript" : " ^5.9.3" ,
2122 "vite" : " ^8.0.1"
2223 }
Original file line number Diff line number Diff line change 1313// 功能: 可以将 CSS 内联到 JS 中,插件只需分发单个 .js 文件
1414import cssText from './style.css?inline' ;
1515
16- import type { PluginInterface , PluginInterfaceCtx } from '../types/ any-menu' ;
16+ import type { PluginInterface , PluginInterfaceCtx } from 'any-menu' ;
1717
1818let cache_ctx : PluginInterfaceCtx | undefined
1919
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments