Files
car-fetcher/deploy/ftp.js
2020-05-25 16:07:30 +03:00

30 lines
900 B
JavaScript

const FtpDeploy = require("ftp-deploy");
const ftpDeploy = new FtpDeploy();
const config = {
user: process.env.FTP_USER,
password: process.env.FTP_PASSWORD,
host: process.env.FTP_HOST,
port: process.env.FTP_PORT,
localRoot: __dirname + "/../frontend",
remoteRoot: "/public_html/car/",
// include: ["*", "**/*"], // this would upload everything except dot files
include: ["build/**"],
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
exclude: ["build/**/*.map", "node_modules/**", "node_modules/**/.*", ".git/**"],
// delete ALL existing files at destination before uploading, if true
deleteRemote: false,
// Passive mode is forced (EPSV command is not sent)
forcePasv: true
};
ftpDeploy
.deploy(config)
.then(res => {
console.log("Deployment to FTP finished");
return;
})
.catch((err) => {
console.log(err);
});