Skip to content

any-menu/example-plugin-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnyMenu Plugin Simple

这是 AnyMenu 的插件开发模板

编译

$ npm install
$ npm run build
# 然后会将编译结果生成到 dist 目录下

使用

模板使用

在 Github 仓库中,右上角选择 Use this template > Create a new repository,即可使用模板创建你的仓库

不推荐直接 clone 或 fork,这将会保留模板中的历史记录

插件使用

同普通的 AnyMenu 插件

将编译好的结果放置于 AnyMenu 的插件目录下,然后 AnyMenu 中刷新本地插件列表即可看到刚刚添加的新插件

将新插件开启后即可 (当前版本可能需要重启下插件/软件才可)

工作流使用

内置了 Github 工作流,帮你简化操作

  • commit 到 github 中会自动完成编译,帮你进行代码错误检查
  • 如果 commit 中添加了版本标签 (不需要 v 开头),会自动帮你 Release
    • 如果版本标签以 -beta 结尾,将会自动发布一个非 Latest 的 Pre Release

从零生成此项目 (可选)

Note

可选阅读

如果你使用 js 来编写则不需要这些,直接仿照官方的 js 示例插件来编写就可以了

若使用模板,一般来说你只要根据模板创建你的项目即可 (即在 github repo 页面直接按右上角的根据模板创建), 也不需要阅读此章

仅推荐想要了解模板细节、有需要自定义插件模板的开发者查看此节 (如需要开发其他框架依赖的插件模板)

(1) git 环境 (可选)

$ git init
# 并创建和修改 .gitignore

(2) npm 环境

$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (anymenu-plugin-simple)
version: (1.0.0)
description: AnyMenu simple plugin example
entry point: (index.js)
test command:
git repository:
keywords: anymenu
author:
license: (ISC) MIT
type: (commonjs) module
About to write to H:\Git\Private\Group_AnyMenu\anymenu-plugin-simple\package.json:

{
  "name": "anymenu-plugin-simple",
  "version": "1.0.0",
  "description": "AnyMenu simple plugin example",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "anymenu"
  ],
  "author": "",
  "license": "MIT",
  "type": "module"
}


Is this OK? (yes)

(3) typescript 和 vite 环境

# 可参考当前项目的 package.json

$ npm install -D typescript vite

# 为 any-menu 插件提供类型,对应 any-menu/any-menu 项目的 src/Type/
# 当然,
$ npm install -D any-menu

# 替换 package.json 的 scripts (使用 vite 和 typescript)
# 添加 tsconfig.json
# 添加 vite.config.js

(4) 程序文件

# 然后是文件准备

# 创建和编写 `src/` 文件夹内的内容 (主要程序代码和样式文件)
# 特殊:这里使用的特殊的方式将 css 文件转为字符串附加到 js 上,这样能方便你更好地利用代码着色功能编辑 js 文件

# 编写 .github/workflows 中的工作流 (可选)

About

A minimal AnyMenu plugin template.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors