npm-command

155 阅读1分钟

lib目录下通过文件名可以方便查找每一个npm command,,command.exec方法为command逻辑入口

BaseCommand

npm command的base class

主要能力
  • usage,每个npm command实例的usage getter
  • usageError,每个npm command实例的usage error factory

ArboristCmd

继承于BaseCommand,增加isArboristCmd的getter

get isArboristCmd () {
  return true
}

Command

static property
  • description,命令描述

  • name,命令详细名称、非简写

  • params,命令可用参数

  • usage,命令详细使用描述

common method
  • completion,生成命令补全信息
  • exec,命令逻辑入口