bug fix: console.info(url) 应当发生在异步的上传之后

This commit is contained in:
陆柯 2021-09-11 08:55:16 +08:00
parent c2c8ad6c93
commit 3e9680a295

View File

@ -112,11 +112,6 @@ if (connection.targetType==='ssh') {
deployToGit(connection)
}
console.info(`*** Successfully deployed ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} ***`)
if (connection.url){
console.info(`*** Visiting ${connection.url} ***`)
}
/** ********************** 连接到 Ssh主机拷贝文件到指定路径 ************* **/
function deployToSsh(connection){
const ssh = new (require('node-ssh'))()
@ -169,15 +164,19 @@ function deployToSsh(connection){
})
ssh.dispose()
if (err) {
console.log('[ Uploaded with error! ]')
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
process.exit(1)
} else {
console.log('[ Uploaded successfully! ]')
console.info(`😊😊😊 Successfully deployed ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 😊😊😊`)
if (connection.url){
console.info(`*** ${connection.url} ***`)
}
process.exit()
}
}).catch(err => {
console.error(err)
ssh.dispose()
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
process.exit(1)
})
}
@ -300,6 +299,14 @@ function deployToGit(connection){
})
}).then(() => {
return git('push', '-u', repo.url, 'HEAD:' + repo.branch, '--force')
}).then(()=>{
console.info(`😊😊😊 Successfully deployed ${connection.fromPath} to ${connection.repo}#${connection.branch} 😊😊😊`)
if (connection.url){
console.info(`*** ${connection.url} ***`)
}
}).catch((err)=>{
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
process.exit(1)
})
}
@ -313,7 +320,7 @@ function deployToGit(connection){
return fs.emptyDir(deployDir)
}).then(() => {
const opts = {}
// log.info('Copying files from public folder...')
// log.info('Copying files from local folder...')
if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden.public
} else {