forked from elastic/snyk-github-issue-creator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·32 lines (27 loc) · 900 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
#!/usr/bin/env node
'use strict'
const args = require('minimist')(process.argv.slice(2))
const chalk = require('chalk')
const { prompt } = require('enquirer')
const { init: initConfig, conf } = require('./lib/config')
const github = require('./lib/github')
const selectVulnerabilities = require('./lib/select')
const getVulnerabilities = require('./lib/vulnerabilities');
(async () => {
await initConfig(args)
const vulnerabilities = await getVulnerabilities()
do {
await github.createIssues(
await selectVulnerabilities(vulnerabilities),
conf.autoGenerate && !conf.batch ? await github.existingIssues() : null
)
} while ((await prompt({
type: 'confirm',
name: 'pickAnother',
message: 'Pick another issue?',
skip: conf.autoGenerate
})).pickAnother)
})().catch((err) => {
console.error(chalk.red(err ? err.stack : 'Aborted!'))
process.exit(1)
})