forked from Superalgos/Superalgos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DesktopRoot.js
75 lines (70 loc) · 2.43 KB
/
DesktopRoot.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
exports.newDesktopRoot = function newDesktopRoot() {
/*
This module represents the execution root of the Desktop App.
We use this module that is outside the Desktop folder to
load all node dependencies and get them ready to the actual App.
*/
let thisObject = {
run: run
}
return thisObject
async function run() {
/*
The DK object is accesible everywhere at the Superalgos Desktop App.
It provides access to all modules built for this App.
*/
global.DK = {}
/*
The SA object is accesible everywhere at the Superalgos Desktop App.
It provides access to all modules built for Superalgos in general.
*/
global.SA = {}
/* Load Environment Variables */
let ENVIRONMENT = require('./EnvironmentForDebug.js');
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
global.env = ENVIRONMENT_MODULE
/*
First thing is to load the project schema file.
*/
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
/*
Setting up the modules that will be available, defined at the Project Schema file.
*/
let MULTI_PROJECT = require('./MultiProject.js');
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
MULTI_PROJECT_MODULE.initialize(DK, 'DK')
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
/*
Setting up external dependencies.
*/
SA.nodeModules = {
fs: require('fs'),
util: require('util'),
path: require('path'),
web3: require('web3'),
ws: require('ws'),
open: require('open'),
http: require('http'),
octokit: require("@octokit/rest"),
simpleGit: require('simple-git'),
nodeFetch: require('node-fetch')
}
/*
Setting up Secrets.
*/
SA.secrets = {
array: require('./My-Secrets/Secrets.json'),
map: new Map()
}
for (let i = 0; i < SA.secrets.array.length; i++) {
let secret = SA.secrets.array[i]
SA.secrets.map.set (secret.codeName, secret)
}
run()
async function run() {
DK.app = require('./Desktop/DesktopApp.js').newDesktopApp()
await DK.app.run()
console.log('Superalgos Desktop App is Running!')
}
}
}