-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
37 lines (32 loc) · 1.17 KB
/
Copy pathdeploy.js
File metadata and controls
37 lines (32 loc) · 1.17 KB
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
import dotenv from 'dotenv'
dotenv.config()
import path from 'path'
import FtpDeploy from 'ftp-deploy';
const __dirname = path.resolve()
var ftpDeploy = new FtpDeploy();
const config = {
user: process.env.SFTP_USER,
// Password optional, prompted if none given
password: process.env.SFTP_PASS,
host: process.env.SFTP_HOST,
port: process.env.SFTP_PORT,
localRoot: path.join(__dirname, 'dist'),
remoteRoot: "/server/data/resources/[scripter]/[crazy]/ProjectX_Inventory",
// include: ["*", "**/*"], // this would upload everything except dot files
include: ["**/*"],
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
exclude: ["**/*.LICENSE.txt"],
// 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: true
};
ftpDeploy
.on("uploading", (data) => {
console.log(`${data.transferredFileCount} / ${data.totalFilesCount}: ${data.filename}`)
})
.deploy(config)
.then(res => console.log("finished:", res))
.catch(err => console.log(err));