-
Notifications
You must be signed in to change notification settings - Fork 54
Development
A Wechaty Puppet is a node package published on NPM that follow a defined convention.
related tutorial: How to implement a wechaty-puppet
The package.json
is a manifest format for describing Node.js modules. Wechaty Puppets are built on top of Node modules. It declares dependencies, version, ownership, and other information required to run a plugin in Wechaty. This document describes the schema in detail.
A plugin manifest package.json
can also contain details about the required configuration. The configuration schema is defined in the wechaty
field of the package.json
(This field follow the JSON-Schema guidelines):
{
"name": "wechaty-puppet-mytest",
"version": "0.0.1",
"description": "This is my first Wechaty Puppet",
"engines": {
"wechaty": ">=0.16.x"
},
"wechaty": {
"properties": {
"myConfigKey": {
"type": "string",
"default": "it's the default value",
"description": "It defines my awesome config!"
}
}
}
}
You can learn more about package.json
from the NPM documentation.
The package name must begin with wechaty-puppet-
and the package engines should contain wechaty
.
The mod.ts
is the main entry point of your puppet implementation:
import { Puppet } from 'wechaty'
export class PuppetMyTest extends Puppet {
// ... implenmentation here ...
}
export default PuppetMyTest
Wechaty Puppet can be published on NPM.
To publish a new Puppet, you need to create an account on npmjs.com then publish it from the command line:
npm publish