Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit a41c039

Browse files
authored
view: stop crashing when license field is an object (#20538)
PR-URL: #20538 Credit: @zkat Reviewed-By: @joeledwards
1 parent 483e011 commit a41c039

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/view.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ function prettyView (packument, manifest) {
200200
})
201201
const unpackedSize = manifest.dist.unpackedSize &&
202202
byteSize(manifest.dist.unpackedSize)
203+
const licenseField = manifest.license || manifest.licence || 'Proprietary'
203204
const info = {
204205
name: color.green(manifest.name),
205206
version: color.green(manifest.version),
@@ -208,7 +209,9 @@ function prettyView (packument, manifest) {
208209
description: manifest.description,
209210
deprecated: manifest.deprecated,
210211
keywords: (packument.keywords || []).map(color.yellow),
211-
license: manifest.license || manifest.licence || 'Proprietary',
212+
license: typeof licenseField === 'string'
213+
? licenseField
214+
: (licenseField.type || 'Proprietary'),
212215
deps: Object.keys(manifest.dependencies || {}).map((dep) => {
213216
return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
214217
}),

0 commit comments

Comments
 (0)