-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
84 lines (51 loc) · 1.8 KB
/
app.ts
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// < Project Landscape by Alex Arbuckle > //
// import <
const cron = require('node-cron');
import { axiosGet } from 'lxrbckl';
import dataManager from './src/managers/dataManager';
import octokitManager from './src/managers/octokitManager';
import markdownManager from './src/managers/markdownManager';
import octokitConfig from './src/configs/octokitManagerConfig';
import markdownConfig from './src/configs/markdownManagerConfig';
// >
(async () => {
cron.schedule('0 0 * * 1,4,7', async () => {
// initialize objects <
const dataHandler: dataManager = new dataManager();
const octokitHandler: octokitManager = new octokitManager({
githubUsers : await axiosGet(octokitConfig.urlGitHubUsers)
});
const markdownHandler: markdownManager = new markdownManager({
elementResources : await axiosGet(markdownConfig.urlElementResources),
elementDescriptions : await axiosGet(markdownConfig.urlElementDescriptions)
});
// >
// fetch readme and build data <
// publish all elements from data <
await octokitHandler.fetchAllReadme({
callback : ({file, hyperlink}) => {
dataHandler.addProperties({
readmeHyperlink : hyperlink,
readmeProperties : markdownHandler.extractProperties(file)
});
}
});
await octokitHandler.publishAllReadme({
data : dataHandler.getData(),
callback : ({
topic,
subject,
projects,
ecosystem
}) => {
return markdownHandler.build({
topic : topic,
subject : subject,
projects : projects,
ecosystem : ecosystem
});
}
});
// >
});
})();