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

@carrotwu/wcli

v1.2.0

Published

A global cli tool that supports custom development, packaging and pushing

Readme

wcli

一个通过插件化的形式支持自定义开发打包推送的全局cli工具

安装

npm install @carrotwu/wcli --global
or
yarn global add @carrotwu/wcli

使用

  1. 请先确保项目根目录已经有wcliconfig.json文件,wcli命令的执行依托于该配置。
  2. 通过wcli plugin install XXX安装相应的plugin插件。
  3. 执行wcli提供的dev,publish,build等指令。

init命令

初始化模命令,适用于生成新的wcliconfig.json文件或者创建新的react后者vue项目模板。

wcli init (wj or wcliconfig)

在当前目录下新创建一个wcliconfig.json文件或者重置初始化当前目录逇wcliconfig.json文件

plugin指令

wcli plugin install

插件的安装支持两种方式,一种是github或者gitlab的ur地址,一种是通过npm包名的形式进行安装。插件会自动安装在项目根目录的plugins目录下,插件安装完成之后会自动执行install命令

// 通过npm的方式安装插件
wcli plugin install XXX-plugin -n

// 通过github或者gitlab的ssh或者https克隆地址下载插件(连接上带.git的)
wcli plugin install [email protected]:xxx.git
// 或者
wcli plugin install https://gitlab.xxx.com:xxx.git

wcli plugin init

当你需要编写一个插件时,可以通过wcli plugin init初始化一个插件目录模板。插件目录下会默认初始化四个文件。

  1. dev.js: 执行wcli dev命令时执行的文件。
  2. build.js: 执行wcli build命令时执行的文件。
  3. publish.js: 执行wcli publish命令时执行的文件。
  4. custom.js: 执行wcli custom命令时执行的文件。
  5. package.json: 初始化的插件package.json文件。

对于前三个文件的导出函数,会把一些可能使用到的参数变量或者wcli提供的一些通用方法通过context参数注入。具体context类型定义如下:

interface Context {
  config: {
    // 是否处于debug模式
    isDebug: boolean;
    // 项目根目录下的wcliconfig.json文件
    wcliConfigJson: WCliConfigJson;
    // 初始化publish命令时 用户所填的推送项目ssh token
    token?: string;
    // publish命令时 用户输入的commitMessage
    publishCommitMsg: string;
  };
  paths: {
      // 当前用户执行wcli命令的路径
    currentBinPath: string;
  };
  utils: {
      // 获取项目目录文件的通用方法
    getCurrentBinFilePath: (...paths: string[]) => string;
    // 默认提供的使用axios推送文件到gitlab的方法(只支持gitlab)
    publishFileWithGitlabCommit: typeof publishFileWithGitlabCommit;
    // 使用git命令推送文件的方法(支持github gitlab)
    publishFileWithGit: typeof publishFileWithGit;
    // 一些输出控制台新的方法(success warn loading error 等)
    logTools: typeof logTools;
  };
  toolsModules: {
      // 交互性的工具库 具体用法可以参考 https://github.com/SBoudrias/Inquirer.js/
    prompt: PromptModule;
    // axios
    axios: AxiosStatic;
    // fs-extra
    fse: typeof fse;
  };
}

一些额外的命令

  1. wcli plugin list: 表格展示已安装过得plugin列表。
  2. wcli plugin remove XXX: 删除具体某个插件。
  3. wcli plugin upgrade: 更新插件(todo 暂时是通过插件重新安装的方法更新)
  4. wcli plugin link XXX: 跟npm link相似,用于本地插件开发时的索引指向。用于本地插件的开发以及本地插件的使用

wcli dev

执行插件目录下的dev.js文件,在当前目录下可以手动启动一个webpack server服务。可以通过Inquirer让用户选择一些前置性的参数如(开发环境,代理地址,需要开发的路由模块等)个性化的启动开发模式。

dev.js中您可以使用一些框架库如vue-cli create-react-app字典的script命令,也可以在dev.js中自搭建一个webapck的server进行开发。

wcli build

跟wcli dev同理。可以自由定制项目打包时的环境以及参数等。

wcli custom [commands]...

允许插件编写者自定义wcli custom xxx命令的编写.