Repository navigation
Expand file tree
/
Copy pathupdate.ts
More file actions
54 lines (47 loc) · 1.39 KB
/
Copy pathupdate.ts
File metadata and controls
54 lines (47 loc) · 1.39 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { sleep_for } from "tstl/thread/global";
import payments from "../../api";
import { PaymentConfiguration } from "../../PaymentConfiguration";
import { ArrayUtil } from "../../utils/ArrayUtil";
import { Terminal } from "../../utils/Terminal";
async function main(): Promise<void>
{
//----
// PREPARATIONS
//----
// START UPDATOR SERVER
await Terminal.execute("npm run start:updator:master");
await sleep_for(1000);
// START BACKEND SERVER
await Terminal.execute("npm run start local xxxx yyyy zzzz");
await sleep_for(4000);
// API LIBRARY
const connection: payments.IConnection = {
host: `http://127.0.0.1:${PaymentConfiguration.API_PORT}`,
encryption: PaymentConfiguration.ENCRYPTION_PASSWORD
};
sleep_for(1000).then(async () =>
{
console.log("Start updating");
await Terminal.execute("npm run update");
console.log("The update has been completed");
}).catch(() => {});
try
{
await Promise.all(ArrayUtil.repeat(600, async i =>
{
await sleep_for(i * 10);
await payments.functional.monitors.system.sleep(connection, 3000);
}));
}
catch (exp)
{
throw exp;
}
await Terminal.execute("npm run stop");
await Terminal.execute("npm run stop:updator:master");
}
main().catch(exp =>
{
console.log(exp);
process.exit(-1);
});