@@ -175,7 +175,7 @@ async function fetchPackageData (pkgName, pkgVersion, { includeAllIssues }, spin
175
175
const issueSummary = formatSeverityCount ( severityCount )
176
176
console . log ( '\n' )
177
177
spinner [ strict ? 'fail' : 'succeed' ] ( `Package has these issues: ${ issueSummary } ` )
178
- formatPackageIssuesDetails ( data )
178
+ formatPackageIssuesDetails ( data , outputMarkdown )
179
179
} else {
180
180
console . log ( '\n' )
181
181
spinner . succeed ( 'Package has no issues' )
@@ -197,9 +197,10 @@ async function fetchPackageData (pkgName, pkgVersion, { includeAllIssues }, spin
197
197
198
198
/**
199
199
* @param {import('@socketsecurity/sdk').SocketSdkReturnType<'getIssuesByNPMPackage'>["data"] } packageData
200
+ * @param {boolean } outputMarkdown
200
201
* @returns {void[] }
201
202
*/
202
- function formatPackageIssuesDetails ( packageData ) {
203
+ function formatPackageIssuesDetails ( packageData , outputMarkdown ) {
203
204
const issueDetails = packageData . filter ( d => d . value ?. severity === 'high' || d . value ?. severity === 'critical' )
204
205
const uniqueIssues = issueDetails . reduce ( ( /** @type {{ [key: string]: number } } */ acc , issue ) => {
205
206
const { type } = issue
@@ -212,11 +213,13 @@ function formatPackageIssuesDetails (packageData) {
212
213
}
213
214
return acc
214
215
} , { } )
216
+ const format = new ChalkOrMarkdown ( ! ! outputMarkdown )
215
217
return Object . keys ( uniqueIssues ) . map ( issue => {
218
+ const issueWithLink = format . hyperlink ( `${ issue } ` , `https://socket.dev/npm/issue/${ issue } ` , { fallbackToUrl : true } )
216
219
if ( uniqueIssues [ issue ] === 1 ) {
217
- return console . log ( `- ${ issue } ` )
220
+ return console . log ( `- ${ issueWithLink } ` )
218
221
}
219
- return console . log ( `- ${ issue } : ${ uniqueIssues [ issue ] } ` )
222
+ return console . log ( `- ${ issueWithLink } : ${ uniqueIssues [ issue ] } ` )
220
223
} )
221
224
}
222
225
0 commit comments