-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.js
51 lines (41 loc) · 1.42 KB
/
data.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
const c = require("ansi-colors");
let current_file = "";
const store = {
errors: [],
warnings: [],
filequeue: {},
vhosts: {},
get current_file() {
return current_file;
},
set current_file(val) {
return current_file = val;
},
report() {
if (store.warnings.length) {
console.log(c.yellow(`${store.warnings.length} warnings: `) + store.warnings.join("\n"));
}
if (store.errors.length) {
console.log(c.red(`${store.errors.length} ERRORS: `) + store.errors.join("\n"));
}
if (store.errors.length && store.warnings.length) {
console.log(c.red(`DONE with ${store.errors.length} errors and ${store.warnings.length} warnings`));
} else if (store.errors.length) {
console.log(c.red(`DONE with ${store.errors.length} errors`));
} else if (store.warnings.length) {
console.log(c.yellow(`DONE with ${store.warnings.length} warnings`));
} else {
console.log(c.green(`DONE with 0 errors and 0 warnings`));
}
if (store.errors.length || store.warnings.length) {
console.log(c.cyan("\nsee above for more info"));
}
const success = store.errors.length === 0;
store.errors = [];
store.warnings = [];
store.filequeue = {};
store.vhosts = {};
return success;
},
};
module.exports = store;