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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ect-cli

v1.0.7

Published

CLI tool for updating npm packages with SVN integration

Readme

ect-cli

CLI 工具,用于更新 npm 包并集成 SVN 操作,同时提供构建清理、打包和一键发布能力。

功能特性

  • 🔄 自动更新 npm 包到最新版本
    • 支持指定包名或使用默认包(ectv-base
    • 支持 URL 格式 .tgz 和普通版本号格式依赖
  • 🧾 集成 SVN 工作流
    • 支持 SVN 认证配置(地址、用户名、密码)
    • 自动执行 svn updatesvn commit,并在失败时尝试回滚和重试
  • 🚀 自动安装依赖
    • 更新完依赖后自动执行 npm install --force(可通过参数跳过)
  • ⚙️ 可配置 npm registry
    • 可通过 ect-cli config registry 或环境变量自定义 registry
  • 🧹 清理构建目录
    • 一键删除项目根目录下的 dist 目录
  • 📦 构建打包
    • 将任意目录(默认 dist)打包为 zip 文件
    • 压缩包名称基于 package.jsonnameversion(例如:ect-cli-1.0.5.zip
  • 📮 一键发布到 npm
    • 内置 release 脚本,自动递增版本号、构建并发布到 npm registry

安装

npm install -g ect-cli

配置

首次使用前,建议先配置 SVN 和 registry 信息:

# 设置 SVN 地址
ect-cli config svn-url <svn-url>

# 设置 SVN 用户名
ect-cli config svn-username <username>

# 设置 SVN 密码
ect-cli config svn-password <password>

# 设置 npm registry(可选,默认: https://registry.npmjs.org)
ect-cli config registry <registry-url>

# 查看当前配置
ect-cli config show

配置信息保存在 ~/.ect-cli/config.json

使用方法

更新包(update)

# 更新默认包(ectv-base)
ect-cli update

# 更新指定包
ect-cli update <package-name>

# 跳过 SVN 操作
ect-cli update --skip-svn

# 跳过 npm install
ect-cli update --skip-install

# 指定 registry(覆盖配置中的 registry)
ect-cli update --registry <registry-url>

配置管理(config)

# 显示所有配置
ect-cli config show

# 设置 SVN 地址
ect-cli config svn-url <url>

# 设置 SVN 用户名
ect-cli config svn-username <username>

# 设置 SVN 密码
ect-cli config svn-password <password>

# 设置 npm registry
ect-cli config registry <url>

清理构建目录(clean)

# 清理项目根目录下的 dist 目录
ect-cli clean

此命令会永久删除 dist 目录,请谨慎使用。

打包目录为 zip(pack)

默认将项目根目录下的 dist 目录打包到 ./release 目录,压缩包名为 <name>-<version>.zip

# 打包 dist 到 ./release/ect-cli-<version>.zip
ect-cli pack

# 打包自定义目录(例如 build)到 ./release
ect-cli pack build

# 指定输出目录(例如 ./artifacts)
ect-cli pack dist -o ./artifacts

开发

安装依赖

npm install

开发模式

npm run dev

构建

npm run build

构建后的文件在 dist/ 目录。

发布

自动发布

发布脚本会自动:

  1. 递增版本号(patch / minor / major
  2. 更新 package.json 中的版本号
  3. 执行构建(使用 Rollup 打包并混淆)
  4. 发布到配置好的 npm registry
# 发布 patch 版本(默认)
npm run release

# 发布 minor 版本
npm run release:minor

# 发布 major 版本
npm run release:major

发布配置

package.json 中配置发布 registry(默认已指向官方 npm):

{
  "publishConfig": {
    "registry": "https://registry.npmjs.org"
  }
}

或通过环境变量:

export NPM_REGISTRY=https://npm.bg-online.com.cn
npm run release

工作流程

执行 ect-cli update 时,工具会:

  1. 🔍 查询 npm registry 获取最新可用版本
  2. 🔄 如果配置了 SVN:
    • 执行 svn update 更新工作副本
    • 自动递增项目自身的 patch 版本号(例如 1.0.0 → 1.0.1)
  3. 📝 更新 package.json 中目标依赖的版本(支持 URL / 版本号两种格式)
  4. 📦 执行 npm install --force 安装依赖(可使用 --skip-install 跳过)
  5. 📤 提交 package.json 到 SVN(如果配置了 SVN 且未使用 --skip-svn

支持的依赖格式

工具支持两种依赖格式:

  1. URL 格式

    {
      "dependencies": {
        "ectv-base": "https://npm.bg-online.com.cn/ectv-base/-/ectv-base-1.7.561.tgz"
      }
    }
  2. 版本号格式

    {
      "dependencies": {
        "ectv-base": "^1.7.561"
      }
    }

错误处理

如果 SVN 提交失败,工具会:

  1. 回滚本地修改
  2. 更新远端最新版本
  3. 重新应用依赖更新
  4. 再次尝试提交

许可证

ISC