{"id":20226213,"url":"https://github.com/steamerjs/steamer-plugin-example","last_synced_at":"2026-06-04T02:31:28.901Z","repository":{"id":57370610,"uuid":"75861805","full_name":"steamerjs/steamer-plugin-example","owner":"steamerjs","description":"example plugin","archived":false,"fork":false,"pushed_at":"2018-05-02T16:39:33.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T08:04:35.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steamerjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-07T17:57:56.000Z","updated_at":"2018-05-02T16:39:11.000Z","dependencies_parsed_at":"2022-08-29T18:30:56.978Z","dependency_job_id":null,"html_url":"https://github.com/steamerjs/steamer-plugin-example","commit_stats":null,"previous_names":["steamerteam/steamer-plugin-example"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steamerjs","download_url":"https://codeload.github.com/steamerjs/steamer-plugin-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670132,"owners_count":20000326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T07:16:47.821Z","updated_at":"2026-06-04T02:31:28.861Z","avatar_url":"https://github.com/steamerjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# steamer-plugin-example\n\n## 开发插件\n\n```javascript\nnpm i -g steamerjs\n\nsteamer develop --plugin [plugin name xxx]\n// 或\nsteamer develop -p [plugin name xxx]\n// 命令运行后，会下载 [steamer-plugin-example](https://github.com/steamerjs/steamer-plugin-example)\n\ncd steamer-plugin-xxx\n\n// 将你的插件链接至全局路径，就可以直接使用 `steamer example`\nnpm link\n\n// 当你完成开发，可以 `unlink` 你的插件\nnpm unlink\n\n```\n\n## steamer plugin 例子\n\n* 确认是否已安装steamer CLI工具，如果还未安装，请参考https://github.com/steamerjs/steamerjs\n\n完成这个example plugin之后，可以这样使用这个插件：\n\n```javascript\nsteamer example -c config.js\n// 或\nsteamer example --config config.js\n```\n\n\n## 如何写一个 steamerjs 插件\n\n* 创建一个类，继承 [`steamer-plugin`](https://github.com/SteamerTeam/steamer-plugin)。此插件有许多辅助方法，请此往插件文件进行查询。\n\n```javascript\nclass ExamplePlugin extends SteamerPlugin {\n    constructor(args) {\n        super(args);\n        this.argv = args;\n        this.pluginName = 'steamer-plugin-example';\n        this.description = 'steamer plugin example';\n    }\n\n    init() {\n        \n    }\n\n    help() {\n        \n    }\n}\n```\n当在终端输入插件命令时，命令的参数将被传入这个函数\n\n更多相关参数的文档，请参考 [yargs](https://github.com/yargs/yargs).\n\n* `init` 函数\n\n为类创建 `init` 方法， 插件命令在启动时会自动调用此函数。\n\n```javascript\ninit() {\n        \n}\n```\n\n```javascript\n// 导出此类\nmodule.exports = ExamplePlugin;\n```\n\n\n* `help` 函数\n\n为插件创建 `help` 方法\n\n```javascript\nhelp() {\n        \n}\n```\n\n当使用命令 `steamer [plugin name] -h` 或者 `steamer [plugin name] --help` 时，会自动调用 `help` 函数，用于输出插件帮助文档。\n\n* 在package.json中指定入口\n\n```javascript\n\"main\": \"index.js\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-example/lists"}