-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync.js
40 lines (33 loc) · 1.13 KB
/
sync.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
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-console */
const ftp = require("basic-ftp");
require("dotenv").config();
async function uploadFiles() {
const client = new ftp.Client();
client.ftp.verbose = false;
try {
await client.access({
host: process.env.FTP_ROUTER,
user: process.env.FTP_USERNAME,
password: process.env.FTP_PASSWORD,
port: 21,
secure: false
});
console.log("Ensuring directories exist...");
await client.ensureDir("/addons/yuui");
await client.ensureDir("/addons/yuui/assets");
await client.ensureDir("/scripts");
await client.ensureDir("/");
await client.uploadFrom("dist/yuui", "/scripts/yuui");
await client.send("SITE CHMOD 755 /scripts/yuui");
await client.uploadFrom("dist/index.asp", "/addons/yuui/index.asp");
await client.uploadFrom("dist/app.js", "/addons/yuui/app.js");
await client.uploadFromDir("dist/assets", "/addons/yuui/assets");
console.log("Files uploaded successfully");
} catch (err) {
console.error("Error uploading files:", err);
} finally {
client.close();
}
}
uploadFiles();