-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.ts
74 lines (64 loc) · 2.24 KB
/
configuration.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
import { ConfigurationHolder } from 'ajlm.utils';
/**
* Defines configuration object for tool
*/
export type TConfiguration = {
glob: {
ignore: string[]; // ignore entries of glob
},
build: {
script: "build", // npm script to call for building
forceDependantsRebuildOnChange: boolean; // On a package build due to hash diff, tell if we force
// dependant rebuild too
hash: {
excludedFolders: string[]; // excluded folders from hash
excludedFiles: string[]; // included files from hash
hashFileName: string; // hash file name
}
}
};
/**
* Configuration holder
*/
export class Configuration extends ConfigurationHolder<TConfiguration> {
private static instance: Configuration;
public static getInstance(): Configuration {
if(!Configuration.instance){
Configuration.instance = new Configuration();
}
return Configuration.instance;
}
public initialize(cfg: TConfiguration, defaultCfg?: TConfiguration): void {
super.initialize(cfg, defaultCfg);
}
}
/**
* Default Cfg
*/
export class DefaultConfiguration {
public static readonly defaultCfg: TConfiguration = {
glob: {
ignore: ["**/node_modules/**",
"**/dist/**",
"**/bin/**",
"**/lib/**",
"**/bundle/**",
"**/logs/**",
"**/cfg/**"]
},
build: {
forceDependantsRebuildOnChange: true,
script: "build",
hash: {
excludedFiles: [".*"],
excludedFolders: [".*",
"node_modules",
"dist",
"lib",
"bundle",
"logs"],
hashFileName: ".hash"
}
}
};
}