-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
53 lines (50 loc) · 1.17 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
var ghpages = require("gh-pages");
var { exec } = require("child_process");
var ora = require("ora");
const fs = require("fs");
async function publish() {
return new Promise((resolve, reject) => {
ghpages.publish(
"./out",
{
branch: "master",
repo: "https://github.com/Nawbc/deskbtm-homepage.git",
message: "Auto-generated commit",
user: {
name: "Nawbc",
email: "[email protected]",
},
},
(err) => {
if (err) {
reject(err);
} else {
resolve();
}
}
);
});
}
async function buildHomepage() {
await new Promise((resolve, reject) => {
exec("yarn static", (error) => {
if (error) {
reject(error);
} else {
resolve();
}
});
});
}
(async function name() {
const spinner = ora("building homepage...").start();
await buildHomepage();
spinner.stop();
spinner.clear();
console.log("Building successfully");
spinner.start("deploying homepage...");
await publish().catch((err) => console.error("Error:", err));
spinner.stop();
spinner.clear();
console.log("Deploying successfully");
})();