
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
easy-auto-deploy-cli
Advanced tools
一个轻量级、交互式的前端自动化部署工具。 支持 一键打包发布、上传进度条、历史版本备份 以及 秒级回滚。
基于 Node.js 开发,适用于 Vue, React, Angular 等所有需要静态资源部署的前端项目。
npm run build 命令。backups 目录。(假设你已经发布到 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 中配置的命令名,根据实际情况调整)
工具启动后,会出现以下交互菜单:
🚀 发布新版本 (Build & Deploy)
backups 目录除外)。🔙 版本回滚 (Rollback)
backups 目录下的历史版本列表。❌ 退出
部署完成后,你的服务器目录结构如下所示:
/www/server/nginx/html/my-project
├── assets/ # 当前运行的静态资源
├── index.html # 当前运行的入口文件
├── backups/ # ⚡️ 自动生成的备份目录
│ ├── dist_20240105_100000.zip
│ ├── dist_20240105_143000.zip
│ └── ...
└── ...
Q1: 报错 unzip: command not found
yum install unzip -yapt-get install unzip -yQ2: 报错 Timed out while waiting for handshake
readyTimeout 时间。Q3: 为什么 Windows 下无法通过方向键选择菜单?
prompts 库优化了 Windows 兼容性。请确保不要使用过旧的 CMD,推荐使用 PowerShell 或 VS Code 内置终端。Q4: 上传速度很慢?
deploy.config.js 中的 distPath 是否配置正确。如果配置成了根目录 ./,会导致将 node_modules 也打包上传,导致文件巨大。ISC / MIT
FAQs
Simple SSH deploy tool
The npm package easy-auto-deploy-cli receives a total of 3 weekly downloads. As such, easy-auto-deploy-cli popularity was classified as not popular.
We found that easy-auto-deploy-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.