Web前端项目自动部署脚本
npm install d-deploy
进入项目目录下
import deploy from 'd-deploy';
deploy();
-
name
: 名称 -
local
distDir
: 本地打包输出的路径distArchive
: 压缩打包文件的路径putFiles
: 其他文件
-
server
host
: 服务器 IPusername
: 服务器的登录用户名port
: 端口serverDir
: 项目路径bakeup
: 是否备份压缩包
-
cdn
: 选填 为flase或不填则不传cdnphoneNumber
:password
:uploadDir
: 上传打包的路径cdnDir
: 上传七牛服务器路径,建议传package.json name/version
[
{
"name": "prod",
"cdn": {
"phoneNumber": "10086",
"password": "12345",
"uploadDir": "./dist",
"cdnDir": "pkgName/1.0.0"
},
"local": {
"distDir": "./dist/*.*",
"distArchive": "./deploy/dist.tar.gz",
"putFiles": ["./deploy/pm2.prod.json", "./deploy/server.js"]
},
"server": {
"host": "",
"username": "devops",
"port": 33,
"serverDir": "/data/test",
"bakeup": false
}
}
]