-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
43 lines (39 loc) · 1.58 KB
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var FtpDeploy = require("ftp-deploy");
var ftpDeploy = new FtpDeploy();
var config = {
user: "wachcio", // NOTE that this was username in 1.x
password: "dx0663382", // optional, prompted if none given
host: "wachcio.home.pl",
port: 21,
localRoot: __dirname + "/dist",
remoteRoot: "/public_html/wachcio/parafia_skrwilno",
include: ["*", "/dist"], // this would upload everything except dot files
exclude: ["dist/**/*.map"], // e.g. exclude sourcemaps - ** exclude: [] if nothing to exclude **
deleteRemote: true, // delete existing files at destination before uploading
forcePasv: true // Passive mode is forced (EPSV command is not sent)
};
// use with promises
ftpDeploy
.deploy(config)
.then(res => console.log("finished:", res))
.catch(err => console.log(err));
// use with callback
// ftpDeploy.deploy(config, function(err, res) {
// if (err) console.log(err);
// else console.log("finished:", res);
// });
ftpDeploy.on("uploading", function(data) {
// console.log("Uploading: " + data);
data.totalFilesCount; // total file count being transferred
data.transferredFileCount; // number of files transferred
data.filename; // partial path with filename being uploaded
});
ftpDeploy.on("uploaded", function(data) {
console.log(data); // same data as uploading event
});
ftpDeploy.on("log", function(data) {
console.log(data); // same data as uploading event
});
ftpDeploy.on("upload-error", function(data) {
console.log(data.err); // data will also include filename, relativePath, and other goodies
});