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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ys-cli

v1.0.38

Published

ys command line tool

Downloads

55

Readme

ys-cli

YS 架构之命令行工具,用来快速创建项目、插件以及快速生成各模块代码的一个工具。它还支持插件的命令行功能,插件能够为琪扩展快速开发功能或者其他功能。

Install

npm i ys-cli -g

我们不必担心升级的问题,因为工具会自行检测升级,一旦检测到有版本更新,工具会强制自动为您升级。

Create a new project

ys new <project_name>

工具会提示您选择的框架和使用的路由,您只要按照提示选择即可。

Create worker module files

我们可以通过命令自动创建各自文件夹下的文件。

如果我们在 app/controller 文件夹下

ys add <new_file> # new_file: 不需要制定文件类型 比如你 `index.js`,那么你直接写 `index`

在具体模块文件夹下您不需要写入-c -m -s等文件类型,系统已经自动判断。

这样我们就可以在这里创建一个controller,当然你可以通过明确指定创建类型来创建这个文件。同样的,你可以在项目根目录创建其他模块的文件。

ys add <new_file> -c # 创建controller文件
ys add <new_file> -m # 创建middleware文件
ys add <new_file> -s # 创建service文件

如果您在app/controller文件夹下,使用ys add xxx -s那么,工具将为您创建在 app/service下。

注意:该命令只能在项目或者插件文件夹下使用

Install or uninstall plugin

ys install <plugin>
ys i <plugin>
ys uninstall <plugin>
ys d <plugin>
ys d

当我们需要卸载一个插件,而没有指定插件名的时候,系统将自动为您列出已经安装的插件,您只需要选择卸载即可。

注意:该命令只能在项目文件夹下使用

Create dev Plugin

ys create <plugin_name>

一旦创建,你就是可以在应用中使用path来指定到本插件目录进行调试。

Create plugin commander

我们可以通过插件定义的命令来调用功能。插件需要做的是:

{root}/.ys.command.js

/**
 * 我们通过导出一个class对象用来描述这个插件运行过程
 * @param thread `object` 单步线程对象
 * @param installer `object` cli工具提供的运行时对象
 */
module.exports = class CommanderModule {
  constructor(thread, installer) {
    this.installer = installer;
    this.thread = thread;
  }

  /**
   * 当我们处于项目文件夹下,我们额外提供给工具的命令支持
   * @param app `object` 模块`cmdu`的全局app对象 see: http://npmjs.com/cmdu
   * @param installer `object` cli工具提供的运行时对象
   */
  static ['command:framework'](app, installer) {
    app.command('test')
      .action(installer.task('../command'));
  }

  /**
   * 嵌入在{project root}/config/plugin.js中的代码
   * 它可以是一个json对象,也可以是一个字符床
   */
  ['options:plugin']() {
    return {
      enable: true,
      package: 'xxxx',
      agent: ['agent'],
      dependencies: []
    };
  }

  /**
   * 自定义安装逻辑
   * @param cwd `string` 项目或者插件根目录地址
   * @param name `string` 插件名称
   * @param cname `string` 插件别名
   */
  async ['life:created']({ cwd }) {}

  /**
   * 自定义卸载逻辑
   * @param cwd `string` 项目或者插件根目录地址
   * @param name `string` 插件名称
   */
  async ['life:destroyed']({ cwd }) {}
}

一旦安装了这个插件,那么我们就可以根据他提供的命令运行

ys test

License

It is MIT licensed.