SiteWebAstrolabe/deploy.js

30 lines
1008 B
JavaScript
Raw Permalink Normal View History

2020-06-19 23:47:44 +02:00
var FtpDeploy = require("ftp-deploy");
var ftpDeploy = new FtpDeploy();
var config = {
user: "user",
// Password optional, prompted if none given
password: "password",
host: "ftp.someserver.com",
port: 21,
2020-07-18 02:22:53 +02:00
localRoot: __dirname + "/dist",
2020-06-19 23:47:44 +02:00
remoteRoot: "/public_html/remote-folder/",
2020-07-18 02:22:53 +02:00
include: ["*", "**/*", ".htaccess"], // this would upload everything except dot files
2020-06-19 23:47:44 +02:00
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
exclude: ["dist/**/*.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
};
// use with promises
ftpDeploy
.deploy(config)
.then(res => console.log("finished:", res))
.catch(err => console.log(err));
ftpDeploy.on("uploading", function(data) {
console.log(data.filename); // partial path with filename being uploaded
});