-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathftp-deploy.js
32 lines (30 loc) · 1.01 KB
/
ftp-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
const FtpDeploy = require("ftp-deploy");
const ftpDeploy = new FtpDeploy();
const config = {
host: process.env.FTP_HOST,
port: process.env.FTP_PORT,
user: process.env.FTP_USERNAME,
// Password optional, prompted if none given
password: process.env.FTP_PASSWORD,
localRoot: __dirname + "/public",
remoteRoot: process.env.FTP_REMOTE,
// include: ["*", "**/*"], // this would upload everything except dot files
include: ["*"],
// 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: true,
// Passive mode is forced (EPSV command is not sent)
forcePasv: true,
// use sftp or ftp
sftp: false,
};
ftpDeploy
.deploy(config)
.then((res) => console.log("deploy finished: ", res))
.catch((err) => console.log("deploy error: ", err));