@@ -8,7 +8,7 @@ const tufClient = require('@sigstore/tuf')
88
99const ArboristWorkspaceCmd = require ( '../arborist-cmd.js' )
1010const auditError = require ( '../utils/audit-error.js' )
11- const { log } = require ( 'proc-log' )
11+ const { log, output } = require ( 'proc-log' )
1212const reifyFinish = require ( '../utils/reify-finish.js' )
1313
1414const sortAlphabetically = ( a , b ) => localeCompare ( a . name , b . name )
@@ -65,7 +65,7 @@ class VerifySignatures {
6565 }
6666
6767 if ( this . npm . config . get ( 'json' ) ) {
68- this . npm . output ( JSON . stringify ( {
68+ output . standard ( JSON . stringify ( {
6969 invalid,
7070 missing,
7171 } , null , 2 ) )
@@ -77,91 +77,91 @@ class VerifySignatures {
7777 const auditedPlural = this . auditedWithKeysCount > 1 ? 's' : ''
7878 const timing = `audited ${ this . auditedWithKeysCount } package${ auditedPlural } in ` +
7979 `${ Math . floor ( Number ( elapsed ) / 1e9 ) } s`
80- this . npm . output ( timing )
81- this . npm . output ( '' )
80+ output . standard ( timing )
81+ output . standard ( '' )
8282
8383 const verifiedBold = this . npm . chalk . bold ( 'verified' )
8484 if ( this . verifiedSignatureCount ) {
8585 if ( this . verifiedSignatureCount === 1 ) {
8686 /* eslint-disable-next-line max-len */
87- this . npm . output ( `${ this . verifiedSignatureCount } package has a ${ verifiedBold } registry signature` )
87+ output . standard ( `${ this . verifiedSignatureCount } package has a ${ verifiedBold } registry signature` )
8888 } else {
8989 /* eslint-disable-next-line max-len */
90- this . npm . output ( `${ this . verifiedSignatureCount } packages have ${ verifiedBold } registry signatures` )
90+ output . standard ( `${ this . verifiedSignatureCount } packages have ${ verifiedBold } registry signatures` )
9191 }
92- this . npm . output ( '' )
92+ output . standard ( '' )
9393 }
9494
9595 if ( this . verifiedAttestationCount ) {
9696 if ( this . verifiedAttestationCount === 1 ) {
9797 /* eslint-disable-next-line max-len */
98- this . npm . output ( `${ this . verifiedAttestationCount } package has a ${ verifiedBold } attestation` )
98+ output . standard ( `${ this . verifiedAttestationCount } package has a ${ verifiedBold } attestation` )
9999 } else {
100100 /* eslint-disable-next-line max-len */
101- this . npm . output ( `${ this . verifiedAttestationCount } packages have ${ verifiedBold } attestations` )
101+ output . standard ( `${ this . verifiedAttestationCount } packages have ${ verifiedBold } attestations` )
102102 }
103- this . npm . output ( '' )
103+ output . standard ( '' )
104104 }
105105
106106 if ( missing . length ) {
107107 const missingClr = this . npm . chalk . bold ( this . npm . chalk . red ( 'missing' ) )
108108 if ( missing . length === 1 ) {
109109 /* eslint-disable-next-line max-len */
110- this . npm . output ( `1 package has a ${ missingClr } registry signature but the registry is providing signing keys:` )
110+ output . standard ( `1 package has a ${ missingClr } registry signature but the registry is providing signing keys:` )
111111 } else {
112112 /* eslint-disable-next-line max-len */
113- this . npm . output ( `${ missing . length } packages have ${ missingClr } registry signatures but the registry is providing signing keys:` )
113+ output . standard ( `${ missing . length } packages have ${ missingClr } registry signatures but the registry is providing signing keys:` )
114114 }
115- this . npm . output ( '' )
115+ output . standard ( '' )
116116 missing . map ( m =>
117- this . npm . output ( `${ this . npm . chalk . red ( `${ m . name } @${ m . version } ` ) } (${ m . registry } )` )
117+ output . standard ( `${ this . npm . chalk . red ( `${ m . name } @${ m . version } ` ) } (${ m . registry } )` )
118118 )
119119 }
120120
121121 if ( invalid . length ) {
122122 if ( missing . length ) {
123- this . npm . output ( '' )
123+ output . standard ( '' )
124124 }
125125 const invalidClr = this . npm . chalk . bold ( this . npm . chalk . red ( 'invalid' ) )
126126 // We can have either invalid signatures or invalid provenance
127127 const invalidSignatures = this . invalid . filter ( i => i . code === 'EINTEGRITYSIGNATURE' )
128128 if ( invalidSignatures . length ) {
129129 if ( invalidSignatures . length === 1 ) {
130- this . npm . output ( `1 package has an ${ invalidClr } registry signature:` )
130+ output . standard ( `1 package has an ${ invalidClr } registry signature:` )
131131 } else {
132132 /* eslint-disable-next-line max-len */
133- this . npm . output ( `${ invalidSignatures . length } packages have ${ invalidClr } registry signatures:` )
133+ output . standard ( `${ invalidSignatures . length } packages have ${ invalidClr } registry signatures:` )
134134 }
135- this . npm . output ( '' )
135+ output . standard ( '' )
136136 invalidSignatures . map ( i =>
137- this . npm . output ( `${ this . npm . chalk . red ( `${ i . name } @${ i . version } ` ) } (${ i . registry } )` )
137+ output . standard ( `${ this . npm . chalk . red ( `${ i . name } @${ i . version } ` ) } (${ i . registry } )` )
138138 )
139- this . npm . output ( '' )
139+ output . standard ( '' )
140140 }
141141
142142 const invalidAttestations = this . invalid . filter ( i => i . code === 'EATTESTATIONVERIFY' )
143143 if ( invalidAttestations . length ) {
144144 if ( invalidAttestations . length === 1 ) {
145- this . npm . output ( `1 package has an ${ invalidClr } attestation:` )
145+ output . standard ( `1 package has an ${ invalidClr } attestation:` )
146146 } else {
147147 /* eslint-disable-next-line max-len */
148- this . npm . output ( `${ invalidAttestations . length } packages have ${ invalidClr } attestations:` )
148+ output . standard ( `${ invalidAttestations . length } packages have ${ invalidClr } attestations:` )
149149 }
150- this . npm . output ( '' )
150+ output . standard ( '' )
151151 invalidAttestations . map ( i =>
152- this . npm . output ( `${ this . npm . chalk . red ( `${ i . name } @${ i . version } ` ) } (${ i . registry } )` )
152+ output . standard ( `${ this . npm . chalk . red ( `${ i . name } @${ i . version } ` ) } (${ i . registry } )` )
153153 )
154- this . npm . output ( '' )
154+ output . standard ( '' )
155155 }
156156
157157 if ( invalid . length === 1 ) {
158158 /* eslint-disable-next-line max-len */
159- this . npm . output ( `Someone might have tampered with this package since it was published on the registry!` )
159+ output . standard ( `Someone might have tampered with this package since it was published on the registry!` )
160160 } else {
161161 /* eslint-disable-next-line max-len */
162- this . npm . output ( `Someone might have tampered with these packages since they were published on the registry!` )
162+ output . standard ( `Someone might have tampered with these packages since they were published on the registry!` )
163163 }
164- this . npm . output ( '' )
164+ output . standard ( '' )
165165 }
166166 }
167167
@@ -463,7 +463,7 @@ class Audit extends ArboristWorkspaceCmd {
463463 chalk : this . npm . chalk ,
464464 } )
465465 process . exitCode = process . exitCode || result . exitCode
466- this . npm . output ( result . report )
466+ output . standard ( result . report )
467467 }
468468 }
469469
0 commit comments