diff --git a/deploy.js b/deploy.js index c1b90a0..a4799b3 100644 --- a/deploy.js +++ b/deploy.js @@ -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 {