Skip to content

Commit e362a40

Browse files
committed
Answer my own questions
1 parent 037ea82 commit e362a40

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

lib/commands/audit.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,14 @@ class VerifySignatures {
227227
const node = edge.to || edge
228228
const { path, location } = node
229229
const { version } = node.package || {}
230-
// QUESTION: Do we need to handle `latest`?
230+
231+
// Skip packages that don't have a installed version, e.g. optonal dependencies
231232
if (!version) {
232233
return
233234
}
235+
234236
const type = edge.optional ? 'optionalDependencies'
237+
: edge.bundled ? 'bundledDependencies'
235238
: edge.peer ? 'peerDependencies'
236239
: edge.dev ? 'devDependencies'
237240
: 'dependencies'
@@ -242,17 +245,13 @@ class VerifySignatures {
242245
}
243246
}
244247

245-
// QUESTION: Confirm, is this the right thing to do here?
246-
//
247-
// deps different from prod not currently
248-
// on disk are not included in the output
248+
// Skip potentially optional packages that are not on disk, as these could
249+
// be omitted during install (e.g. via `--only=prod`)
249250
if (edge.error === 'MISSING' && type !== 'dependencies') {
250251
return
251252
}
252253

253-
// QUESTION: Confirm, is this the right thing to do here?
254-
//
255-
// if it's not a range, version, or tag, skip it
254+
// Skip if the package is not in a registry, e.g. local workspace package
256255
try {
257256
if (!npa(`${edge.name}@${edge.spec}`).registry) {
258257
return null

0 commit comments

Comments
 (0)