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

easy-auto-deploy-cli

v1.0.1

Published

Simple SSH deploy tool

Downloads

11

Readme

🚀 Easy-Auto-Deploy-CLI

一个轻量级、交互式的前端自动化部署工具。 支持 一键打包发布上传进度条历史版本备份 以及 秒级回滚

基于 Node.js 开发,适用于 Vue, React, Angular 等所有需要静态资源部署的前端项目。

github 仓库链接

✨ 主要特性

  • 📦 自动构建:自动执行本地 npm run build 命令。
  • 🤐 自动压缩:将构建产物压缩为 zip 包(支持高压缩比)。
  • 🚀 极速上传:通过 SSH 传输,带有实时进度条显示。
  • 💾 自动备份:部署前自动将新版本存入服务器 backups 目录。
  • 🔙 版本回滚:支持交互式选择历史版本,秒级回滚线上环境。
  • 🧹 自动清理:自动清理本地和远程的临时文件,保持整洁。
  • 💻 多平台支持:兼容 Windows (Powershell/CMD/Git Bash), macOS, Linux。

🛠️ 安装

方式一:从 npm 安装 (推荐)

(假设你已经发布到 npm,如果未发布请使用方式二)

npm i easy-auto-deploy-cli -g

方式二:本地开发模式

如果你下载了源码,想在本地调试使用:

# 进入工具目录
cd easy-auto-deploy-cli

# 安装依赖
npm install

# 链接到全局命令
npm link

⚙️ 项目配置

在你的业务项目(如 Vue 项目)根目录下,创建一个名为 deploy.config.js 的文件。

⚠️ 注意:请确保该文件包含敏感信息(密码/秘钥),建议在 .gitignore 中忽略此文件。

// deploy.config.js
module.exports = {
  // 本地配置
  local: {
    // 打包命令,例如 'npm run build:prod' 或 'yarn build'
    buildCommand: "npm run build:prod",

    // 打包生成的目录,通常是 'dist' 或 'dist-pro'
    // 请确保这与你 webpack/vite 配置的输出目录一致
    distPath: "./dist",
  },

  // 服务器配置
  server: {
    host: "192.168.1.100", // 服务器 IP
    port: 22, // SSH 端口
    username: "root", // 登录用户名

    // 认证方式一:使用密码
    password: "your_password",

    // 认证方式二:使用私钥 (推荐)
    // privateKey: 'C:/Users/Admin/.ssh/id_rsa',

    // 服务器上的部署目录 (Nginx 指向的目录)
    webDir: "/www/server/nginx/html/my-project",
  },
};

🚀 使用指南

在项目根目录下(即 deploy.config.js 所在目录),打开终端运行命令:

# 运行部署工具
easy-deploy

(注:easy-deploy 是你在 package.json bin 中配置的命令名,根据实际情况调整)

交互菜单

工具启动后,会出现以下交互菜单:

  1. 🚀 发布新版本 (Build & Deploy)

    • 执行本地打包 -> 压缩 -> 上传 -> 备份 -> 解压覆盖。
    • 服务器上的旧文件会被清理(backups 目录除外)。
  2. 🔙 版本回滚 (Rollback)

    • 读取服务器 backups 目录下的历史版本列表。
    • 选择一个时间节点,确认后立即恢复该版本。
  3. ❌ 退出

📂 服务器目录结构说明

部署完成后,你的服务器目录结构如下所示:

/www/server/nginx/html/my-project
├── assets/             # 当前运行的静态资源
├── index.html          # 当前运行的入口文件
├── backups/            # ⚡️ 自动生成的备份目录
│   ├── dist_20240105_100000.zip
│   ├── dist_20240105_143000.zip
│   └── ...
└── ...

❓ 常见问题 (FAQ)

Q1: 报错 unzip: command not found

  • 原因: 服务器未安装解压工具。
  • 解决:
    • CentOS: yum install unzip -y
    • Ubuntu: apt-get install unzip -y

Q2: 报错 Timed out while waiting for handshake

  • 原因: SSH 连接超时,可能是网络不通或 IP/端口错误。
  • 解决: 检查 VPN 是否开启,IP 是否正确,或者在代码中增加 readyTimeout 时间。

Q3: 为什么 Windows 下无法通过方向键选择菜单?

  • 解决: 本工具已使用 prompts 库优化了 Windows 兼容性。请确保不要使用过旧的 CMD,推荐使用 PowerShell 或 VS Code 内置终端。

Q4: 上传速度很慢?

  • 解决: 请检查 deploy.config.js 中的 distPath 是否配置正确。如果配置成了根目录 ./,会导致将 node_modules 也打包上传,导致文件巨大。

📄 License

ISC / MIT