File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -448,10 +448,12 @@ function cleanup (data) {
448448 }
449449
450450 const keys = Object . keys ( data )
451+
451452 if ( keys . length <= 3 && data . name && (
452453 ( keys . length === 1 ) ||
453454 ( keys . length === 3 && data . email && data . url ) ||
454- ( keys . length === 2 && ( data . email || data . url ) )
455+ ( keys . length === 2 && ( data . email || data . url ) ) ||
456+ data . trustedPublisher
455457 ) ) {
456458 data = unparsePerson ( data )
457459 }
Original file line number Diff line number Diff line change @@ -126,6 +126,34 @@ const packument = (nv, opts) => {
126126 '1.0.1' : { } ,
127127 } ,
128128 } ,
129+ 'cyan-oidc' : {
130+ _npmUser : {
131+ name : 'claudia' ,
132+ email : 'claudia@cyan.com' ,
133+ trustedPublisher : {
134+ id : 'github' ,
135+ oidcConfigId : 'oidc:a0e127d0-8d66-45d0-8264-e4f8372c7249' ,
136+ } ,
137+ } ,
138+ name : 'cyan' ,
139+ 'dist-tags' : {
140+ latest : '1.0.0' ,
141+ } ,
142+ versions : {
143+ '1.0.0' : {
144+ version : '1.0.0' ,
145+ name : 'cyan' ,
146+ dist : {
147+ shasum : '123' ,
148+ tarball : 'http://hm.cyan.com/1.0.0.tgz' ,
149+ integrity : '---' ,
150+ fileCount : 1 ,
151+ unpackedSize : 1000000 ,
152+ } ,
153+ } ,
154+ '1.0.1' : { } ,
155+ } ,
156+ } ,
129157 brown : {
130158 name : 'brown' ,
131159 } ,
@@ -438,6 +466,12 @@ t.test('package with --json and semver range', async t => {
438466 t . matchSnapshot ( joinedOutput ( ) )
439467} )
440468
469+ t . test ( 'package with _npmUser.trustedPublisher shows cleaned up property with --json' , async t => {
470+ const { view, joinedOutput } = await loadMockNpm ( t , { config : { json : true } } )
471+ await view . exec ( [ 'cyan-oidc@^1.0.0' ] )
472+ t . match ( joinedOutput ( ) , / c l a u d i a < c l a u d i a @ c y a n .c o m > / , 'uses oidc trustedPublisher info for _npmUser' )
473+ } )
474+
441475t . test ( 'package with --json and no versions' , async t => {
442476 const { view, joinedOutput } = await loadMockNpm ( t , { config : { json : true } } )
443477 await view . exec ( [ 'brown' ] )
You can’t perform that action at this time.
0 commit comments