You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- inline this.#render logic. The initial setTimeout is only used during load(), so run it there instead.
- .unref() the progress bar's recurring timeout object
- reuse the progress bar's timeout object with .refresh() instead of making a new one every frame
- consolidate comments into one line and remove stale comments
- skip clearing the line on the first frame when resuming the spinner
- removed the test from $8631 as it was only testing that the very first frame of the spinner didn't clear the line, not any subsequent frames
This is built off of #8631, moving the "skip clearing the line..." logic into a flag that's passed during .resume()
// we get the chalk level based on a null stream meaning chalk will only use
231
-
// what it knows about the environment to get color support since we already
232
-
// determined in our definitions that we want to show colors.
225
+
// We get the chalk level based on a null stream, meaning chalk will only use what it knows about the environment to get color support since we already determined in our definitions that we want to show colors.
// Silent mode and some specific commands always hide run script banners
324
314
break
325
315
}elseif(this.#json){
326
-
// In json mode, change output to stderr since we don't want to break json
327
-
// parsing on stdout if the user is piping to jq or something.
328
-
// XXX: in a future (breaking?) change it might make sense for run-script to
329
-
// always output these banners with proc-log.output.error if we think they
330
-
// align closer with "logging" instead of "output"
316
+
// In json mode, change output to stderr since we don't want to break json parsing on stdout if the user is piping to jq or something.
317
+
// XXX: in a future (breaking?) change it might make sense for run-script to always output these banners with proc-log.output.error if we think they align closer with "logging" instead of "output".
331
318
level=output.KEYS.error
332
319
}
333
320
}
@@ -352,14 +339,12 @@ class Display {
352
339
break
353
340
354
341
caseinput.KEYS.read: {
355
-
// The convention when calling input.read is to pass in a single fn that returns
356
-
// the promise to await. resolve and reject are provided by proc-log
342
+
// The convention when calling input.read is to pass in a single fn that returns the promise to await. resolve and reject are provided by proc-log.
357
343
const[res,rej,p]=args
358
344
returninput.start(()=>p()
359
345
.then(res)
360
346
.catch(rej)
361
-
// Any call to procLog.input.read will render a prompt to the user, so we always
362
-
// add a single newline of output to stdout to move the cursor to the next line
347
+
// Any call to procLog.input.read will render a prompt to the user, so we always add a single newline of output to stdout to move the cursor to the next line.
363
348
.finally(()=>output.standard('')))
364
349
}
365
350
}
@@ -383,10 +368,7 @@ class Display {
383
368
384
369
#tryWriteLog (level,meta, ...args){
385
370
try{
386
-
// Also (and this is a really inexcusable kludge), we patch the
387
-
// log.warn() method so that when we see a peerDep override
388
-
// explanation from Arborist, we can replace the object with a
389
-
// highly abbreviated explanation of what's being overridden.
371
+
// Also (and this is a really inexcusable kludge), we patch the log.warn() method so that when we see a peerDep override explanation from Arborist, we can replace the object with a highly abbreviated explanation of what's being overridden.
390
372
// TODO: this could probably be moved to arborist now that display is refactored
this.#writeLog(log.KEYS.verbose,meta,'',`attempt to log crashed`, ...args,ex)
402
384
}catch(ex2){
403
-
// This happens if the object has an inspect method that crashes so just console.error
404
-
// with the errors but don't do anything else that might error again.
385
+
// This happens if the object has an inspect method that crashes so just console.error with the errors but don't do anything else that might error again.
// We always attempt to render immediately but we only request to move to the next frame if it has been longer than our spinner frame duration since our last update
0 commit comments