-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (27 loc) · 797 Bytes
/
index.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
#!/usr/bin/env node
import { Command } from 'commander';
import cdnjs from './services/cdnjs.service.js';
const program = new Command();
program.addHelpText(
'afterAll',
`
Examples:
ppfang check
ppfang check -c 50
ppfang --help || ppfang
Happy hunting!
`
);
program
.name('ppfang')
.usage('[command] [option]')
.description('A tool which helps identifying client-side prototype polluting libraries');
program
.command('check')
.description('Verifies the latest libraries from cdnjs.com')
.option('-c, --concurrency <concurrency>', 'concurrency level', '10')
.action((options) => {
const concurrency = Number.parseInt(options.concurrency);
concurrency ? cdnjs.probeAll(concurrency) : cdnjs.probeAll(10);
});
program.parse();