-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_types.ts
59 lines (50 loc) · 1.35 KB
/
config_types.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
export enum LogLevels {
PERF, // everything
DEBUG, // no perf,
INFORM, // no debug, perf
SUCCESS, // no inform, debug, perf
WARN, // no inform, success, debug, perf
ERROR, // no inform, success, warn, debug, perf
NONE // completely silent
}
export type LogsLevelStr = keyof typeof LogLevels
/* this retroactive type pains to read, but with some examples it's quite simple
const _simple1 : NestedString = ""
const _simple2 : NestedString = ["", ""]
const _complex1 : NestedString = ["", ["", ""]]
const _complex2 : NestedString = ["", "", ["", "", ["", ""]]]
*/
export type NestedString = string | string[] | NestedString[]
export type GitConfig = {
branch: string,
commit?: string | boolean
autoUpdate?: boolean,
lastCommit?: string,
}
export type PartConfig = {
git: GitConfig,
folder: string,
precursor: NestedString,
}
export type ServerConfig = {
port: number,
//hostname: string,
//protocol: "http" | "https",
token: string,
version: string,
remote: {
owner: string,
repo: string,
branch: string,
}
}
export type ConfigData<T extends string> = {
logLevel: LogsLevelStr
active: T
list: Record<T, PartConfig>
versionFile: string,
server: ServerConfig,
}
export type GeneralConfig = {
base: string,
}