-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
35 lines (31 loc) · 1.14 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
let FtpDeploy = require('ftp-deploy');
let ftpDeploy = new FtpDeploy();
let transferedData = {
'totalFiles': {},
'transferedFiles': {},
'name': {}
};
let config = {
user: process.env.FTPUSER,
password: process.env.FTPPASS,
host: process.env.FTPHOST,
port: 21,
localRoot: __dirname + "/",
remoteRoot: "/",
include: ['*'],
exclude: ["*.**/*","node_modules/**/*",".git/**/*","*.md","*.json","coverage/**/*",".circleci/**/*","deploy.js","js/*"],
deleteRemote: false
};
ftpDeploy.deploy(config)
.then(res => console.log('finished: ' + res))
.catch(err => console.log(err));
ftpDeploy.on('uploading', data => {
transferedData.totalFiles = data.totalFilesCount; // total file count being transferred
transferedData.transferedFiles = data.transferredFileCount; // number of files transferred
transferedData.name = data.filename; // partial path with filename being uploaded
console.log(transferedData);
});
ftpDeploy.on('uploaded', function(data) {
console.log('transferedData :', transferedData); // same data as uploading event
console.log('data :', data);
});