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-pluginutils

v1.3.0

Published

steamer plugin utils

Downloads

19

Readme

steamer-pluginutils

NPM Version Travis Deps Coverage

steamerjs 便于开发 pluginutil 函数

接口

属性

  • pluginName

    • String
    • 默认值: ""
    • 注册 plugin
  • config

    • Object
    • 默认值: null,
    • 配置值
  • isWindows

    • Boolean
    • 是否window系统
  • globalHome

    • String
    • 通常用作全局配置存放的位置,是 os.homedir() 的一层包装
  • globalNodeModules

    • String
    • 全局 npm 模块包位置, 是 process.env.NODE_PATH 的一层包装

配置函数

  • addRequirePath

    • Function
    • 添加模块搜索路径
    • 参数
    • requirePath, String, 新的模块搜索路径
    • targetPath, String, 添加新模块搜索路径的目标, 默认值: require.main.paths
  • createConfig

    • Function
    • 创建配置
    • 参数
      • config, config object, 默认值为: {}
      • option, 其它配置项目
        • isGlobal,Boolean, 是否放于全局
        • folder, String, .steamer 的父目录,
        • filename, String, 具体的文件名
        • extension, String, 文件名后缀,默认值:js
        • overwrite, Boolean, 是否覆盖已经存在的配置文件
  • readConfig

    • Function
    • 读取配置, 采用配置继承的方式,本地配置继承全局配置
    • 参数
      • option, 其它配置项目
        • folder, String, .steamer 的父目录,
        • filename, String, 具体的文件名
        • extension, String, 文件名后缀,默认值:js
  • readSteamerConfig

    • Function
    • read steamerjs global or local config
    • Parameters
      • isGlobal, is the config global or local, default: false
    • Return
      • config, config object
  • readSteamerLocalConfig

    • Function
    • read steamerjs local config
    • Return
      • config, local config object
  • readSteamerGlobalConfig

    • Function
    • read steamerjs global config
    • Return
      • config, global config object
  • createSteamerConfig

    • Function
    • read steamerjs global or local config
    • Parameters
      • isGlobal, is the config global or local, default: false
      • overwrite, Boolean, 是否覆盖已经存在的配置文件
    • Return
      • config, config object

命令输出

  • error

    • Function
    • 将文本以红色输出
  • info

    • Function
    • 将文本以蓝色输出
  • warn

    • Function
    • 将文本以黄色输出
  • success

    • Function
    • 将文本以绿色输出
  • printTitle

    • Function
    • 输出命令标题
    • Parameters
      • str, 标题
      • color, 颜色
// 例子
================================ Command Usage ================================
  • printEnd
    • Function
    • 输出命令结尾
    • Parameters
      • color, 颜色
// 例子
================================================================================
  • printUsage
    • Function
    • 输出命令使用
    • Parameters
      • description, 命令描述
      • cmd, 命令名称
// 例子
usage:
steamer doctor    help you check steamer running environment!!!
  • printOption
  • Function
    • 输出命令参数
    • Parameters
      • options, 参数数组
        • option.option, 参数名
        • option.alias, 参数别名
        • option.value, 参数值
// 例子
options:
    --help, -h                    123
    --ak, -a                      456
    --plugin, -p <plugin name>    789
    --help                        123

外部库

- fs ([fs-extra](https://github.com/jprichardson/node-fs-extra))
- chalk ([chalk](https://github.com/chalk/chalk))

开发及测试

// 用于全局进行代码清理
npm i -g eslint
npm run lint

// 用于测试
npm test