Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/commands/package/fetch-purl-deep-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { getDefaultToken } from '../../utils/sdk'
const { SOCKET_CLI_ISSUES_URL } = constants

export async function fetchPurlDeepScore(purl: string) {
logger.info(`Requesting deep score data for this purl: ${purl}`)

const apiToken = getDefaultToken()
if (!apiToken) {
throw new AuthError(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/package/fetch-purls-shallow-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
export async function fetchPurlsShallowScore(
purls: string[]
): Promise<SocketSdkReturnType<'batchPackageFetch'> | undefined> {
logger.error(
logger.info(
`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`
)

Expand Down
15 changes: 14 additions & 1 deletion src/commands/package/parse-package-specifiers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ describe('parse-package-specifiers', async () => {
`)
})

it('should support npm scoped packages', () => {
expect(
parsePackageSpecifiers('npm', ['@babel/core'])
).toMatchInlineSnapshot(`
{
"purls": [
"pkg:npm/@babel/core",
],
"valid": true,
}
`)
})

it('should parse a simple purl without prefix', () => {
expect(parsePackageSpecifiers('npm/babel', [])).toMatchInlineSnapshot(`
{
Expand Down Expand Up @@ -52,7 +65,7 @@ describe('parse-package-specifiers', async () => {
).toMatchInlineSnapshot(`
{
"purls": [
"pkg:golang/foo",
"pkg:npm/golang/foo",
"pkg:npm/babel",
"pkg:npm/tenko",
],
Expand Down
3 changes: 0 additions & 3 deletions src/commands/package/parse-package-specifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export function parsePackageSpecifiers(
} else if (pkg.startsWith('pkg:')) {
// keep
purls.push(pkg)
} else if (pkg.includes('/')) {
// Looks like this arg was already namespaced
purls.push('pkg:' + pkg)
} else {
purls.push('pkg:' + ecosystem + '/' + pkg)
}
Expand Down