-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathscanner.js
More file actions
33 lines (27 loc) · 713 Bytes
/
scanner.js
File metadata and controls
33 lines (27 loc) · 713 Bytes
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
const startTime = process.hrtime.bigint();
const { validateConfig } = require("./utils");
const runScan = require("./run");
const scanner = {
run: async function run(config, configDir, method = "programmatic", silent) {
const { crawlFrom, errors } = validateConfig(config, configDir);
if (errors.length === 0) {
return await runScan({
config,
configDir,
crawlFrom,
startTime,
method: method,
silent,
});
} else {
if (!silent) {
console.error(`Config errors:`);
errors.forEach((error) => {
console.error(`- ${error}`);
});
}
process.exit(1);
}
},
};
module.exports = scanner;