npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

steamer-plugin-example

v2.0.3

Published

steamer-plugin-example

Downloads

3

Readme

steamer-plugin-example

开发插件

npm i -g steamerjs

steamer develop --plugin [plugin name xxx]
// 或
steamer develop -p [plugin name xxx]
// 命令运行后,会下载 [steamer-plugin-example](https://github.com/steamerjs/steamer-plugin-example)

cd steamer-plugin-xxx

// 将你的插件链接至全局路径,就可以直接使用 `steamer example`
npm link

// 当你完成开发,可以 `unlink` 你的插件
npm unlink

steamer plugin 例子

  • 确认是否已安装steamer CLI工具,如果还未安装,请参考https://github.com/steamerjs/steamerjs

完成这个example plugin之后,可以这样使用这个插件:

steamer example -c config.js
// 或
steamer example --config config.js

如何写一个 steamerjs 插件

  • 创建一个类,继承 steamer-plugin。此插件有许多辅助方法,请此往插件文件进行查询。
class ExamplePlugin extends SteamerPlugin {
    constructor(args) {
        super(args);
        this.argv = args;
        this.pluginName = 'steamer-plugin-example';
        this.description = 'steamer plugin example';
    }

    init() {
        
    }

    help() {
        
    }
}

当在终端输入插件命令时,命令的参数将被传入这个函数

更多相关参数的文档,请参考 yargs.

  • init 函数

为类创建 init 方法, 插件命令在启动时会自动调用此函数。

init() {
        
}
// 导出此类
module.exports = ExamplePlugin;
  • help 函数

为插件创建 help 方法

help() {
        
}

当使用命令 steamer [plugin name] -h 或者 steamer [plugin name] --help 时,会自动调用 help 函数,用于输出插件帮助文档。

  • 在package.json中指定入口
"main": "index.js"