easier-deploy

3.2.8 • Public • Published

easier-deploy 简易部署

通过指令实现自动化部署,压缩文件,上传文件到服务端,替换服务端文件,还能执行自定义脚本完成启动, 且支持分布式部署。

Usage 使用方法

安装依赖

npm i -D easier-deploy

在package.json中加入这个脚本

"script": {
    "deploy": "easier-deploy"
}

在终端输入这个指令

 npm run deploy [envkey] // eg: npm run deploy dev

如果你是第一次运行这个命令,它会在项目的根目录生成一个deploy.config.js文件。 然后你须修改这个文件去适配你的需求。

model.exports = {
	"context": './dist',
	"clean": false,
	"dev": [
		{
			"host": "10.0.0.1",
			"port": 22,
			"username": "admin",
			"password": "123456"
			"remotePath": "/home/admim/web/",
			"shell": "echo 'exec shell command success!!!'"
		}
	],
	[envKey]: []
}

你可以在终端上输入不同的环境键值去切换你的服务器配置,举个例子,你输入npm run dev 可以设置你的部署配置,然后就能把你的项目部署到dev服务器上。

deploy.config.js param 参数

name description type default value
context 项目的相对路径 string null
clean 清理服务器远端路径文件 boolean false
[envKey] 服务器配置 Array []

[enKey] param 环境参数

name description type default value
host 服务器ip string null
port 服务起ssh端口 number null
username 服务器用户名 string null
password 服务器密码 string null
privateKeyPath 私钥地址,选填 string null
privateKey 私钥键码,选填 string null
passphrase 私钥密码,选填 string null
remotePath 目标远端地址 string null
shell 部署完成后可执行的脚本 string null

Readme

Keywords

Package Sidebar

Install

npm i easier-deploy

Weekly Downloads

3

Version

3.2.8

License

MIT

Unpacked Size

8.16 kB

Total Files

5

Last publish

Collaborators

  • zerychou