Skip to content

Commit 10c8fde

Browse files
committed
update
1 parent 5cf2308 commit 10c8fde

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

lib/commands/info/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,24 +202,30 @@ async function fetchPackageData (pkgName, pkgVersion, { includeAllIssues }, spin
202202
*/
203203
function formatPackageIssuesDetails (packageData, outputMarkdown) {
204204
const issueDetails = packageData.filter(d => d.value?.severity === 'high' || d.value?.severity === 'critical')
205-
const uniqueIssues = issueDetails.reduce((/** @type {{ [key: string]: number }} */ acc, issue) => {
205+
206+
const uniqueIssues = issueDetails.reduce((/** @type {{ [key: string]: {count: Number, label: string | undefined} }} */ acc, issue) => {
206207
const { type } = issue
207208
if (type) {
208209
if (!acc[type]) {
209-
acc[type] = 1
210+
acc[type] = {
211+
label: issue.value?.label,
212+
count: 1
213+
}
210214
} else {
211-
acc[type]++
215+
// @ts-ignore
216+
acc[type].count += 1
212217
}
213218
}
214219
return acc
215220
}, {})
221+
216222
const format = new ChalkOrMarkdown(!!outputMarkdown)
217223
return Object.keys(uniqueIssues).map(issue => {
218-
const issueWithLink = format.hyperlink(`${issue}`, `https://socket.dev/npm/issue/${issue}`, { fallbackToUrl: true })
219-
if (uniqueIssues[issue] === 1) {
224+
const issueWithLink = format.hyperlink(`${uniqueIssues[issue]?.label}`, `https://socket.dev/npm/issue/${issue}`, { fallbackToUrl: true })
225+
if (uniqueIssues[issue]?.count === 1) {
220226
return console.log(`- ${issueWithLink}`)
221227
}
222-
return console.log(`- ${issueWithLink}: ${uniqueIssues[issue]}`)
228+
return console.log(`- ${issueWithLink}: ${uniqueIssues[issue]?.count}`)
223229
})
224230
}
225231

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"dependencies": {
8383
"@apideck/better-ajv-errors": "^0.3.6",
8484
"@socketsecurity/config": "^2.0.0",
85-
"@socketsecurity/sdk": "^0.7.2",
85+
"@socketsecurity/sdk": "^0.7.3",
8686
"chalk": "^5.1.2",
8787
"globby": "^13.1.3",
8888
"hpagent": "^1.2.0",

0 commit comments

Comments
 (0)