Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use this template to create your own WinJS plugin 🌟

License

NotificationsYou must be signed in to change notification settings

winjs-dev/winjs-plugin-template

 
 

Repository files navigation

Example plugin for WinJS.

npm versionlicensedownloads

Usage

Install:

npm add winjs-plugin-example -D

Add plugin to your.winrc.ts:

// .winrc.tsexportdefault{plugins:['winjs-plugin-example'],// 开启配置example:{}};

Options

foo

Some description.

  • Type:string
  • Default:undefined
  • Example:
exportdefault{plugins:['winjs-plugin-example'],// 开启配置example:{foo:'bar'}};

开发指南

使用模板创建插件

  1. 使用此模板创建新的 WinJS 插件项目
  2. 修改包名为你的插件名称

修改包名后需要调整的文件

使用模板后,如果你修改了 npm 包名,需要更新以下文件中的包名引用:

1.package.json

修改以下字段:

  • name: 将winjs-plugin-template 改为你的新包名
  • repository.url: 更新为你的仓库地址
{"name":"your-plugin-name","repository": {"type":"git","url":"git+https://github.com/your-org/your-plugin-name.git"  }}

2.README.md

需要更新以下位置的包名引用:

  • 文档标题(第一行)
  • npm 版本徽章链接中的包名
  • npm 下载量徽章链接中的包名
  • 安装命令中的包名
  • 使用示例中的插件名称

将所有的winjs-plugin-example 替换为你的新包名。

3. 其他配置文件(可选)

如果你的项目中有其他配置文件引用了包名(如renovate.jsonCHANGELOG.md 等),也需要相应更新。

开发建议

1. 代码修改

  • 修改src/index.ts 中的key 值(当前为example)为你的插件配置键名
  • 根据插件功能完善Options 配置说明
  • 更新README.md 中的插件描述和功能说明

2. 开发指令

安装依赖:

pnpm install

开发模式(监听文件变化自动构建):

pnpm run dev

构建项目:

pnpm run build

代码格式检查:

pnpm run lint

自动修复代码格式:

pnpm run lint:write

运行测试:

pnpm runtest

本地测试插件:

playground 目录中测试插件功能:

cd playgroundpnpm installpnpm run dev

版本号管理:

pnpm run bump

3. 开发流程

  1. src/index.ts 中实现插件逻辑
  2. 运行pnpm run dev 监听文件变化
  3. playground 目录中运行pnpm run dev 测试插件
  4. 运行pnpm run lint:write 确保代码格式正确
  5. 运行pnpm run test 确保测试通过
  6. 提交代码前运行pnpm run build 确保构建成功

License

MIT.

About

Use this template to create your own WinJS plugin 🌟

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript92.0%
  • Vue7.6%
  • JavaScript0.4%

[8]ページ先頭

©2009-2025 Movatter.jp