@@ -108,6 +108,8 @@ async function publishPackageInCI(
108
108
npmTag : string ,
109
109
dryRun : boolean
110
110
) {
111
+ let stdoutText = '' ;
112
+ let stderrText = '' ;
111
113
try {
112
114
const path = await mapPkgNameToPkgPath ( pkg ) ;
113
115
@@ -128,24 +130,34 @@ async function publishPackageInCI(
128
130
args . push ( '--dry-run' ) ;
129
131
}
130
132
133
+ if ( process . env . VERBOSE_NPM_LOGGING === 'true' ) {
134
+ args . push ( '--verbose' ) ;
135
+ }
136
+
131
137
// Write proxy registry token for this package to .npmrc.
132
138
await exec (
133
139
`echo "//wombat-dressing-room.appspot.com/:_authToken=${
134
140
process . env [ getEnvTokenKey ( pkg ) ]
135
141
} " >> ~/.npmrc`
136
142
) ;
137
-
138
143
const spawnPromise = spawn ( 'npm' , args , { cwd : path } ) ;
139
144
const childProcess = spawnPromise . childProcess ;
145
+ // These logs can be very verbose. Only print them if there's
146
+ // an error.
140
147
childProcess . stdout ?. on ( 'data' , function ( data ) {
141
- console . log ( `[publishing ${ pkg } ] stdout: ` , data . toString ( ) ) ;
148
+ stdoutText += data . toString ( ) ;
142
149
} ) ;
143
150
childProcess . stderr ?. on ( 'data' , function ( data ) {
144
- console . log ( `[publishing ${ pkg } ] stderr: ` , data . toString ( ) ) ;
151
+ stderrText += data . toString ( ) ;
145
152
} ) ;
146
153
await spawnPromise ;
147
154
return spawnPromise ;
148
155
} catch ( err ) {
156
+ console . log ( `Error publishing ${ pkg } ` ) ;
157
+ console . log ( `stdout for ${ pkg } publish:` ) ;
158
+ console . log ( stdoutText ) ;
159
+ console . log ( `stderr for ${ pkg } publish:` ) ;
160
+ console . error ( stderrText ) ;
149
161
throw err ;
150
162
}
151
163
}
0 commit comments