forked from guacsec/trustify-da-javascript-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (28 loc) · 817 Bytes
/
Copy pathindex.js
File metadata and controls
33 lines (28 loc) · 817 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
#!/usr/bin/env node
import exhort from '@trustification/exhort-javascript-api'
import process from 'node:process'
const [,, ...args] = process.argv
if ('stack' === args[0]) {
// arg[1] = manifest path; arg[2] = is html boolean
let html = args[2] === 'true'
let res = await exhort.stackAnalysis(args[1], html)
console.log(html ? res : JSON.stringify(res, null, 2))
process.exit(0)
}
if ('component' === args[0]) {
// arg[1] = manifest path
let res = await exhort.componentAnalysis(args[1])
console.log(JSON.stringify(res, null, 2))
process.exit(0)
}
if ('validateToken' === args[0]) {
// args[1] - the token passed
let tokens = {
"EXHORT_SNYK_TOKEN" : args[1]
}
let res = await exhort.validateToken(tokens)
console.log(res)
process.exit(0)
}
console.log(`unknown action ${args}`)
process.exit(1)