3.3.13 • Published 4 months ago

create-cle-plugin v3.3.13

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

编程语言

  • Node.js

快速开始

创建项目

npm create cle-plugins hello

这条命令会在当前目录下创建一个 cle-plugin-hello 目录。进入项目目录并安装开发需要的依赖包。

cd cle-plugin-hello
npm i

编译及打包

npm run build
npm run pack

执行上述命令后,会生成一个 cle-plugin-hello-3.0.0.cp 文件。

安装插件

cle plugins i release/cle-plugin-hello-3.0.0.cp

执行测试命令

cle plugins test cle-plugin-hello

项目结构

.
├── src
│   ├── lib
│   ├── config.ts
│   ├── i18n.ts
│   ├── index.ts
│   └── status.ts
├── doc.md
├── package.json
├── tsconfig.json
└── webpack.config.js

index.ts

插件入口。需要导出 inittestconfigi18n, status 5 个属性。可选导出 initHttp, docs 属性。

属性类型说明
initfunction初始化函数。CLE 运行时会调用此函数。
testfunction测试函数。运行 cle plugins test 命令时调用此函数。
configobject配置模板。建议只在 config.ts 中修改。
i18nobject多语言支持。建议只在 i18n.ts 中修改。
initHttpfunction初始化函数。CLE 初始化 HTTP 服务时会调用此函数。
docsobject文档。建议只在 doc.md 中修改。

config.ts

配置模板。需要导出 descriptionfields 2 个属性。

属性类型说明
descriptionstring会在 Dashboard 插件配置页面显示。
fieldsArray配置属性。

可以在 inittest 函数中读取配置。例:

export async function test(self: Plugin, utils: Utils) {
  const config = await utils.loadConfig(self);
  console.log(config);
}

i18n.ts

多语言支持。

status.ts

状态显示。

3.3.13

4 months ago

3.3.12

4 months ago

3.3.10

4 months ago

3.3.11

4 months ago

3.3.9

4 months ago

3.3.5

5 months ago

3.3.4

5 months ago

3.3.8

5 months ago

3.3.7

5 months ago

3.3.6

5 months ago

3.3.3

5 months ago

3.3.1

5 months ago

3.3.0

5 months ago

3.3.2

5 months ago

3.2.2

6 months ago

3.2.1

6 months ago

3.2.0

6 months ago

3.1.0

7 months ago

3.0.0

8 months ago

1.0.1

1 year ago

1.0.0

1 year ago