1
1
import meow from 'meow'
2
2
import colors from 'yoctocolors-cjs'
3
3
4
+ import constants from '@socketsecurity/registry/lib/constants'
4
5
import { Spinner } from '@socketsecurity/registry/lib/spinner'
5
6
6
7
import { commonFlags , outputFlags , validationFlags } from '../flags'
@@ -14,11 +15,17 @@ import { formatSeverityCount, getSeverityCount } from '../utils/format-issues'
14
15
import { getFlagListOutput } from '../utils/formatting'
15
16
import { objectSome } from '../utils/objects'
16
17
import { getPublicToken , setupSdk } from '../utils/sdk'
18
+ import {
19
+ getSocketDevAlertUrl ,
20
+ getSocketDevPackageOverviewUrl
21
+ } from '../utils/socket-url'
17
22
18
23
import type { SocketIssue } from '../utils/format-issues'
19
24
import type { CliSubcommand } from '../utils/meow-with-subcommands'
20
25
import type { SocketSdkReturnType } from '@socketsecurity/sdk'
21
26
27
+ const { NPM } = constants
28
+
22
29
export const info : CliSubcommand = {
23
30
description : 'Look up info regarding a package' ,
24
31
async run ( argv , importMeta , { parentName } ) {
@@ -208,7 +215,7 @@ function formatPackageDataOutput(
208
215
}
209
216
210
217
const format = new ColorOrMarkdown ( ! ! outputMarkdown )
211
- const url = `https://socket.dev/npm/package/ ${ pkgName } /overview/ ${ pkgVersion } `
218
+ const url = getSocketDevPackageOverviewUrl ( NPM , pkgName , pkgVersion )
212
219
213
220
console . log ( '\n' )
214
221
if ( pkgVersion === 'latest' ) {
@@ -267,7 +274,7 @@ function formatPackageIssuesDetails(
267
274
for ( const issue of Object . keys ( uniqueIssues ) ) {
268
275
const issueWithLink = format . hyperlink (
269
276
`${ uniqueIssues [ issue ] ?. label } ` ,
270
- `https://socket.dev/npm/ issue/ ${ issue } ` ,
277
+ getSocketDevAlertUrl ( issue ) ,
271
278
{ fallbackToUrl : true }
272
279
)
273
280
if ( uniqueIssues [ issue ] ?. count === 1 ) {
0 commit comments