change deploy type 'web' to 'ssh'
This commit is contained in:
parent
43073a9350
commit
b5223ae17c
1
.deploy_git
Submodule
1
.deploy_git
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 53affcafdaefb4873c9975ed65952af630e989ca
|
12
deploy.js
12
deploy.js
@ -29,7 +29,7 @@ try {
|
||||
commander
|
||||
.version('1.0', '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version'
|
||||
.option('-f, --from <from>', `from path to copy from. Default to ${Config.deploy.from}`)
|
||||
.option('-t, --type <type>', `Deploy to server type, web or git. Default to ${Config.deploy.type}`)
|
||||
.option('-t, --type <type>', `Deploy to server type, ssh or git. Default to ${Config.deploy.type}`)
|
||||
.option('-H, --host <host>', `Host IP or domain name of the target server. Default to ${Config.deploy.host}`)
|
||||
.option('-P, --port <port>', `Ssh port number of the target server. Default to ${Config.deploy.port}`)
|
||||
.option('-D, --dir <dir>', `Destination path to deploy on the target server. Default to ${Config.deploy.dir}`)
|
||||
@ -47,7 +47,7 @@ const privateKeyFile = commander.key || Config.deploy.key || `${process.env.HOME
|
||||
|
||||
const connection = {
|
||||
from: commander.from || Config.deploy.from || './dist',
|
||||
type: commander.type || Config.deploy.type || 'web',
|
||||
type: commander.type || Config.deploy.type || 'ssh',
|
||||
host: commander.host || Config.deploy.host,
|
||||
port: commander.port || Config.deploy.port || 22,
|
||||
dir: commander.dir || Config.deploy.dir, // 目标服务器上的目录。似乎该目录必须已经存在于服务器上
|
||||
@ -68,14 +68,14 @@ const connection = {
|
||||
}
|
||||
console.log(` connection = ${JSON.stringify(connection)}`)
|
||||
|
||||
if (connection.type==='web') {
|
||||
deployToWeb()
|
||||
if (connection.type==='ssh') {
|
||||
deployToSsh()
|
||||
}else if (connection.type==='git'){
|
||||
deployToGit()
|
||||
}
|
||||
|
||||
/** ********************** 连接到 Web主机,拷贝文件到指定路径 ************* **/
|
||||
function deployToWeb(){
|
||||
/** ********************** 连接到 Ssh主机,拷贝文件到指定路径 ************* **/
|
||||
function deployToSsh(){
|
||||
const ssh = new (require('node-ssh'))()
|
||||
|
||||
function subDirs (path) {
|
||||
|
Loading…
Reference in New Issue
Block a user