pgy-deploy
v1.0.9
Published
使用ssh2与scp2实现代码发布
Downloads
27
Readme
设计理念
- 简化打包后提交到服务的繁琐操作;
- 前置与后置命令用于解决项目文件发布后需要执行部分命令而准备,以达到扩大应用范围;
环境
nodejs
安装
npm
npm i pgy-deploy -g
yarn
yarn global pgy-deploy
注:每次出现安装后需要重新配置环境配置文件路径
配置文件
- 默认环境配置文件:default.json(UTF-8)
- 注:配置文件默认设置在执行命令的当前目录下。配置文件名称和路径支持修改
{
"ceshi":{
"serverNmae": "", // 服务器简称(对服务器进行重命名,方便管理,可任意定义)
"loginWay":0, // 登陆方式 0:密码方式 1:证书方式
"host": "", // 服务器ip
"port": "", // 端口号
"username": "", // 连接用户名
"password": "", // 连接用户密码
"privateKeyPath":"", // 证书地址
"localPath": "路径", // 本地文件路径
"serverPath": "路径", // 服务器文件路径
"preCmd": "cd /www \n mkdir test", // 前置命令(字符串类型目录使用换行符 \n 分割)
"rearCmd": [
"cd /www",
"mkdir test"
] // 后置命令 (多条命令可以用数组分割)
},
"ceshiProd":{
// 支持参数与以上相同
},
"配置key支持自定义合法字符串":{
// 支持参数与以上相同
}
}
命令及相关配置
pgy-deploy -i [key]
pgy-deploy ?
pgy-deploy -d [name]
pgy-deploy -config
注:所有命令区分大小写
pgy-deploy -i [key]
项目发布命令 key:必填,此参数为每一组配置文件的key
例:
pgy-deploy -i ceshi
pgy-deploy -i ceshiProd
pgy-deploy ?
输出帮助文档
pgy-deploy -d [name]
修改(重置)默认环境配置文件路径及名称
name: 当此参数为空或不合法时,执行重置操作;此参数可设置为相对于运行命令的当前目录路径,也可以设置为绝对路径, 例:
pgy-deploy -d mydefalut.json
或
pgy-deploy -d ../mydefalut.json
或
pgy-deploy -d C:/Users/my/Desktop/mydefalut.json
pgy-deploy -config [key]
key:key为配置文件中的一组配置的键值 不传key时:打印当前设置的默认环境配置文件名称路径 当key存在时,打印对应组配置信息(可以用于测试配置是否正确)
pgy-deploy -v
查看当前包版本