ftpDeploy.js 756 B

12345678910111213141516171819202122232425262728293031
  1. let FtpDeploy = require("ftp-deploy");
  2. let CONFIG = require('./../config/remote_config')
  3. let deploy = new FtpDeploy();
  4. let defaultConfig = {
  5. user: CONFIG.ACCOUNT.username,
  6. // Password optional, prompted if none given
  7. password: CONFIG.ACCOUNT.password,
  8. host: CONFIG.ACCOUNT.host,
  9. port: CONFIG.ACCOUNT.port,
  10. localRoot: '',
  11. remoteRoot: '',
  12. include: [],
  13. exclude: [],
  14. deleteRemote: false,
  15. forcePasv: true,
  16. sftp: true
  17. }
  18. function ftpDeploy (config) {
  19. config = Object.assign(defaultConfig, config)
  20. return deploy
  21. .deploy(config)
  22. .then(res => {
  23. console.log("finished:", res)
  24. return res
  25. })
  26. .catch(err => console.log(err));
  27. }
  28. module.exports = ftpDeploy