-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy.js
58 lines (55 loc) · 1.79 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const FtpDeploy = require('ftp-deploy');
const ftpDeploy1 = new FtpDeploy();
const ftpDeploy2 = new FtpDeploy();
const settings = require('./.ftpdeploy.js');
const config1 = {
user: settings.user,
// Password optional, prompted if none given
password: settings.password,
host: settings.host,
port: settings.port,
localRoot: __dirname + '/dist',
remoteRoot: settings.remoteRoot,
include: ["*.js*",],
// DON'T delete ALL existing files at destination before uploading, if true
deleteRemote: false,
// Passive mode is forced (EPSV command is not sent)
forcePasv: true,
// use sftp or ftp
sftp: false,
};
const config2 = {
user: settings.user,
// Password optional, prompted if none given
password: settings.password,
host: settings.host,
port: settings.port,
localRoot: __dirname + '/dist',
remoteRoot: settings.remoteRoot,
include: ['*'], // this would upload everything except dot files
// e.g. do not copy what was copied in config1. Also skip fonts and images because
// they (almost) never change and if they do, just add them one time.
exclude: ['*.js*', 'font/*', 'images/*'],
// DON'T delete ALL existing files at destination before uploading, if true
deleteRemote: false,
// Passive mode is forced (EPSV command is not sent)
forcePasv: true,
// use sftp or ftp
sftp: false,
};
ftpDeploy1
.deploy(config1)
.then((res) => {
for (let i in res[0]) {
console.log(res[0][i]);
}
ftpDeploy2
.deploy(config2)
.then((res) => {
for (let i in res[0]) {
console.log(res[0][i]);
}
})
.catch((err) => console.log(err));
})
.catch((err) => console.log(err));