teambition / gulp-ssh

SSH and SFTP tasks for gulp
184 stars 38 forks source link

0.6.1版本有bug,只有文件夹传上去了,文件都没传上去 #69

Closed Q956164483 closed 6 years ago

Q956164483 commented 6 years ago
/*
  yarn add gulp gulp-ssh
 */
const gulp = require('gulp')
const GulpSSH = require('gulp-ssh')

const remotePath = '/home/wwwroot/default/hyan_weixin/public/pages/h5/2018/0125zaosangrenhe'
const config = {
  sshConfig: { // 正式
      host: 'xxxxxx',
      port: 22,
      username: 'root',
      password: 'xxxxxx',
  },
  // sshConfig: { // 测试
  //   host: 'xxxxxx',
  //   port: 22,
  //   username: 'root',
  //   password: 'xxxxxx',
  // },
  remotePath: remotePath,
  commands: [
      // 删除现有文件
      `rm -rf ${remotePath}`
  ]
}
let gulpSSH = new GulpSSH({
  ignoreErrors: false,
  sshConfig: config.sshConfig
})
/**
 * 上传前先删除服务器上现有文件...
 */
gulp.task('execSSH', () => {
  console.log('删除服务器上现有文件...')
  return gulpSSH.shell(config.commands, {filePath: 'commands.log'})
      .pipe(gulp.dest('logs'))
});
/**
 * 上传文件到服务器
 */
gulp.task('deploy', ['execSSH'],() => {
  console.log('开始上传文件到服务器...')
  return gulp.src('./dist/**')
      .pipe(gulpSSH.dest(config.remotePath))
});

老铁,你昨天是不是更新插件了。。。昨天用的这个配置还能传,今天新建个项目,然后就传不了了,找了半天发现原来两个插件的版本不一样,结果来git一看,刚好就在20小时前更新了。。。,现在传到服务器的只有空文件夹,文件都没有,但是上传的时候上传的网速有几百k,就是文件都没上去,你们没这个问题?

Q956164483 commented 6 years ago

刚刚把插件回退到0.6.0就好了,因该可以确定是更新出问题了

zensh commented 6 years ago

我自己测试了没问题,你的 deploy 写法错误,不能包在 setTimeout 中的 return

Q956164483 commented 6 years ago

上个版本真的没问题,也是这么写的,我试试不加定时器看看,谢谢了啊

Q956164483 commented 6 years ago

不加定时器也不行,上个版本还是可以。。。尴尬了。。。

zensh commented 6 years ago

难道 dependencies 不同?全新安装 node modules 呢