Example plugin for WinJS.
Install:
npm add winjs-plugin-example -DAdd plugin to your .winrc.ts:
// .winrc.ts
export default {
plugins: ['winjs-plugin-example'],
// 开启配置
example: {}
};Some description.
- Type:
string - Default:
undefined - Example:
export default {
plugins: ['winjs-plugin-example'],
// 开启配置
example: {
foo: 'bar'
}
};- 使用此模板创建新的 WinJS 插件项目
- 修改包名为你的插件名称
使用模板后,如果你修改了 npm 包名,需要更新以下文件中的包名引用:
修改以下字段:
name: 将winjs-plugin-template改为你的新包名repository.url: 更新为你的仓库地址
{
"name": "your-plugin-name",
"repository": {
"type": "git",
"url": "git+https://github.com/your-org/your-plugin-name.git"
}
}需要更新以下位置的包名引用:
- 文档标题(第一行)
- npm 版本徽章链接中的包名
- npm 下载量徽章链接中的包名
- 安装命令中的包名
- 使用示例中的插件名称
将所有的 winjs-plugin-example 替换为你的新包名。
如果你的项目中有其他配置文件引用了包名(如 renovate.json、CHANGELOG.md 等),也需要相应更新。
- 修改
src/index.ts中的key值(当前为example)为你的插件配置键名 - 根据插件功能完善
Options配置说明 - 更新
README.md中的插件描述和功能说明
安装依赖:
pnpm install开发模式(监听文件变化自动构建):
pnpm run dev构建项目:
pnpm run build代码格式检查:
pnpm run lint自动修复代码格式:
pnpm run lint:write运行测试:
pnpm run test本地测试插件:
在 playground 目录中测试插件功能:
cd playground
pnpm install
pnpm run dev版本号管理:
pnpm run bump- 在
src/index.ts中实现插件逻辑 - 运行
pnpm run dev监听文件变化 - 在
playground目录中运行pnpm run dev测试插件 - 运行
pnpm run lint:write确保代码格式正确 - 运行
pnpm run test确保测试通过 - 提交代码前运行
pnpm run build确保构建成功
MIT.