let FtpDeploy = require("ftp-deploy"); let CONFIG = require('./../config/remote_config') let deploy = new FtpDeploy(); let defaultConfig = { user: CONFIG.ACCOUNT.username, // Password optional, prompted if none given password: CONFIG.ACCOUNT.password, host: CONFIG.ACCOUNT.host, port: CONFIG.ACCOUNT.port, localRoot: '', remoteRoot: '', include: [], exclude: [], deleteRemote: false, forcePasv: true, sftp: true } function ftpDeploy (config) { config = Object.assign(defaultConfig, config) return deploy .deploy(config) .then(res => { console.log("finished:", res) return res }) .catch(err => console.log(err)); } module.exports = ftpDeploy