-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
32 lines (28 loc) · 839 Bytes
/
index.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
#!/usr/bin/env node
import yargs from 'yargs';
import chalk from 'chalk';
import safetyChecker from './src';
import doExport from './doExport';
const { argv } = yargs
.option('path', {
alias: 'p',
description: 'Path of the folder which is going to be served',
type: 'string',
}).option('table', {
alias: 't',
description: 'Whether to show in table mode or not',
type: 'boolean',
default: false,
})
.demandOption(['path'], 'Please specify path!')
.help()
.alias('help', 'h');
const { path, table: isTable } = argv as { path: string, table: boolean };
safetyChecker({ src: path }).then((result) => {
if (Object.keys(result).length) {
doExport({ isTable, result });
process.exit(-1);
} else {
console.log(chalk.green.bold('No vulnerabilities found!'));
}
}).catch(console.error);