-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
deploy.js
49 lines (41 loc) · 1.1 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
import FtpDeploy from "ftp-deploy"
import auth from "./ftpauth.json" assert {type: "json"}
import pkg from "./package.json" assert {type: "json"}
import { dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const ftp = new FtpDeploy();
const configVer = {
user: auth.keycdn.username,
password: auth.keycdn.password,
host: auth.keycdn.host,
port: auth.keycdn.port,
localRoot: __dirname + "/lib",
remoteRoot: `/${pkg.version}/`,
include: ["*.*"],
exclude: [],
deleteRemote: true,
forcePasv: true,
sftp: false,
};
const configCurrent = {
user: auth.keycdn.username,
password: auth.keycdn.password,
host: auth.keycdn.host,
port: auth.keycdn.port,
localRoot: __dirname + "/lib",
remoteRoot: `/current/`,
include: ["*.*"],
exclude: [],
deleteRemote: true,
forcePasv: true,
sftp: false,
};
const run = async () => {
let result
result = await ftp.deploy(configVer)
console.log(result)
result = await ftp.deploy(configCurrent)
console.log(result)
}
run()